blob: f73debfd910ee5b765b1a6c0cc1982b7b27bc3e6 [file]
<!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") &gt;= 0)<br> <span
style="font-weight: bold;">return</span> new ByteArray<span
style="font-weight: bold;">InputStream</span>(<br> ("&lt;html&gt;&lt;body&gt;Content generated "<br> + new Date().toString()<br> + ".&lt;/body&gt;&lt;/html&gt;")<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>&lt;extension point="org.eclipse.help.<span
style="font-weight: bold;">contentProducer</span>"<br>&nbsp;&nbsp;&nbsp; name="dynamicTopics"<br>&nbsp;&nbsp;&nbsp; id="my.company.doc.dynamicTopics"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;contentProducer <span
style="font-weight: bold;">producer</span>="com.my.company.doc.DynamicTopics" /&gt;<br>&lt;/extension&gt;</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.&nbsp; It
should however ensure that content is generated in correct language and
encoded accordingly that a browser can display it.&nbsp; A locale used
by the user is provided to the getInputStream method.&nbsp; If it is
incapable of providing translatable content, it should default to
content for the default locale of the platform.</p>
</body>
</html>