Child pages
  • Documenting the Plugin API

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Documenting

...

The API

Servoy supplies a Java Eclipse Documentation Generator plugin to help with documenting the plugin API.

...

All the relevant API information can be supplied by JavaDoc directly on the public methods and properties of the plugin.

The IScriptable Interface

The IScriptable interface is an empty interface that classes that expose methods or properties to the JavaScript layer in Servoy have to implement. When plugins get loaded in Servoy Developer, for all classes that implement this interface, the documentation will be loaded. For more information refer to the IScriptable API doc in the Servoy API.

...

The .getAllReturnedTypes() method of the deprecated IScriptObject is replaced by separate interface IReturnedTypesProvider, which only needs to be implemented on plugin classes that have actual returnTypes.

Documenting

...

Method &

...

Properties Using JavaDoc

When implementing the new documentation mechanism, the method sample code, tooltip, parameter names will have to be documented using JavaDoc. For more details on writing documentation in the Javadoc way, see the Javadoc reference pages. This type of code documentation is a standard way of documenting Java code.

...

The code above will create a JavaScript property called "'someProperty" ' of the plugin.

If a method is annotated with the @JSFunction property it will be considered a JavaScript function:

...

Please note that the method above does not have to start with the "'js_" ' prefix in order to be considered a JavaScript function of the plugin it belongs to.

...

Code Block
 /** @type {JSFile} */

The Documentation Generator Tool

After annotating the source of the plugin using JavaDoc, the documentation needs to be exported to XML format and bundled with the plugin. Servoy provides a Eclipse plugin to generate the XML, called the Documentation Generator.

In order to have the method documentation available, in JavaScript, you must the documentation generation tool installed, in the Eclipse in which you are developing the plugin code (along with its documentation). The documentation generation tool must be installed via Eclipse update sites. From the Servoy Developer, via Help->Install > Install New Software, add the http://www.servoy.com/documentbuilder url as an update site and install the documentation generator (Servoy Documentation Generator Feature). It will show up under installed software as the Servoy Documentation Generator Feature.

Note
titleNote

You might need to have "'Group items by category" ' unchecked in the install new software first wizard page.

After the tool is installed, you can generate the documentation of a plugin, by selecting the project/package corresponding to that plugin and using the context menu Servoy->Generate > Generate Servoy Documentation XML. An file with the plugin's documentation, available in XML format, will be generated.

In order to have this documentation available with the plugin, in the Servoy Developer, the plugin developer must include and bundle the documentation XML file along with the actual plugin, inside the plugin jar file. Then, once the plugin jar is copied to the Servoy installation's application_server/plugins directory, the documentation XML, corresponding to that plugin, will be automatically loaded and the documentation will be available.

The documentation generator tool also has a corresponding preference page, which will show up in Eclipse up under Windows->Preferences->Servoy > Preferences > Servoy Documentation Generator. There are currently two properties which can be set:

...