The Eclipse template should automatically generate the contexts plugin information whenever it also generates the contexts.xml file. The plugin attribute should be generated only when the ContextPlugin marker is encountered. By default, it does neither.






Initial version.

Applies to WebWorks build 2010.2 (and others)


Eclipse uses contexts.xml to map context IDs (Help IDs) to target HTML files. This file is required whenever the project is using context-sensitive help. Eclipse also requires the help plugin.xml file identify and locate the contexts.xml file. Like this:

  <!-- Contexts -->
  <!--          -->
  <extension point="">
    <contexts file="contexts.xml"  />

The Eclipse Help format automatically generates the contexts.xml file whenever it encounters TopicID markers. (The markers contain the context ID information that associates the help topic to the ID.) However, them format does not also automatically generate the necessary plug-in information, so context-sensitive help does not work by default.

The Eclipse Help format does generate plug-in information when the format defines a ContextPlugin marker to generate the <contexts plugin=> attribute.

  <extension point="">
    <contexts file="contexts.xml" plugin="com.domain.class" />

However, that attribute is optional and implied by definition. Further, it is very problematic and hard to use. And it breaks if the developers change class names. And you cannot set it to an empty value or it will also break the help. (See for details about the attribute being implied and not required.)

Generating the required contexts.xml file

I rewrote eclipsehelp_plugin.xsl to always generate contexts.xsl when there are context-sensitive help topics, and to exclude the plugin attribute. This excerpt shows the changes:

<!-- Contexts entries -->
<!--                  -->
<xsl:for-each select="$VarTopics[1]">
 <xsl:variable name="VarContextPluginTopics" select="key('wwtopics-topics-by-type', 'context-plugin')" />

  <!-- CUSTOM:  Make this a choose structure instead, and always emit at least one context element. -->
  <xsl:if test="count($VarContextPluginTopics[1]) = 1">
   <xsl:comment xml:space="preserve"> Contexts </xsl:comment>
   <xsl:comment xml:space="preserve">          </xsl:comment>
     <xsl:when test="count($VarContextPluginTopics[1]) = 1">
           <!-- Original template code omitted for this example -->
       <!-- CUSTOM: New code -->
       <!-- There is no Context Plugin marker, just emit the contexts element (which is necessary for context-sensistive help. -->
       <xsl:variable name="VarContextsPath" select="wwuri:Unescape(wwuri:GetRelativeTo($VarContextFilesNode/@path, $VarPath))" />
       <epi:extension point="">
        <epi:contexts file="{$VarContextsPath}"  />
  <!-- CUSTOM:  End of change -->

DevCenter/Projects/Eclipse/Plugin contexts (last edited 2011-01-10 17:16:54 by MikeHedblom)