RCP Help System

Source: Internet
Author: User
In RCP, you can also use eclipse help to build your own help system. The eclipse help system includes static, dynamic, and context-sensitive help, which can be applied to RCP. In RCP, the help is also added through plugin. If you want to help depend on the specified plugin, you can also make it into the fragment form, which is in the form of plugin. To implement the complete help function, you must add the following plug-ins in the plugin. xml dependency: Add a plug-in1. Org. Apache. Lucene2. Org. Eclipse. Help. appserver3. Org. Eclipse. Help. Base4. Org. Eclipse. Help. UI5. Org. Eclipse. Help. webapp 6. Org. Eclipse. UI. Forms 7. org. Eclipse. Equinox. http. Jetty (this plug-in is not added, and an error is prompted during runtime)Click Add required plug-ins in the dependencies of the XXX. Product file you created)
Add help contents to the Help menu

Instantiate the help constents action in the actionbaradvisor. makeactions () method of RCP and register it in the workbench.

Private iworkbenchaction helpcontenstsaction; // declare an actionhelpcontenstsaction = actionfactory. help_contents.create (window); Register (helpcontenstsaction );
In method fillmenubar (), add helpcontenstsaction in the Help menu.

MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);helpMenu.add(helpContenstsAction);
Add help content

A help file is a set of HTML files. To add it to the help system, you must have a configuration file that defines the structure of the Help file, which is in XML format. The Help file must be a standard HTML file. CSS can also be added for the sake of aesthetics.

Add the extension point org. Eclipse. Help. TOC to plugin. xml.

<! -- This extension point informs the help system of all TOC files. The TOC file defines the display structure of the help, which is displayed on the left of the help dialog box. --> <Extension point = "org. eclipse. help. TOC "> <TOC file =" TOC/activitytoc. XML "> </TOC> <TOC file =" TOC/designertoc. XML "primary =" true "> <! -- Ensure that the file is always displayed in the Help dialog box --> </TOC> </extension>
This extension point tells the help system all the TOC files, the display structure of the help defined in the TOC file, they are displayed on the left of the help dialog box. This extension point identifies two TOC files, all of which are at the top level of the help. TOC. XML is marked as primary, which is always displayed in the Help dialog box. Activitytoc. XML can also be left empty.
Designertoc. xml

<? XML version = "1.0" encoding = "UTF-8"?> <? NLS type = "org. Eclipse. Help. TOC"?> <TOC label = "" topic = "Help/maintopic.html"> <topic label = "tool"> <topic label = "Wizard"> <topic label = "Import jtangflow project Wizard "href =" Help/tools/Wizard/importwizard.html "/> </topic> </TOC>
Importwizard.html

<! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"> <HTML> Run RCP. You can see the added help content in the Help dialog box.



Add context sensitive help
Add the extension point org. Eclipse. Help. contexts to plugin. xml.

<extension       point="org.eclipse.help.contexts">    <contexts          file="HelpContexts.xml"          plugin="MyDesigner">    </contexts> </extension>
The helpcontexts. xml file defines the ing between the context ID and the displayed content.

<? XML version = "1.0" encoding = "UTF-8"?> <Contexts> <context ID = "importwizard"> <description> Import workflow project wizard </description> <topic href = "Help/tools/Wizard/importwizard.html" label = "Import Workflow project Wizard "/> </context> </contexts>
Helputil help document operation class

Import Org. eclipse. SWT. widgets. control; import Org. eclipse. UI. platformui;/*** help document operation class * @ author lww **/public class helputil {public static void sethelp (Control, string localcontextid) {If (control = NULL) return; platformui. getworkbench (). gethelpsystem (). sethelp (control, workflowactivator. plugin_id + ". "+ localcontextid );}}
Workflowactivator. plugin_id is used to obtain the plugin ID of the current plug-in.
I added context-sensitive help to the wizardpage method createcontrol of the imported file.

Helputil. sethelp (topcomp, "importwizard"); // set topcomp, which is the Panel object in the createcontrol method, and importwizard, which is the ID defined in the helpcontexts. xml file,
If the Help button icon is not displayed in your import, it is likely that your current RCP has not started the help system.

You only need to activate the Help button on the wizard page in the initialize Initialization Method of workbenchadvisor.

Traydialog. setdialoghelpavailable (true); // activate the Help button on the Wizard Page
In this way, you can see the help context when running the import.


Reference: http://blog.csdn.net/moneyice/article/details/715795











RCP Help System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.