Image Export Plug In
An Eclipse plug in to to simplify the task of exporting images from GEF diagrams.
Its goal is to allow exporting GEF diagrams to “images” in several formats in a generic and extensible way. It contributes two “Diagram Image” export wizards and allows for other plug ins to contribute diagrams to export (the “figure providers”) and image formats (the “image exporters”) to generate images. It is made that modular because we wanted it to be extensible. Plus we use existing libraries to generate certain formats (e.g. the Batik SVG Toolkit to produce SVG). Those libraries tend to be big and I wanted to let the user choose what formats are needed (there are still people with slow/dialup connections :>).
If there is no figure provider registered for a diagram file to be exported, we just open it in an editor and query the editor for the figure. This has the ugly side effect that editors open and close during the export operation. But at least you can export GEF diagrams you have editors for. This works for the GEF examples, see the screenshots and exported samples below. However, it does not work for multi page editors (it only works for the default page).
There are two wizards. One allows you to export images for several diagram files at once. You pick the files and the image format and all files are exported. The other wizard allows you to export an image of the current diagram. Optionally, you can choose to only export the current selection. There is even a preview that shows you how your image will look like. See the following screenshots.
Download and Installation
As this is a spin-off project from my still unreleased Janus project, I placed the files on its download page so it is at least no longer empty :). This is a release from two persons making their first experiences with the Eclipse platform so you should expect to meet bugs all along the way. Comments, discussion, patches and everything else is welcome. Please use the facilities provided by Sourceforge, i.e. the trackers and forums.
What and Where?
Downloadable files are on the SourceForge files page.
Download the Image Export Plug In and all the export format plug ins you are interested in (currently there are additional plug ins for PDF, EPS and SVG). If you install the PDF, EPS or SVG export plug ins, you also need the GMF plug-in. You can install this by selecting "Help > Software Updates > Find and Install...", and choose to install "new features" from the "Europa Discovery Site". GMF has a lot of dependencies of its own so "Select Required" often comes in handy.
For SVG, you additionally need the Batik plug in. For PDF, you also need the iText plug-in. Both can be installed like GMF (see above, have a look at the section called "Enabling Features"). For EPS, a plug-in for Apache XML Graphics Commons is provided.
You also need one of the logging plug ins (if you do not already have installed a plug in that
See the Releases page for an overview.
Unpack the Image Export Plug In into your Eclipse installation directory and copy the additional export format plug ins and the logging plug in into your plugins directory. When restarting Eclipse, you should see the Image Export feature and plug ins in.
Eclipse 3.4's dropins directory improves the installation process of plug-ins. See Equinox p2 cures Eclipse plug-in headaches on IBM's developerWorks.
Getting Logging Output
When using the nlog4j plug in you might want to start Eclipse with something like -Dlog4j.configuration=file:/path/to/log4j-config.xml. Another useful one might be -Dlog4j.debug=true.
A complete example command line (all in one line):./eclipse -data ../workspace -clean -debug -consolelog -vmargs \ -Dlog4j.configuration=file:/home/thm/.imageexport/log4j-config.xml \ -Dlog4j.debug=true
Known Bugs and Missing Things
Technical Stuff, Rationale
To export a GEF diagram you need to
It is impossible to implement loading the model in a generic way because each model is
different. So people who would like to use the export plug in have to give it something more
universal. Eventually, each model displayed in a graphical viewer is displayed as a figure, so an
The figure can be told to paint itself, passing it a
To seamlessly plug into Eclipse I thought it would be nice if the user was able to choose File > Export..., select “Diagram Image” from the list of export engines and was presented with a typical export wizard that allows choosing which files to export into which target directory and so on. So the Image Export contributes such a wizard. The user may activate this wizard as soon as the Image Export plug in is installed.
Each client that wants to contribute a model format to the export wizard, registers a
Then there are
I did all that to keep the plug in dependencies down to a minimum. Your own editor that wants to
contribute to the export wizard may provide a
The exporter plug ins depend on the Image Export plug in. The user chooses which formats he wants to be able to export to and installs exactly the ones needed.