In this section I want to show the steps to define your own
documentation plug-in to integrate your online documentation with
Eclipse.
1. Create the help content as HTML files and store them in your plug-in
directory. Normally we use doc in the name. If there are too many
files, you can creat a ZIP file named doc.zip.
2. Decliare the HELP Table of Contents in your plug-in using the
org.eclipse.help.toc extension point and specify the table of content
files.
Example:
<extension point = "org.eclipse.help.toc">
<toc file ="DialogTOC.xml"/>
<toc file ="MoreTOC.xml"/>
<toc file ="TestTOC.xml"
primary = "true"
extradir = "lab">
</toc>
</extension>
The table of the contents will be
described by one or more XML files. In this example, TestTOC.xml is the
primary table of contents file, which describes the structure and order
of the other files by linking them together.
Example: TestTOC.xml
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="JDG2E: Help Example TOC">
<link toc="DialogTOC.xml" />
<anchor id="moreLabs" />
</toc>
3. Create the table of contents files by linking the topic together.
Example: MoreTOC.xml
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc link_to="TestToc.xml#moreLabs"
label="More interesting labs">
<topic label="JDT Main Topic" href="html/maintopic.html">
<topic label="JDT Sub Topic" href="html/subtopic.html"/>
</topic>
<topic label="Extra Topic" href="lab/doc1/info1.html">
<topic label="Using the extradir attrib" href="lab/doc2/info2.html"/>
</topic>
</toc>
In addition, you can invove the
Eclipse Help system form any Java program indenpendent from Eclipse.
This is called "standalone" mode. To do that, you simply use the
Platform Runtime Binary version of Eclipse as opposed to the SDK and
inovke the main methode in the class
org.eclipse.help.internal.standalone.StandaloneHelp. Of course you
should pass the location of the plugins directory,which includes the
online contents, as a paramter.
(The example used is taken from the book "The Java
TM Developer's Guide to Eclipse".)