We started this example by creating our plug-in and document files. Next we created toc files to describe the organization of our content. The remaining piece of work is to pull everything together into a master toc and update our plugin.xml to actually contribute the master toc.
We start by creating a toc.xml to contribute the three tocs we created initially. Instead of providing an href for each topic, we use the link attribute to refer to our existing toc files.
<toc label="Online Help Sample" topic="html/book.html"> <topic label="Concepts"> <link toc="toc_Concepts.xml" /> </topic> <topic label="Tasks"> <link toc="toc_Tasks.xml" /> </topic> <topic label="Reference"> <link toc="toc_Ref.xml" /> </topic> </toc>
Then we update the plugin.xml to contribute our master toc:
<extension point="org.eclipse.help.toc"> <toc file="toc.xml" primary="true" /> </extension>
Note the use of the primary attribute. Setting this attribute
to true indicates that the toc should always appear in the navigation, even if
it is not referenced by any other toc. This way, our "master"
toc is always guaranteed to show up in the topics list. It appears at the
top level list of books since no other toc references it.
Note: If more files were associated with this toc but not present in the navigation, but just linked from other topics, then to have those topics available to the search engine we would have to use the extradir attribute in the toc.
Finally, we contribute our individual toc files.
<extension point="org.eclipse.help.toc"> <toc file="toc_Concepts.xml" /> <toc file="toc_Tasks.xml" /> <toc file="toc_Reference.xml" /> </extension>
These toc files will not appear in the top level list of books because we did not set the primary attribute. Toc files that are not designated as primary will only appear in the documentation web if they are referred to from some toc that is a primary toc or is linked in by a primary toc.
That's it. If you copy your plug-in directory to the platform's plugins directory, start the platform, and choose Help->Help Contents, you should see your example appear in the list of books. If you click on the "Online Help Sample", you'll see your toc structure: