| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html> |
| <head> |
| |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| |
| <meta http-equiv="Content-Type" |
| content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" |
| type="text/css"> |
| <title>Dynamic topics</title> |
| <link rel="stylesheet" type="text/css" href="../book.css"> |
| </head> |
| <body style="background-color: rgb(255, 255, 255);"> |
| <h1>Dynamic topics</h1> |
| <p>In addition to static HTML files present in doc.zip or file system |
| under plug-in directory, help can display documents that are dynamically |
| generated by the documentation plug-in. Such plug-in needs to contain |
| Java code capable of producing contents that would otherwise be read |
| from static files by help system. If a class implementing |
| org.eclipse.help.IHelpContentProducer is contributed by a plug-in to |
| help system using org.eclipse.help.contentProducer extension point, the |
| help system will call getInputStream for every document accessed from |
| this plug-in. If that results in not null InputStream, it will be sent |
| to the browser for displaying. If IHelpContentProdcuer returns null, |
| help system will default to searching doc.zip and plug-in directory for |
| a document.</p> |
| <h4>Content producer example</h4> |
| <p>For example, an implementation of IHelpConentProducer as follows:</p> |
| <pre>package com.my.company.doc;<br>public class DynamicTopics implements <span |
| style="font-weight: bold;">IHelpContentProducer</span> {<br> public InputStream getInputStream(<br> String pluginID,<br> String name,<br> Locale locale) {<br> if (name.indexOf("dynamic") >= 0)<br> <span |
| style="font-weight: bold;">return</span> new ByteArray<span |
| style="font-weight: bold;">InputStream</span>(<br> ("<html><body>Content generated "<br> + new Date().toString()<br> + ".</body></html>")<br> .getBytes());<br> else<br> return <span |
| style="font-weight: bold;">null</span>;<br> }<br>}</pre> |
| <p>identified by extension in plugin.xml file as:<br> |
| </p> |
| <pre><extension point="org.eclipse.help.<span |
| style="font-weight: bold;">contentProducer</span>"<br> name="dynamicTopics"<br> id="my.company.doc.dynamicTopics"><br> <contentProducer <span |
| style="font-weight: bold;">producer</span>="com.my.company.doc.DynamicTopics" /><br></extension></pre> |
| <p><br> |
| will produce an HTML document content for all document references that |
| have a word "dynamic" as part of the path or file name.<br> |
| <br> |
| </p> |
| <h4>Constraints</h4> |
| <p>A plug-in has a complete freedom of the method of method or |
| underlying framework that is used to produce the content. It |
| should however ensure that content is generated in correct language and |
| encoded accordingly that a browser can display it. A locale used |
| by the user is provided to the getInputStream method. If it is |
| incapable of providing translatable content, it should default to |
| content for the default locale of the platform.</p> |
| |
| </body> |
| </html> |