The Eclipse platform provides means of showing little a help popup window when the user presses the button F1. These so called Infopops contain short help texts and optional hyperlinks to get more information in the main help window.
These infopops can be added to any SWT control so that a pressed key F1 triggers their display. The task for a developer is to create the context entries for the infopops and connect them to the controls that should be enabled to show them on demand. Using the Help Exporer view can simplify collecting the information needed to build the infopops. In the next sections depict the creation and addition of such an infopop. The used infopop describes the purpose of a view and adds two hyperlinks to both a help file in the same plug-in and one in another standard plug-in.
plugin.xml
org.eclipse.help
defining the extension-point contexts
is listed in the Dependencies pageorg.eclipse.help.contexts
using the Add... button in the Extensions pageorg.eclipse.help.contexts
and press Finishcontext
element, right-click on it and select the context menu item Properties.
In the Properties view enter a valid file name like contexts.xml
as value for the file
property.contexts.xml
) in an editor and add the following lines to create a new context identified by MyViewContextID
:
<contexts> <context id="MyViewContextID"> <description>My view shows nice stuff. </description> <topic label="My view" href="doc/my_view.htm"/> </context> </contexts>
doc
if it does not exist yet and add a file my_view.htm
in theredoc/my_view.htm
in an editor and create some HTML contents like:
<html> <head> <title>My view</title> </head> <body> <h2>My view</h2> <p> My view shows nice stuff. </p> </body> </html>
<contexts> <context id="MyViewContextID"> <description>My view shows nice stuff. </description> <topic label="Views" href="../org.eclipse.platform.doc.user/concepts/concepts-5.htm"/> <topic label="My view" href="doc/my_view.htm"/> </context> </contexts>Please note that references to help files in other plug-ins always have to be relative. That is, they must start with the
../
parent path directive.
private void setHelp(Control control) { WorkbenchHelp.setHelp(control, "myplugin.MyViewContextID"); }Please compose the fully qualified context identifier from the plug-in unique identifier and the context identifier separated by a dor (.). In our example it was composed from a plug-n identifier myplugin and a context identifier MyViewContextID.
public void createPartControl(Composite parent) { setHelp(parent);The context is best linked to the parent control to ensure that regardles which control within the view has the focus, the infopop can be identified and displayed.
Infopops
Simple plug-in example
Navigating the help system
Adding to the table of contents
Help Exporer view
Properties view
Plug-in manifest editor
Dependencies page
Extensions page
Plug-in Manifest
Extension-point org.eclipse.help.contexts