Help in Eclipse RCP application

Until you are working at Google or Apple your applications probably requires some sort of help system (UX). Eclipse help system can be easily reused in your custom application based on Eclipse RCP.

Let assume that you already have RCP application (if not you can use one of the wizards provided in Eclipse to get one).  In order to enable help there you need to add three dependencies explicitly in plugin.xml:

  • org.eclipse.help.ui
  • org.eclipse.help.ui.webapp
  • org.eclipse.equinox.http.jetty

After adding those make sure to update *.product configuration and add all new required dependencies.

The next step is adding an extension which will provide the help content in plug-ins that will contribute it. The extension point that provides this feature is: org.eclipse.help.toc (there is one template with dummy help content available to choose in Extension Point Selection form).

Now some menu item that will launch help needs to be added. It can be done in plugin.xml:

  • Add an extension (if you don’t have it already) : org.eclipse.ui.menus
  • Add new element: menuContribution with locationURI menu:file
  • Add new command with id: org.eclipse.ui.help.helpContents

Last step is registering an action that will be binded to previously created menu item. It can be done in a class that extends ActionBarAdvisor (if you created your RCP application using default wizard it will be called ApplicationActionBarAdvisor. You need to override one method:

protected void makeActions(IWorkbenchWindow window) {
	this.contentsHelpAction = ActionFactory.HELP_CONTENTS.create(window);
	register(this.contentsHelpAction);
}

Now help system with sample content should be available in Help menu. It will launch separate window and display content there. A help content can be provided by any plug-in extending org.eclipse.help.toc extension point. It is set of HTML documents which are displayed together in one common place, framework provides built-in search, index, table of contents etc (Eclipse uses Jetty as a web server, try this in a browser).

2 comments

  1. This is great. I searched for over an hour looking for information on adding a menu item to the Help menu through the org.eclipse.ui.menus extension point. Thank you so much.

    Like

  2. HI,

    How to add command handler to the menumanager because

    Menumanager has add method which accept action has input it will not accept command handler…

    IMenuService menuservice = (IMenuService)PlatformUI.getWorkbench().getActiveWorkbenchWi ndow().getService(IMenuService.class);
    ICommandService commadnService = (ICommandService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getServ ice(ICommandService.class);
    Command cmnd = commadnService.getCommand(“com.jobsleaf.comman.display”);
    MenuManager menumgr = new MenuManager();

    /// how can i add command to menu manager

    menuservice.populateContributionManager(menumgr,”menu:com.ericsson.properties.view.view4 “);

    Please help me i am half the way of the problem

    more info

    http://www.eclipse.org/forums/index.php?t=msg&th=207827&start=0&S=bcb7e587d80fac913deba3389ec6e070
    Thanks
    Ashok

    Like

Leave a comment