Providing help for your plug-in (How to extend Rodin Tutorial)

From Event-B
Jump to: navigation, search

Creating the Help Plug-in

Each plug-in that contributes help files shall extend the org.eclipse.help.toc extension point and create the TOC files that describe the table of contents for the help and the topic interleaving.

Let's first create such a plug-in. It will only contain documentation files, and the "Create Java Project" option (tag 1) do not need to be checked.

Error creating thumbnail: Unable to save thumbnail to destination

Then, the easiest way to proceed for beginners is to start from the available template:

Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination

Examining the Help Files

Error creating thumbnail: Unable to save thumbnail to destination

Three .xml files have been created:

  1. plugin.xml
  2. testToc.xml
  3. toc.xml

When opening the plugin.xml file, we can see that the testToc.xml file is a primary file, i.e. it contains the master table of contents; toc.xml is not primary, but is integrated into this table of contents.

Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination

The contents is provided as .html files and linked from the tables of contents.

Viewing the Help Contents

Launch the Rodin platform and select Help > Help Contents to view the available Eclipse Help contents. We can see that a new Test TOC item has been created.

Error creating thumbnail: Unable to save thumbnail to destination

Writing the Help Contents

  • The first option is to edit the .html files (html/maintopic.html, html/subtopic.html and html/toc.html in our example).
  • The second option is to generate the help files from a Wiki page, for example this page.

To build the Eclipse Help contents from a MediaWiki source, you first need to have the org.eventb.doc.user plug-in, open and up-to-date, in your current workspace. The tools/wiki2help/build_eclipse_help.xml file enclosed in this plug-in is the Ant script to be used to generate the help files. More precisely:

  1. Create our own Ant file, for example build_eclipse_help.xml, in the help plug-in.
This file shall set the dest.dir property, which specifies where the help files will be generated, and the wiki.url property, which gives the URL of the Wiki page to be taken as input. Moreover, it shall target the main build_eclipse_help.xml file.
<?xml version="1.0" encoding="utf-8" ?>
<project name="sample-help" default="sample-help.generate">
    <target name="sample-help.generate">
       <ant dir="../org.eventb.doc.user/tools/wiki2help/"
       	 antfile="build_eclipse_help.xml" target="generate"
       	 inheritAll="false">
          <property name="dest.dir" value="${ant.file.sample-help}/../html"/>
          <property name="wiki.url" value="http://wiki.event-b.org/index.php/Providing_help_for_your_plug-in_(How_to_extend_Rodin_Tutorial)"/>
    	</ant>
   </target>
</project>
  1. Right-click on this newly created Ant file and select Run as > Ant Build. The help files are generated in the html dedicated folder.
  2. Modify the plugin.xml file to reference the html/providing_help_for_your_plug_in_how_to_extend_rodin_tutorial.xml file as primary file.
  3. Display the Eclipse Help contents. The generated files are now available:
Error creating thumbnail: Unable to save thumbnail to destination