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.

Version

Date

Changes

1.0

2011-01-10

Initial version.

Applies to WebWorks build 2010.2 (and others)

Description

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="org.eclipse.help.contexts">
    <contexts file="contexts.xml"  />
  </extension>
</plugin>

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="org.eclipse.help.contexts">
    <contexts file="contexts.xml" plugin="com.domain.class" />
  </extension>

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 http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_help_contexts.html 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:choose>
     <xsl:when test="count($VarContextPluginTopics[1]) = 1">
     
           <!-- Original template code omitted for this example -->
        
     </xsl:when>
     <xsl:otherwise>
       <!-- 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="org.eclipse.help.contexts">
        <epi:contexts file="{$VarContextsPath}"  />
       </epi:extension>
     </xsl:otherwise>
   </xsl:choose>
  <!-- CUSTOM:  End of change -->
  <!--
  </xsl:if>
   -->

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