On the <oXygen/> website there is a plugin development kit with some sample plugins (source code and compiled code) and the Javadoc API necessary for developing custom plugins. On the Plugins page there is a developer manual with instructions for developing custom plugins.
The minimal implementation of a plugin must provide two classes: one that extends the Plugin class and another that implements the plugin extension and a plugin descriptor file. There are four available extensions SelectionPluginExtension
, DocumentPluginExtension
, GeneralPluginExtension
and URLStreamHandlerPluginExtension
.
A PluginDescriptor
object is passed to the plugin class on constructor containing information about the plugin
basedir
- File - the base directory of the plugin.
description
- String - the description of the plugin.
name
- String - the name of the plugin.
vendor
- String - the vendor name of the plugin.
version
- String - the plugin version.
The PluginDescriptor
fields are filled with information from the plugin descriptor file.
The plugin descriptor defines how the plugin will be integrated in <oXygen/> and what libraries should be loaded. The structure of the plugin descriptor file is given below:
<!-- the document root --> <!ELEMENT plugin (#PCDATA | runtime | extension)*> <!-- the name of the plugin --> <!ATTLIST plugin name CDATA #IMPLIED> <!-- the description of the plugin --> <!ATTLIST plugin description CDATA #IMPLIED> <!-- the plugin version --> <!ATTLIST plugin version CDATA #IMPLIED> <!-- the plugin vendor --> <!ATTLIST plugin vendor CDATA #IMPLIED> <!-- the plugin class --> <!ATTLIST plugin class CDATA #IMPLIED> <!ELEMENT runtime (#PCDATA | library)*> <!ELEMENT library (#PCDATA)> <!-- the jar archive --> <!ATTLIST library name CDATA #IMPLIED> <!ELEMENT extension (#PCDATA)> <!-- the extension type. Currently are available three types: selectionProcessor, documentProcessor and generalExtension --> <!ATTLIST extension type CDATA #IMPLIED> <!-- the class that implements PluginExtension and contains the method process --> <!ATTLIST extension class CDATA #IMPLIED>
GeneralPluginExtension
- this interface is intended for general purpose plugins - kind of external tools but triggered from the Plugins main menu. The implementing classes must contain the method process(GeneralPluginContext
) which should provide the plugin processing. This method takes as a parameter an GeneralPluginContext
object.
GeneralPluginContext
- represents the context in which the general plugin extension does its processing. The only method available is getFrame()
which returns the currently editing frame (java.awt.Frame
). It is useful if the plugin wants to display graphical components as they in general need a parent in order to appear properly on screen.