Everything started with the need of adding plugin support to some Java/SWT application.

Plugin support is far from being easy to implement, unless you use a plugin framework to help. We first looked at the Eclipse Equinox plugin framework (implementing the OSGi framework specification). Later on, I found another project named Java Plugin Framework (JPF).

The standard way of using JPF is: start the plugin framework, by launching the main method of the framework. The framework loads the plugins and searches for the application plugin. Using the application plugin, it launches your application. Equinox implements the same scheme.

We didn't want to convert the original application to a plugin. We wanted to keep on starting the application in a more standard way. The application would, at some point, start the plugin framework and load the plugins. Doing so with JPF appeared to be quite easy.

This article presents a simple application and how to add plugin support, in two phases: the first is very simple, the second is more elegant.

The application, named Bookmark, displays a tree view with bookmarks, on the left-side, and a browser view on the right-side (see picture). The application loads plugins that add new sections with bookmarks to the default bookmarks. The goal here is not to build a useful application, but to show how to add plugin support. We won't even perform any validation or merge sections.

The application uses the Eclipse/SWT for the GUI because integrating a Web browser is really easy.


Jean Lazarou


June 10, 2007