Help, I’m looking for directions — Eclipse Active Help

Help, I’m looking for directions — Eclipse Active Help

I know Eclipse ‚Help‘ is not a very exciting topic, but today I found myself working with a little known secret of Help.  Most people know that you can setup context sensitive help (Press F1 and bring up help for the specific workbench part under focus).   However, did you now you do the opposite?  That is, activate code in your RCP application from a link in Help?

Here’s the use case:  Say you have created a chat client built on the Eclipse RCP Platform.  Like any good software engineer, you’ve created extensive help content.  In addition to Instructions, you want to provide links that actually open the dialogs, or perform the actions. Active Help is the solution.

In this example, I’ve added a link that opens the „Add Contact“ dialog, directly from the „Adding a Contact“ Help page.

Doing this is extremely simple too. On the Java side, you simply need to implement the ILiveHelpAction.  Then, on the help side you simply add the following JavaScript to your help contents:

<a href='javascript:liveAction(
	"")'>Click here for a Message.</a>

The only thing to keep in mind is that the Action is not executed on the UI thread, so you may need to synchronize this yourself.