Developer Notes

2. A Little Reading

Pliny is developed using the plugin model adopted by Eclipse. To understand how to develop a plugin requires a significant amount of knowledge about aspects of the Eclipse platform that is quite different from Sun/Java's own technologies such as AWT, Swing and Applets. In the sections below we introduce some of the basic concepts, and provide some suggested readings for followup:

I largely avoid speaking of printed resources here, but if you are prepared to purchase only one book on developing plug-ins for Eclipse, you should try Eric Clayberg and Dan Rubel's Eclipse: Building Commercial-Quality Plug-ins (Addison Wesley). If you are prepared to buy two books, I would suggest also purchasing Matthew Scarpino et al's book SWT/JFace in Action (Manning) which, as well as providing a very good grounding in SWT and JFace provides an two extended appendices a very good introduction to draw2d and GEF as well.

Why Plugins?

The Pliny project has two agendae, and they are both explored in part by aspects of the development of the Pliny software. One of these agendae is that the plugin approach to software development provides useful features that should interest those who develop tools for the digital humanities. If you are interested, I have made available a draft version of a paper I have given that speaks about some aspects of why I think this is interesting. You can find it here.

Plugins and PDE

Eclipse components are called Plugins. Eclipse also provides an environment to support the development of your own plugins called the Plug-in Development Environment (PDE). Some introductions to the set of concepts imbedded in Eclipse plug-ins and in PDE can be found in the following online resources:

  • The Online Eclipse Help System: This is a web-accesible version of the help materials that come bundled with Eclipse. In the left frame you will see a topic "Platform Plug-in Developer Guide". Click on it to open it, then navigate into the "Programmer's Guide". The section found in there called "A Simple plug-in example" provides some startup information.
  • PDE Does Plug-ins: one of the Eclipse articles provided on the Eclipse homepage http://www.eclipse.org -- an introduction to the Plug-in Development Environment (PDE) which provides "a set of tools that assist the developer in every stage of plug-in development from genesis to deployment"
  • The Eclipse Articles: provide much useful information about how to use Eclipse to build Eclipse plugins. Not much of it is really for beginners, unfortunately.

SWT and JFace

One of the roadblocks for most Java programmers who have already done GUI programming is that an Eclipse plugin must be based on SWT and JFace. SWT (Standard Widget Toolkit) is described on the SWT part of the Eclipse website as "an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented". SWT supports the GUI development in the same way as AWT or Swing do. Although SWT shares some ideas with AWT (such as the concept of a layout manager), in many ways it is significantly different from AWT or Swing and those familiar with development with AWT/Swing will not find their knowledge very useful.

JFace is built on top of SWT and promotes a Model-View-Controller (MVC) approach for interface development. By providing an abstraction layer on top of SWT, JFace allows you to program directly to it, and let it talk to SWT widgets.

There is good starting information about SWT and JFace at:

The Eclipse WorkBench and RCP

Eclipse's "workbench framework" provides much of the basic underpinnings for Pliny -- it provides a kind of a GUI host where Pliny's editing objects can be presented to the user. Views, editors, menus, wizards, actions and many other important concepts in Eclipse arise out of the idea of the workbench. Pliny code can be run under Eclipse itself, in which case Eclipse provides the workbench in which Eclipse operates. However, to allow Pliny to also run standalone, Pliny has been set up to operate in the context of Eclipse's Rich Client Platform (RCP). RCP provides a skeletal workbench, as it where, in which Pliny's components will run.

Here are some useful references to assist you with Workbench issues:

  • Unfortunately, the Eclipse FAQ rarely describes things that are helpful to a beginning Eclipse developer, but there is an extensive section on the Workbench entitled: Generic Workbench
  • Peter Nehrer: Programming the Eclipse Workbench: introduces the basic concept of workbench parts and explains how they fit together.
  • The Eclipse WIKI has a section on RCP
  • Ed Burnette provides a set of 3 tutorials that introduce the developer to how to use RCP to build a Java application. Tutorial 1 is here.

NB: One of the significant sources of confusion is that the Eclipse world uses the similar terms view and viewer for entirely different things. A viewer is an SWT concept, and a view is a WorkBench/RCP one. See FAQ 196.

GEF and draw2d

GEF (Graphical Editing Framework) provides a framework that "allows developers to take an existing application model and quickly create a rich graphical editor". The support for interactive schematic diagrams similar to Pliny's Annotation/Reference Area is provided with GEF.

Although GEF operates on top of SWT, it contains its own GUI toolkit called draw2d.

Information about GEF and draw2d:


John Bradley
Center for Computing in the Humanities
King's College London