In the next couple of weeks I’d like to write some blogposts and tutorials about plugin development for the awesome oXygen XML Editor. I’d like to share my experiences in plugin development since tutorials and resources for this topic are rare…
I’ll start off by showing how to add a custom toolbar with a simple button to the oXygen main window.
First of all, we need to download the oXygen plugins SDK from the oXygen Website. Create a new Java Project in your favorite IDE (I’m using Eclipse), place the
oxygen.jar library from the SDK download in your
lib/ folder and add it to the build path. Also add the Javadoc, that’s quite helpful. You can also access the the documentation online.
To start off with plugin development, read the oXygen manuel chapter about plugin development. Their blog also offers some help.
For extending the oXygen main window we need to create a „Workspace Access Plugin“. A plugin always consists of the following sources:
plugin.xml is the plugin descriptor and you can set it up as follows:
<toolbar> element defines our custom toolbar with its
Next, we need
YourDemoPlugin.java which is for convenience and can return an instance of our plugin. Haven’t found out what else you can use it for…
YourDemoPluginExtension.java is the Extension itself. Your PluginExtension class always needs to implement the plugin type interface, like in our case, the
WorkspaceAccessPluginExtension with it’s methods
applicationClosing(). We will use
applicationStarted() to add our toolbar and button to the oXygen main window at startup time. Take a look at the following:
We add a
ToolbarComponentsCustomizer and add a custom
JButton if the currently processed toolbar equals our toolbar ID in
For demo reasons I added a
messageDialog with the name of our toolbar. Feel free to do whatever you want with the JButton…
However, don’t forget to add your freshly created GUI components to the toolbar with
toolbarInfo.setComponents() and name your toolbar with
To load the plugin in oXygen export your Java Project as a JAR library and go to the oXygen installation directory. Open the folder
plugins/ and create your own plugin folder
DemoButton/. Place the
plugin.xml file inside, create a folder
lib/ inside and place the jar file in it. Restart oXygen.
That’s it… 🙂