Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Content extensions

A content extension is either a contribution of content into a known anchor (similar to an extension into an extension point), or the replacement of an existing element in a document.

Contributing into anchors

Anchor elements (e.g. <anchor id="my_anchor"/>) can be specified in any user assistance XML document, and represent places at which other components are allowed to extend this document. Specifying an anchor is as simple as adding the element in your markup.

To contribute content into an anchor, you must write the content to be added in a separate XML file and hook it into the platform using one of two extension points. For help or cheat sheet content, you must use the org.eclipse.help.contentExtension extension point. For welcome(intro) extensions, use org.eclipse.ui.intro.configExtension. The table of contents markup also allows the special constructs link and link_to which perform a similar function to includes and contributions, but perform the additional operation of merging extra documents to index for searching.

For example, let's say component A's documentation provides a listing of file formats it supports. If component B extends A's support to several more formats, you can place an anchor in A's list, and extend the list from B. For example:

   <p>The following list shows the supported formats:</p>
   <ul>
      <li>Portable Network Graphics (.png)</li>
      <li>Joint Photographic Experts Group (.jpeg)</li>
      <li>Graphical Interchange Format (.gif)</li>
      
      <!-- Extra formats go here -->
      <anchor id="image_format_list"/>
   </ul>

Then component B can make a contribution to the anchor to add more formats to the list by specifying the following extension:

   <extension point="org.eclipse.help.contentExtension"> 
      <contentExtension
            file="path/to/extension.xml"/>
   </extension>

Where the file path/to/extension.xml might contain:

   <contentExtension>
      <contribution
            content="docs/mydoc.xhtml#mycontent"
            path="/component_a_plugin/docs/doc_with_anchor.xhtml#anchorId">
      </contribution>
   </contentExtension>

The element with the id attribute mycontent in document docs/mydoc.xhtml would contain the content you wish to contribute into the anchor. The result will be that when the user views the document, the extra content will appear at the anchor as though it was explicitly added into the original document.

Replacing content

Any XML element in a user assistance document that has an id attribute that is unique to that document can be replaced with any other element.

As with contributions into anchors, to replace an element, you must write the new element to replace with in a separate XML file and hook it into the platform using one of two extension points. For help or cheat sheet content, you must use the org.eclipse.help.contentExtension extension point. For welcome (intro) extensions, use org.eclipse.ui.intro.configExtension.

The only difference with replacements as opposed to contributions into anchors is the name of the XML element used in the markup; use the replacement element instead of contribution (or replacementContent in the case of welcome). For example:

   <contentExtension>
      <replacement
            content="docs/mydoc.xml#myelement"
            path="/plugin.id/path/doc.xml#elementId">
      </replacement>
   </contentExtension>

(Note the markup is different for welcome, as specified in the org.eclipse.ui.intro.configExtension extension point)

Path format

The format of the path attribute is /pluginId/path/file.xml#elementId, except welcome where it is pageId/path/to/elementId where the pageId is the welcome page id, and all other path segments are ids of container elements like groups, leading to the target element.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire