Skip to main content

Java API reference documentation

Part 3: Eclipse Javadoc API reference structure generated running the JavaTOC doclet and ANT

Mariana Alupului (malupulu@us.ibm.com), Information Developer, Rational software, IBM
Mariana Alupului
Mariana Alupului is a senior technical writer (API) for IBM Software Group, Rational Software. In addition to documenting and leading API documentation projects for Java, VB, C++ in software programming environment, she is a member of the IBM Corporation team that develops the Darwin Information Typing Architecture (DITA) XML specialization for writing language-conformant reference documentation for API libraries. Mariana helps to create the API reference style guidelines and is a member of the corporate ID-Support Council and ID Technical Writers Council. She is a member of the Society for Technical Communication and has presented at the "Beyond the Bleeding Edge" session in 2005.

Summary:  This article further discusses the JavaTOC doclet, how to use it, and how to extend it. The approaches described are the Javadoc standard solution and the Eclipse Plug-in Help System generated using the tool. I will run the JavaTOC doclet in Eclipse through the Custom doclet wizard, and second through Ant build system. The JavaTOC tool generates the TOC XML navigation for Java API reference documentation.

Date:  15 Jan 2008
Level:  Intermediate
Activity:  1062 views
Comments:  

Quick Review

In Part 1 of this series, How Java API reference documentation is organized in Eclipse Help the article introduces different approaches for generating easy-to-use and searchable Java application programming interfaces (API) reference documentation. The approaches described in the article are the Javadoc standard solution and the Eclipse Plug-in Help System generated using the JavaTOC doclet that I developed.

In Part 2 of this series, Eclipse Javadoc API reference structure generated using the JavaTOC doclet the article presents the JavaTOC doclet (inclusive download) and how to use it using Command Prompt. It shows how JavaTOC doclet generates the XML TOC navigation and the improved search capability for the Javadoc API reference documentation.

Learn how to ask for help from the developer, no matter how good your technical skills are. There are topics that the developer concluded were worthy of additional consideration and explanation, topics that were not required and were not being used by the user.

Generate Eclipse plug-in (Javadoc API reference documentation) using JavaTOC doclet

The Eclipse platform Help system allows you to contribute your plug-ins to the online Help using the org.eclipse.help.contributions extension point. You can either contribute the online Help as part of your code plug-in or provide it separately in its own documentation plug-in. Having your own documentation plug-in provides the benefit of working on a copy of the source code and the references generation process being separate from the development process. It might be beneficial to consider this approach in those situations where the development and the documentation team are different groups, or where you want to reduce the dependency between the documentation source and the source code.

The org.eclipse.help.contributions extension point provides four elements through which you can contribute your help: topics infoset (book) infoview actions (wiring). The infoset and actions contributions specify an associated .xml file that contains the details of the contribution.

Design Constraints

Whether you're a skilled technical writer or a developer, you want to provide users with fully documented, easy to search and browse Java API references.

You can run the JavaTOC doclet to generate the TOC XML navigation files and the Javadoc, or run the tool to generate the TOC XML navigation files and use the Javadoc generated by developer. The article presents the solution using the standard Javadoc Generation wizard to create Javadoc for Java API reference documentation and the JavaTOC doclet for the TOC XML navigation files in an Eclipse development environment.

This article presents how to run the JavaTOC doclet in Eclipse through the Custom doclet wizard, and second through the Ant build system. If you haven't worked with Ant, check out the Jakarta website, or "Open Source Java: Ant".

Workflow

Add the JavaTOC plug-in build tools (JavaAPITools) into your workspace:

  • Find the workspace directory used by your version of Eclipse. Typically this is located inside the directory in which Eclipse was installed in a subdirectory called "workspace". If you are using a shortcut or script to launch Eclipse, then it will be under the current working directory of that shortcut or script in a subdirectory called "workspace".
  • Download and unzip the package (JavaAPITools) into your workspace. This will create a "JavaAPITools" project.
  • Import the "JavaAPITools" project and the Java project you want to work with into your Eclipse workspace.

Use the Import Wizard to import an existing Java project into workspace. For this example, I created a new Java project "org.dita.dost" and added to the source code (src folder) from the DITA Open Toolkit source code, which transforms DITA content (maps and topics) into deliverable formats. You can download this plug-in from the Download resources.

Creating Javadoc documentation using the Eclipse Javadoc Generation wizard (Standard Doclet)

The following steps show how to generate Javadoc in an Eclipse development environment using the Standard Javadoc Doclet:

  • In Eclipse, on the left pane, select the source code plug-in for which Javadoc needs to be generated.
  • Right-click on the selected plug-in, and from the drop down list select Export. The Export window opens.
  • Select Javadoc and click Next. The Generate Javadoc window opens.
  • In the Generate Javadoc window select the packages that you want to export to the JAR file. This list is initialized by the workbench selection. Only one project can be selected at once as only one project classpath can be used at a time when running the Javadoc tool. (Figure 1)
  • Select members visibility (normally Package and Public).
  • Select Use Standard Doclet to start the Javadoc command with the standard doclet (default).
    • Destination: select the destination to which the standard doclet will write the generated documentation. The destination is a doclet specific argument, and therefore not enabled when using a custom doclet.
      The destination to which the standard doclet will write can be for example "doc.dita.dost.doc\topics" (Figure 2)

Figure 1. Javadoc Generation Wizard (Standard Doclet)
Javadoc Generation Wizard

Figure 2. Destination
Destination screen capture

Table of supported options provided by Javadoc Generation wizard:
Option Description
Document title Specify a document title.
Generate use page Selected this option if you want the documentation to contain a Use page.
Generate hierarchy tree Selected this option if you want the documentation to contain a Tree page.
Generate navigator bar Selected this option if you want the documentation to contain a navigation bar (header and footer).
Generate index Selected this option if you want the documentation to contain a Index page
Generate index per letter Create an index per letter. Enabled when Generate Index is selected.
@author Selected this option if you want to the @author tag to be documented.
@version Selected this option if you want to the @version tag to be documented.
@deprecated Selected this option if you want to the @deprecated tag to be documented. reference to a table of contents, such as
deprecated list Selected this option if you want the documentation to contain a Deprecated page. Enabled when the @deprecated option is selected.
Select referenced classes to which Javadoc should create links Specify to which other documentation Javadoc should create links when other types are referenced.
  • Select All: Create links to all other documentation locations
  • Clear All: Do not create links to other documentation locations
  • Configure: Configure the Javadoc location of a referenced JAR or project
Style sheet Select the style sheet to use
  • Click Finish to generate Javadoc, or click Next to specify additional Javadoc generation options.

NOTE: For more informations see Javadoc generation — Eclipse Help Platform

Destination directory for output files

  • The doclet generates the output HTML files for the plug-in documentation to "org.dita.dost\org.dita.dost.doc\topics\", which is now your plug-in documentation directory.

Creating TOC XML navigation and Javadoc plug-in files using the Eclipse Javadoc Generation wizard and JavaTOC doclet (Custom Doclet)

The following steps show how to use the customized doclet, the JavaTOC doclet, in combination with Javadoc in an Eclipse development environment:

  • In Eclipse, on the left pane, select the source code plug-in for which Javadoc needs to be generated.
  • Right-click on the selected plug-in, and from the drop down list select Export. The Export window opens.
  • Select Javadoc and click Next. The Generate Javadoc window opens.
  • In the Generate Javadoc window select the packages that you want to export to the JAR file. This list is initialized by the workbench selection. Only one project can be selected at once as only one project classpath can be used at a time when running the Javadoc tool.
  • Select member's visibility (normally Package and Public).
  • Select Use Custom Doclet and add the Qualified type name of the doclet to the Doclet name: com.ibm.malup.doclet.config.DITADoclet , and the Classpath needed by the doclet class to the Doclet class path: <eclipse_workspace>\JavaAPITools\bin\JavaTOC.jar
    NOTE: <eclipse_workspace> is the absolute path for the Eclipse Workspace (C:\eclipse\workspace).
    • Destination: select the destination to which the standard doclet will write the generated documentation. The destination is a doclet specific argument, and therefore not enabled when using a custom doclet.
      The destination to which the standard doclet will write can be for example "doc.dita.dost.doc\topics"
  • Click Next.

Figure 3. Javadoc Generation Wizard (Custom Doclet)
Javadoc Generation Wizard (Custom Doclet)

Figure 4. Destination
Destination screen capture

Extra Javadoc options

  • For the Extra Javadoc options (path names with white spaces must be enclosed in quotes); add the content from the Listing 1. (for our example org.dita.dost plugin).
    1. -d <destination_directory> Specifies the destination directory for the generated documentation. By default, this is the current directory (the one designated by "." pathname).
    2. -pluginid <plugin_id> Include id for the Eclipse plugin id page.
    3. -doctitle <html_code> Include title for the Eclipse plug-in name page.
    4. —overview <file> Specify the plugin version id details.
    5. —version <plugin_version> Specify the plugin version id details.
    6. -provider <plugin_provider> Specify the plugin provider name details.
    7. -anchor <file> Linking is specified by using the fully qualified reference to a table of contents, such as: "../the_other_plugin_id/path/to/toc.xml#anchor_id"
    8. -notree If you are going to generate documentation for a big project, specify to create multiple XML TOC files.

Listing 1. Extra Javadoc options
                
-d C:\eclipse\workspace\org.dita.dost\org.dita.dost.doc\
-pluginid org.dita.dost.doc
-doctitle 'Building DITA output' 
-version '7.0.0.1' 
-provider 'IBM' -subsystemtoc
      

Destination directory for output files

  • The doclet generates the output TOC XML files for the plug-in, and other several useful files in the org.dita.dost\org.dita.dost.doc\ folder, which is now your plug-in directory. The files created by the JavaTOC doclet are:
    • plugin.xml
    • plugin.properties
    • build.properties
    • .project
    • META-INF\MANIFEST.MF
    • primary.plugin.toc.xml
    • org.dita.dost.xxx.toc.xml— TOC XML file for building the navigation tree in the help browser
  • The plug-in's name, id, version, and provider-name values are auto-generated from the -d, -doctitle, —version and —provider properties.
  • The plug-in manifest files externalize their strings by replacing the string with a key (e.g. %pluginName) and creating an entry in the plugin.properties file of the form: Plugin.name = Online Help Sample Plugin

Using the JavaAPITools (build.xml & JavaTOC doclet) and ANT to create your documentation plug-in

The main purpose of the JavaAPITools is to create a NEW DOCUMENTATION plug-in with Javadoc for the public API reference documentation and all Eclipse plug-in files necessary to integrate this Java API reference documentation with the Eclipse Help system, inclusive the TOC XML navigation files for Javadoc.

Installing the plug-in build tools (buildAPITools)

The JavaAPITools package, provides an Eclipse build script for creating Eclipse documentation plugins. The script lets you transform Java project plug-ins within Eclipse and use the Eclipse target runtime for testing them. The generation of the Javadoc is accomplished by creating an ANT script in your plug-in called build.xml. This ANT script requires the JavaAPITools build.xml build tools which must be located somewhere on your development system (workspace). Also, the script must be able to determine how the resulting xxx.doc plug-in is to be packaged for deployment.

  • Download the package, create a 'JavaAPITools' project in your workspace, and unzip the package into the project.
  • Import the plugins you want to work with into your Eclipse workspace. For this example I created a new Java project and I added to the src folder the source directory from the DITA Open Toolkit source code which transforms DITA content (maps and topics) into deliverable formats. You can download this plugin from the Download resources, or you can run on your project example.

Determine the plug-in deployment packaging

Before Eclipse 3.2, the generated Javadoc would be kept in a doc.zip file along with the HTML files. Since 3.2, the entire documentation plug-in can be shipped as a single .jar file that includes all of the files that would go into the doc.zip file along with the Eclipse plug-in files: manifest.mf, plugin.xml, plugin.properties, etc.

Since Eclipse 3.1, plug-ins can be deployed either as a directory containing separate files (including one or more jar files), or a plug-in can be deployed as a single jar file.


Listing 2. build.properties
                
bin.includes = META-INF/,\
               .project,\
               plugin.xml,\
               toc.xml,\
               plugin.properties,\
               doc.zip,\
               bin/
      

Comment: If the original plug-in is to be deployed as a directory, the build.properties file should include the doc.zip file. If the plug-in is to be deployed as a single .jar, the build.properties should NOT contain doc.zip but should contain the droot directories and files that would have been created within a doc.zip file.

In addition, the .doc-feature plug-in that includes such a doc plug-in must also contain the unpack="false" attribute in the feature.xml file for the plug-in.

Create, manage, and run the ANT build file

  • Right click build.xmll from builAPITools and select Run As > External Tools, and in the Builders section, select New Lunch Configuration .. and create a new Ant Build configuration.
  • In the resulting configuration dialog, set the name to something unique (e.g., Build Plugin Documentation). In the launch configuration Main tab, browse the workspace and select the build.xml file from the JavaAPITools). Add to the Base directory the value: ${project_loc}.

The following diagram, Figure 5, shows the Main tab of the ANT launch configuration dialog.


Figure 5. Setup to run ANT build file
Setup to run ANT build file
  • Arguments:
    • The —verbose argument allows you to track the information about a specific command that isn't working. The —quiet argument suppresses most messages not originated by an echo task in the buildfile, and -debug, prints debugging information in Eclipse Console.
    • The —Dbuild.toc.tree=true argument overrides —build.toc.tree property and assigns the value to true before the build script is executed. This will create only one primary TOC XML file (xxx.toc.xml) in place of multiple file.

Creating build.xml ANT file

The build.xml script defines all of the information needed to generate the Javadoc for the associated component plug-ins and either creates the doc.zip file or copies the generated files into the root of the plugin. For complete documentation on the tasks that can be used in this file, see JavaAPITools/build.xml.
The initial contents of this file should be:


Listing 3. build.xml
                
<?xml version="1.0" encoding="UTF-8"?>

<!-- **************************************************************  -->
<!-- ANT build file for Eclipse toc files and documentations plugins -->
<!-- Mariana Alupului 10/08/2006                                     -->
<!-- **************************************************************  -->

<project name="build" default="main">
	<echo message="${ant.project.name}: ${ant.file}"/>
	
	
<!-- **************************************************************************** The main build target. **************************************************************************** --> <target name="main" depends="setup, useManifestMF, usePluginXML, badPlugin, runJavaDoc, runJavaTOCDoclet, deployPlugin, copyPlugin, cleanProject" description="Build Plug-in Documentation"> <echo message="${ant.project.name}: ${ant.file}"/> </target>
Comment: The "main" target executes the targets in the depends attribute in the order they appear (from left to right). Keep in mind that it is possible that a target can get executed earlier when an earlier target depends on it: (setup, useManifestMF, usePluginXML, badplugin, runJavaDoc, runJavaTOCDoclet, generateZip, copyPlugin, cleanProject).

<target name="init" description="Project variables"> <property name="ECLIPSE_HOME" value="../../"/> <property name="build.plugin" value="jar"/> <property name="project.dir" value="${basedir}" /> <property name="build.toc.tree" value="false" /> </target> <target name="setup" depends="init" description="Setup the Project"> <tstamp> <format property="now" pattern="d MMMM yyyy HH:mm:ss aa" /> </tstamp> <echo>=== Starting Building Plugin Documentation ===</echo> <echo>=== ${now} ===</echo> </target> Comment:
Ant buildfile provides access to all system properties as if they had been defined using a <property> task.

<target name="validatePlugin" description="Select plugin.xml or manifest.mf"> <condition property="plugin.xml.exists"> <available file="${project.dir}\plugin.xml" /> </condition> <condition property="manifest.mf.exists"> <available file="${project.dir}\META-INF/MANIFEST.MF" /> </condition> <condition property="invalid.plugin"> <and> <not> <isset property="plugin.xml.exists" /> </not> <not> <isset property="manifest.mf.exists" /> </not> </and> </condition> </target> <target name="useManifestMF" depends="validatePlugin" if="manifest.mf.exists" description="Get plugin name from MANIFEST.MF "> <loadproperties srcFile="${project.dir}\META-INF/MANIFEST.MF"> <filterchain> <linecontains> <contains value="singleton" /> </linecontains> <replacestring from=";" to=".doc" /> <replacestring from=" " to="" /> <replacestring from="singleton:=true" to="" /> </filterchain> </loadproperties> <property name="plugin.name" value="${Bundle-SymbolicName}" /> <loadproperties srcFile="${project.dir}\META-INF/MANIFEST.MF"/> <property name="bundle.name" value="${Bundle-Name}" /> <property name="version.name" value="${Bundle-Version}" /> <property name="vendor.name" value="${Bundle-Vendor}" /> </target> <target name="usePluginXML" depends="validatePlugin" if="plugin.xml.exists" unless="manifest.mf.exists" description="Get plugin name from plugin.xml if MANIFEST.MF does not exist "> <xmlproperty file="${project.dir}\plugin.xml" /> <property name="plugin.name" value="${plugin(id)}.doc" /> <property name="bundle.name" value="${plugin(bundle-name)}" /> <property name="version.name" value="${plugin(bundle-version)}" /> <property name="vendor.name" value="${plugin(bundle-vendor)}" /> </target> <target name="badPlugin" depends="validatePlugin" if="invalid.plugin" description="Processing ends if plugin is invalid "> <fail message="ERROR::Plugin ${project.dir} is invalid. No plugin.xml was found." /> </target> Comment: The Ant buildfile provides access to the MANIFEST.MF file or/and to the plugin.xml file, and uses the existing plug-in name, id, version name and vendor name from the existing Java plugin.
An Error appears in your console if no plugin.xml or MANIFEST.MF was found.

<target name="runJavaDoc" depends="validatePlugin" unless="invalid.plugin" description="Generate JavaDoc API documentations"> <mkdir dir="${plugin.name}" /> <mkdir dir="${plugin.name}/META-INF" /> <echo>SUCCESS: Create directory ${basedir}\${plugin.name}</echo> <javadoc access="public" author="true" destdir="${plugin.name}\topics" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="*" source="1.4" sourcepath="src" splitindex="true" use="true" version="true"/> </target> Comment: See Table of supported options provided by Javadoc Generation wizard if you want to add more options to run the standard Javadoc.

Example: To add the Author name (@author ) to the documentation, add author="true" .

<target name="runJavaTOCDoclet" unless="invalid.plugin" description="Generate Eclipse XML TOC files"> <property name="buildAPITools" value="../JavaAPITools/bin/JavaTOC.jar" /> <echo>End Phase I Standard Doclet - Start Phase II JavaTocDoclet...</echo> <!-- <loadproperties srcFile="${project.dir}\plugin.properties"/> <property name="plugin.link" value="${Plugin.link_to}" /> --> <javadoc access="public" classpath="." sourcepath="src" notree="${build.toc.tree}" packagenames="*" > <doclet name="com.ibm.malup.doclet.config.TOCDoclet" path="${buildAPITools}"> <param name="-d" value="${basedir}\${plugin.name}"/> <param name="-plugintitle" value="API Reference (${bundle.name})"/> <param name="-pluginid" value="${plugin.name}"/> <param name="-version" value="${version.name}"/> <param name="-provider" value="${vendor.name}"/> <!-- <param name="-anchor" value="${plugin.link}"/> --> </doclet> </javadoc> </target> Comment: See Listing 1. Extra Javadoc options if you want to add more options to run the JavaTOC doclet tool.

Example: —overview <file> <param name="-overview" value="${basedir}\${plugin.name}\overview.html"/>

Example: —anchor <file> <param name="-anchor" value="../the_other_plugin_id/path/to/toc.xml#anchor_id"/> <target name="deployPlugin" description="If plug-in is packaged as a directory (unpacked)"> <loadfile srcFile="${basedir}/build.properties" property="build_properties" /> <condition property="deployPlugin" > <contains string="${build_properties}" substring="doc.zip"/> </condition> <antcall target="createDocZip" /> </target> <target name="createDocZip" if="deployPlugin" description="The plug-in is packaged as a directory"> <echo>== The .doc plug-in is to be deployed as a directory ==</echo> <zip destfile="${project.dir}\${plugin.name}/doc.zip" basedir="${plugin.name}"> <include name="topics/**" /> <include name="images/**" /> <include name="pdf/**" /> <include name="*.css" /> </zip> <delete dir="${project.dir}\${plugin.name}/topics" /> </target> Comment: The Ant buildfile provides access to the build.properties file (if the plugin is to be deployed as a directory, or as a jar file) and creates the doc.zip file.

<target name="copyPlugin" description="Copy the project to workspace"> <copy includeemptydirs="true" todir="${ECLIPSE_HOME}/workspace/${plugin.name}"> <fileset dir="${plugin.name}" excludes="**/*.launch, **/buildJavaDoc.bat"/> </copy> </target> <target name="cleanProject" description="Cleans the project"> <delete dir="${project.dir}\${plugin.name}" /> <delete dir="../buildAPITools/${plugin.name}" /> <echo>=== End Building ${plugin.name} Plug-in Documentation ===</echo> <echo>=== ${now} ===</echo> </target> Comment: Copy the project to your workspace.

</project>

Auto-building the plug-in

  • Highlight your plug-in project.
  • Click Run > External Tools > External Tools > Build Plugin Documentation.
    • The build runs, with running commentary and errors appearing in the Console view.
    • If you get a 'BUILD FAILED' error in your console, check and fix any problems that occur and build again, until you get a 'BUILD SUCCESSFUL' at the bottom of the console message.
    • After a successful build (in your development environment) of the doc plugin (no more ANT errors) there should be a \topics folder for the HTML files, and there should be a doc.zip file in the root directory and the plugin manifest file.
    • The build properties will include all of the toc*.xml files, plugin.properties, META-INF, and .project files. If a doc.zip file was created, the build.properties file will also include the doc.zip (do not modify). If the plug-in is to be deployed as a single jar file, the build.properties file must also include the top level directories that were created (topics), and not the doc.zip file.

Destination directory for output files (org.dita.dost.doc)

  • For our example (org.dita.dost.doc plug-in), the ANT buildfile generates the output XML files for the plug-in, and several other useful files to workspace\org.dita.dost.doc directory, which is now your plugin directory.
  • Modifying the value for the build.toc.tree from false to true. The ANT buildfile generates the output in two ways:

    <property name="build.toc.tree" value="false" /><property name="build.toc.tree" value="true" />
    • .project
    • plugin.xml
    • plugin.properties
    • META-INF\MANIFEST.MF
    • topics\ — All HTML files.
    • doc.zip
    • primary.plugin.toc.xml
      org.dita.dost.index.toc.xml,
      org.dita.dost.invoker.toc.xml,
      org.dita.dost.log.toc.xml,
      org.dita.dost.module.toc.xml,
      org.dita.dost.pipeline.toc.xml,
      org.dita.dost.platform.toc.xml,
      org.dita.dost.reader.toc.xml,
      org.dita.dost.util.toc.xml,
      org.dita.dost.writer.toc.xml — TOC XML files for building the navigation tree in the help browser
    • buildJavaDoc.bat — BAT file for running JavaDoc tool.
    • .project
    • plugin.xml
    • plugin.properties
    • META-INF\MANIFEST.MF
    • topics\ — All HTML files.
    • doc.zip
    • org.dita.dost.doc.toc.xml — Primary TOC XML file for building the navigation tree in the help browser.
    • buildJavaDoc.bat — BAT file for running JavaDoc tool.


  • You can modify the ANT build files to add more futures:
    • On the Java project plugin.properties add Plugin.notree = false

                                          
      Plugin.name = DITA Dost 
      Plugin.providerName = I.B.M.
      Plugin.link_to = ../com.ibm.xde.mda.doc/primary.plugin.toc.xml#api
      Plugin.anchor_id = api
      Plugin.notree = false
            

    • On the build.xml add



                                          
      <loadproperties srcFile="${project.dir}\plugin.properties"/>
               		<property name="plugin.link" value="${Plugin.link_to}" />
            

Importing the plug-in into your workspace

You can use the Import Wizard to import the documentation plug-in into your workspace.

  • From the main menu bar, select File > Import.... The Import wizard window opens.
  • Select General > Existing Project into Workspace and click Next.
  • Select the root directory and click Browse to locate the Workspace directory
  • Under Projects select the org.dita.dost.doc project to import.
  • Click Finish to start the import.

Figure 6. Importing the plug-in into Workspace1
Importing the plug-in into Workspace1

Figure 7. Importing the plug-in into Workspace 2
Importing the plug-in into Workspace 2

Figure 8. Importing the plug-in into Workspace 3
Importing the plug-in into Workspace 3

Testing the Java API reference plug-in

  • Set up the target runtime environment:
    • Select Window > Preferences > Plug-in Development > Target Platform
    • Set Location to be the main eclipse directory within your externally-installed product. A list of plugins in the Eclipse directory appears (this step takes a while).
    • Click OK to save the Target Platform settings.
  • From the Plugin Development perspective, create a Run configuration by selecting Run > Run . This will launch the Run configuration page.
    • Click Eclipse Application configuration then the New button, and name it anything to identify it as the testing JavaTOCdoclet Eclipse Plugin. We'll call it Test Plugin Doc.
    • On the Main tab, under the location field, select a workspace directory. Things that you do while using the target runtime will be written to that workspace, including the .log file in the .metadata folder
    • Under Program to Run, select Run a product and choose org.eclipse.platform.ide
    • On the Plug-ins tab, select Choose plug-ins and fragments to launch from the list
    • Under Workspace Plug-ins, select the plugins that you want to test. This option allows you to test your local plugins, even if the plugin is new and not installed with the target runtime.
    • Leave the External Plug-ins list as it is.
    • Select the Add new workspace plug-ins to this launch configuration automatically check box.
    • Click Apply to save the changes.
    • Switch to the Plug-in Development perspective and click Run > Run .
      • Select the Run configuration that you created (Test Plugin Doc) and click Run. The target runtime will launch. This means that your external product will start, but will have a copy of your local plugins instead of the version that is in the product.
      • NOTE: Once you run your plugin once, the Run configuration (Test Plugin Doc) will appear in the Run History, so you can launch the target runtime with Run > Run History > Test Plugin Doc, or you can use the toolbar icon .Run
      • Run Build Plugin Docs
      • The defaults will launch every plug-in in the target platform plus all open plug-in projects in your workspace. This and the other defaults are sufficient.

Viewing your Java API reference documentation

From the new Eclipse Test Platform, select Help > Help Contents. You will get a help window, Figure 9, with your plug-in added (similar to the one in Figure 2).


Figure 9. Help — Eclipse SDK
diagram

Packaging the plug-in

Once you have done this, all you need to do is package everything in the structure using the Workbench User Guide, Export wizard. This wizard helps you to export resources from the Eclipse workbench.


