Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Writing the help action

The interface ILiveHelpAction is used to build an active help action.

It is straightforward to implement an ILiveHelpAction .  You must implement two methods.

  • run() - This method is called to run the live help action.  This method will be called by the help system from a non-UI thread, so UI access must be wrapped in a Display.syncExec() method.  
  • setInitializationString(String) - This method is called to initialize your action with a String data parameter you can specify in the HTML which runs the JavaScript liveAction.   If you don't need initialization data, you can just implement this method to do nothing.  This method is called before run().

Here is a simple implementation of a live help action that opens a message dialog. We don't need any information from the JavaScript, so the initialization data is ignored.

package org.eclipse.platform.doc.isv.activeHelp;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.*;
 * Sample Active Help action.
public class ActiveHelpOpenDialogAction implements ILiveHelpAction {

     public void setInitializationString(String data) {
          // ignore the data.  We do not use any javascript parameters.

     public void run() {
          // Active help does not run on the UI thread, so we must use syncExec
          Display.getDefault().syncExec(new Runnable() {
               public void run() {
                    IWorkbenchWindow window =
                    if (window != null) {
                         // Bring the Workbench window to the top of other windows;
                         // On some Windows systems, it will only flash the Workbench
                         // icon on the task bar
                         Shell shell = window.getShell();
                         // Open a message dialog
                              "Hello World.",
                              "Hello World.");

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire