e4 – Use Eclipse 4.1 Application Platform but not SWT

So the title already says what this Blog-Post is about. It will talk about the possibility to use the Eclipse 4.1 Application Platform without using SWT to develop your UI-Components.

Already the initial designs of Eclipse 4.x splitted the codebase not only into Core and UI-Components but futher broke up the UI-Components in stuff into a toolkit independent and toolkit dependent part. The concept we are using here is often referred in our talks as the “RenderingEngine” which is responsible of turning our Application Model into an UI.

In the 4.0 we violated our own design by dragging in unwanted SWT-Dependency through referenced bundles but we got rid (or better said will get because of bug 338559) of them in 4.1 and so the Eclipse 4 Application Platform we’ll be able to be used without using SWT but use the UI-Toolkit of your choice (e.g. Swing, Qt, …).

To make it possible to write e.g. Swing-Applications using the Eclipse 4 Application the only requirement is that someone wrote a replacement for the default rendering engine provided by default by the e4-Team. To find out how much effort it would be to write such a thing I’ve experimented a bit yesterday and have to admit it’s doable using the SWT-Implementation and translating into Swing calls. Hacking for about 5 hours I had a minimal Swing-Application running on.

Here’s a screenshot of my model editor which is used to connect the pieces so that we get a running application:

So what does this first experiment tell us? The Eclipse 4 Application Platform is a flexible UI Framework to build component based UI application no matter if you use SWT or not and the effort to provide a rendering engine for another UI-Toolkit is not a task of man years.

The educated reader might ask why one would want to write applications without using SWT given that Eclipse 4.1 allows you to style widgets using CSS.

There are multiple:

  • SWT and Styling pixelperfect: For many types of applications I have no problems with the limitation SWT has when it comes to styling the native widgets (when e.g. writing Database-Forms) but when it want to write a stylish UI which looks as slick as applications created with other RIA technologies. Don’t believe me? Ever tried to change the background-color of a Button?
  • JavaFX on the horizon: The first test reports from JavaFX 2.0 are promising and my bet is that integration into a Swing-Application is going to be easier than in SWT. I think using JavaFX will be quite nice if you’d like to include multimedia content and use animations which is something SWT has not made any progress since the early days of the Eclipse 4.0 effort
  • Legacy-Swing codebase: If you have a lot of Swing knowledge and probably even source code it might be easier to stay with Swing
  • Learn only one RCP-Framework: If you have to write application using different Toolkits (SWT,Swing, …) it is easier to learn only one framework currently you’ll have to keep the knowledge about Nebeans and Eclipse RCP
  • You simple like Swing/Qt and want to make use of the new DI-Programming model, OSGi-Services and the new idea of the central application model

Finally what did i use to make the small application in the screen shot:

  • Java 1.6 SE (swing is part of it 🙂
  • Eclipse Databinding: Only the core part and Pojo-stuff
  • org.eclipse.ufacekit.ui.viewers: Base implementation for JFace-Viewer like components but defined in a widget toolkit independet fashion (plus support for Generics)
  • org.eclipse.ufacekit.ui.swing.jface: JFace-Viewer like components for Swing-Controls
  • org.eclipse.ufacekit.ui.swing.databinding: Observable implementation of the Eclipse Databinding API for Swing controls
  • org.eclipse.ufacekit.ui.viewers.databinding: Observable implementation working on top of the generic JFace-Viewer API provided by org.eclipse.ufacekit.ui.viewers
This entry was posted in e4. Bookmark the permalink.

4 Responses to e4 – Use Eclipse 4.1 Application Platform but not SWT

  1. RK says:

    Is there a more detailed outline of your solution to do this that can be reviewed? We have a large swing based modular app that we are looking for ways to leverage eclipse and this sounds like a good approach to research further.

  2. Binyan says:

    Tom, can you update the list of projects needed as I downloaded the referenced git repo but the projects in there don’t all match up with the projects displayed in the screenshots. We have a large swing app and the thought of moving to e4 and rewriting the UI in SWT is considered a non-starter by the powers that be. However, if I can see your demo and learn how it works then we may still be able to adopt the platform underneath.

    • Tom Schindl says:

      I’d suggest you take a look at the work Kai Tödter has done in the Swing area. My e(fx)clipse project will concentrate on a JavaFX 2.0 platform based upon the Eclipse 4.x Application Platform.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s