问题
I'm creating an RCP application and wanted to provide documentation using the Eclipse Help Contents (Help > Help Contents
), I managed to add some pages to it by using the extension point org.eclipse.help.toc
, this works fine, but I'm interested in providing a link in one of those pages to launch a wizard, I found that Eclipse provides support for this using a feature called Active Help.
First, in my html Help page I have imported the livehelp.js
script:
<head>
...
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"></script>
<head>
Then in the <body>
I added a link:
<a href='javascript:liveAction("com.test.my.plugin", "com.test.my.plugin.actions.TestAction", "")'>Execute action</a>
And finally, this my TestAction
class:
public class TestAction implements ILiveHelpAction {
@Override
public void run() {
System.out.println("Action executed");
// code to launch wizard is here
}
@Override
public void setInitializationString(String str) {
}
}
But when the link is clicked the action is not executed, I tried setting a breakpoint in the run()
method but it is never called, any idea why this is happening?
回答1:
I had exactly the same problem. But I think I was doing something wrong: I was copying my plugin manually into eclipse/plugins directory.
I tried with a "correct" plugin distribution mechanisms:
- a feature plugin
- an update site plugin
- a standard installation from within eclipse instance, menu help-> install new software
And now things are working... my action gets called normally..
来源:https://stackoverflow.com/questions/58205437/launch-wizard-from-active-help-page-in-eclipse