Notices

  • The information provided in this document are my observations and techniques as a technical writer, and has not been submitted to any formal IBM test and is distributed "AS IS," without warranty of any kind, either express or implied.
  • The JavaTOC doclet tool is a published invention, author Mariana Alupului. The invention is part of the IBM Intellectual Property and it is published on www.ip.com.
  • The use of this information or the implementation of any of these techniques described in this document is the reader's responsibility and depends on the reader's ability to evaluate and integrate them into their operating environment.

Conclusion

The source doc comments for the Java API specification is owned by programmers, and they are edited by both programmers and technical writers.

The JavaTOC Doclet presented in this paper can be used to produce help documentation based on HTML and a small number of additional documentation elements. Using this doclet, it is easy to create Eclipse platform documentation, which can then be used to produce XML and HTML output formats for existing Eclipse help systems.

I have shown you how to develop Eclipse platform documentation using JavaTOC doclet, and not how to document the source code. The generated documentation should be professional quality so you need to do your most important job; to fully document the developer source code for fully documented Java API references. This free open source solution can simplify your documentation development process, allowing you to work just with a doclet and have the plug-in structure, the TOC navigation and HTML files generated for you.

In the upcoming articles of developerWorks XML zone series, I will describe a process for automatically generating searchable Java API documentation (TOC navigation) using the DITAdoclet tool for the Eclipse Plug-in Help System. The How Java API Documentation is organized in DITA API specialization will provide the DITAdoclet tool for download and explain how to use it to generate the Java DITA API files and the XHTML output from the Java source code. We will also look more in-depth at the Java API reference documentation technology, and some of the value-added enhancements from IBM such as Java DITA API specialization, and how it can be utilized.



Downloads

DescriptionNameSizeDownload method
JavaTOC docletJavaAPITools.zip261KB HTTP
JavaTOC exampleorg.dita.dost.zip323KB HTTP

Information about download methods


Resources

Learn

  • Lean more about Sun Microsystems Javadoc tool.
    • See the Javadoc home page for more information about Sun Microsystems Javadoc tool.
    • Explore Doclet.com, a repository of Doclet extensions for the Javadoc tool.
    • The Sun tutorial "How to Write Doc Comments for the Javadoc Tool" describes the rules and philosophy of Javadoc.
    • The Javadoc doclet API lets you write custom Javadoc plug-ins to produce different forms of documentation, HTML, XML or DITA from Javadoc comments.

  • Find more XML resources on the developerWorks XML zone. The developerWorks XML zone contains literally hundreds of articles, tutorials, and tips to help a developer make the most of XML-related applications, but for users trying to find their way in a new topic, all of that information can be overwhelming.
  • Find more resources on the Eclipse Platform . Eclipse is an open source community whose projects are focused on providing an extensible development platform and application frameworks for building software.
    • See Javadoc generation wizard allows you to generate Javadoc Generation. It is a user interface for the javadoc.exe tool available in the Java JDK.

  • The DITA Open Toolkit is an implementation of the OASIS DITA Technical Committee's specification for Darwin Information Typing Architecture (DITA) DTDs and Schemas. The Toolkit transforms DITA content (maps and topics) into deliverable formats.

Get products and technologies

  • The DITA API Specialization (javaapiref0.8.zip ) can be used or examined as an example of how to extend the generic API Reference specialization

Discuss

About the author

Mariana Alupului

Mariana Alupului is a senior technical writer (API) for IBM Software Group, Rational Software. In addition to documenting and leading API documentation projects for Java, VB, C++ in software programming environment, she is a member of the IBM Corporation team that develops the Darwin Information Typing Architecture (DITA) XML specialization for writing language-conformant reference documentation for API libraries. Mariana helps to create the API reference style guidelines and is a member of the corporate ID-Support Council and ID Technical Writers Council. She is a member of the Society for Technical Communication and has presented at the "Beyond the Bleeding Edge" session in 2005.

Comments



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, Open source
ArticleID=281413
ArticleTitle=Java API reference documentation
publish-date=01152008
author1-email=malupulu@us.ibm.com
author1-email-cc=clarkega@us.ibm.com

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers