JavaFX 2.0, Swing & SWT Renderers for the Eclipse 4.x Application Platform


I wish you all a Happy New Year!

During the last weeks I had a bit of spare time and started experimenting with new rendering engines for the Eclipse 4.x Application Platform. Based on my experiences with  JavaFX 2.0 renderers in e(fx)clipse (by Tom Schindl from, great JavaFX support for Eclipse), I started an experiment: Would it be possible to create a generic rendering engine that only has dependencies to the Eclipse 4.x workbench model and then delegate all UI toolkit specific logic to the UI toolkit specific renderers?

When I took a deep look at the projects org.eclipse.e4.ui.workbench.swt, org.eclipse.e4.ui.workbench.renderers.swt and org.eclipse.e4.ui.workbench.addons.swt, I figured out that most of the workbench model related code could be useful for other renderes, too. But there is a very strong coupling to SWT, so it is not possible to reuse any code without copying it. My approach is a simple generic rendering engine, that also provides a generic e4 application. Then, for every supported UI toolkit, just a derived application and new renderers have to be implemented. The basic bahavior is driven only by model changes, the renderes have to react on those changes. The engine also takes care of letting each renderer do the binding from the specific UI toolkit back to the model.

Currently I have implemented simple rendering engines for JavaFX 2.0, Swing, and SWT. I also started the same approach with a generic MinMax model addon. The addon gets the additions needed to adapt to a specific UI toolkit through DI.

I reimplemented my e4 contacts demo and split it into a generic project that contains the workbench model, the domain model and all parts, which are not UI toolkit specific. Then I created a UI toolkit specific implementation for JavaFX 2.0, Swing and SWT. The Details and the Table widgets I had to implement with the UI toolkits natively. Here are a few screen shots of the results, click on them to see the images in original size.

JavaFX 2.0 based contacts demo with 3 different CSS based themes:


Swing based contacts demo with Nimbus and Napkin Look & Feel (Napkin is my favorite Look & Feel to show prototypes to the management :)):


SWT based contacts demo (my new rendering engine) with 2 different CSS based themes:


The current alpha version 0.0.1 you find at GitHub:

If you want to run the JavaFX 2.0 Contacts Demo, you also need to have the latest version (0.0.11 or better) of e(fx)clipse installed. The easiest way is to download the pre-configured Eclipse 4.x SDK from and then clone the above git repository.

Right now this is just a proof of concept, only very basic stuff is implemented. But I am planning to enhance the engine and UI toolkit specific renderers until EclipseCon 2012. If there is enough interest in the community, I would love to organize a BOF at EclipseCon to discuss the pros and cons of this approach.

What do you think?

Stay tuned!


You find me on Twitter and Google+.
If you are interested in in-house Eclipse RCP 3.x or 4.x training,
please contact me…


  1. Pau CarréJanuary 6, 2012

    Does it mean that it will be possible to run Eclipse 4.x using only Swing?

  2. Kai TödterJanuary 7, 2012


    if you mean the Eclipse 4.x SDK => No, this will always be on top of SWT.

    But you could build applications on top of the Eclipse 4.x application platform that use UI toolkit specific renderers for the workbench model. Of course, all the content of the view parts, dialogs, etc. have to be implemented natively in the respective UI toolkit.

  3. Java desktop links of the week, January 9 | Jonathan GilesJanuary 8, 2012

    […] Kai Tödter has blogged about JavaFX 2.0, Swing & SWT Renderers for the Eclipse 4.x Application Platform. […]

  4. JavaFX links of the week, January 9 // JavaFX News, Demos and Insight // FX ExperienceJanuary 8, 2012

    […] Kai Tödter has blogged about JavaFX 2.0, Swing & SWT Renderers for the Eclipse 4.x Application Platform. […]

  5. VitaliyJanuary 30, 2012

    This is awesome! Swing version is running on linux. JavaFx realised for linux, but i cant get it work. Is there tutorial on this app?

  6. Eugen EislerFebruary 4, 2012

    Eclipse SDK, Version: 4.2.0, Build id: I20120127-1145

    GenericE4Application, Zeile 264:
    eclipseContext.set(EPartService.PART_SERVICE_ROOT, new ContextFunction() {
    Es gibt keinen statischen Member in “EPartService.PART_SERVICE_ROOT”
    Was kann man da machen?

  7. Kai TödterFebruary 5, 2012

    Not yet, I will drive it in the next weeks. Hopefully I get a good state just before EclipseCon

  8. Kai TödterFebruary 5, 2012

    @Eugen Eisler
    This is fixed in the current master. It was a change from Eclipse 4.2 M4 to M5. Alternatively you could just delete the whole statement beginning with line 264 (That’s what I did).

  9. BinyanFebruary 7, 2012

    Kai, I’m also very interested in trying out what you have done for the swing version, but I’ve spent hours tonight trying to get it to work. If you could hook up the magic steps to get this to work, then I’ll be sure to hook you up at the bar next month in Reston, deal? 🙂

    • Kai TödterFebruary 7, 2012


      Here are the steps:
      1) Install Eclipse 4.2M5 + efxclipse, the easiest way is the pre-configured distro
      2) Get the e4-rendering master from my Git repo
      3) Open contacts.product in project com.toedter.e4.demo.contacts.swing
      4) In the Overview tab, in the Testing section, click: Launch an Eclipse Application

      That should be all.

  10. BinyanFebruary 12, 2012

    @Kai Tödter
    Thanks Kai,

    Finally got back around to trying this and things do work (on Windows). I previously tried the same setup on OSX Snow Leopard and it would lock up as soon as I believe the swing thread was about to be started. Maybe it was the beta version of the java 7 jdk, or something else. Sadly most of development uses a mac, so if I’m going to make any progress, I’ll need to find out what is really going on there. Still, I’ll see you at the bar next month.

    Also as an fyi, the app throws the following on startup:

    Caused by: java.lang.IndexOutOfBoundsException: Index: 10, Size: 10
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at org.eclipse.core.databinding.observable.list.ObservableList.get(
    at com.toedter.e4.demo.contacts.swing.views.ListView$2.valueChanged(
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(Unknown Source)
    at com.toedter.e4.demo.contacts.swing.views.ListView.(
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.eclipse.e4.core.internal.di.ConstructorRequestor.execute(

  11. BinyanFebruary 12, 2012

    Don’t know why but the IOOBE is caused by the fact that the source I have has line 89 of with “Tödter”.equalsIgnoreCase(contact.getLastName()) instead of “Tödter”.equalsIgnoreCase(contact.getLastName()). Really wierd since all I’ve done is clone the repo and imported the projects.

  12. Kai TödterFebruary 12, 2012

    You have to set your workspace encoding to UTF-8 🙂

  13. DimitryFebruary 14, 2012

    I consider porting of mind map editor Freeplane developed as a pure swing application to e4 after a stable swing rendering engine is available. How do you think when it comes?

    Regards, Dimitry

  14. Kai TödterFebruary 15, 2012


    I am not sure if there will be a product quality Swing based rendering engine. Right now it is just a proof of concept. My plan is to improve both the Swing and JavaFX renderers until EclipseCon. Then I would like to have a BOF about that topic, and then let’s see.

  15. BinyanFebruary 29, 2012


    The current code fails to work on OSX because of Calling any of the swing apis results in deadlock with OSX 10.6.x and Eclipse 4.2M5. It is passed down from wikis to issue trackers that some arcane combination of –launcher.secondThread, -XstartOnFirstThread, -XstartOnSecondThread and removal of the -ws ${} would allow swing to come up and work, but I haven’t been able to reproduce reported results. If you have anything to add, it would be greatly appreciated.

  16. jminiMarch 20, 2012


    Does your project work with M6 ?

    I get this exeception when I try to start the SWT application:
    org.eclipse.core.runtime.CoreException: Plug-in com.toedter.e4.ui.workbench.swt was unable to load class com.toedter.e4.ui.workbench.swt.SWTE4Application.

    Caused by: java.lang.UnsupportedClassVersionError: com/toedter/e4/ui/workbench/swt/SWTE4Application : Unsupported major.minor version 51.0

    The only modification I did, is to change the Execution environment to JavaSE-1.6 (because I do not have 1.7 on my Mac) and I closed the JavaFX projects because I do not have e(fx)clipse.

    Thanks for your answer…

  17. enzogupiMarch 28, 2012

    Thanks Kai,
    your javafx renderer does the job very well (tested with e(fx)clipse 0.0.13 and Eclipse M6).
    Now I’m wondering how to render with javafx also the e4 part (the main window and its borders).
    Would it be possible?

  18. enzogupiMarch 29, 2012


    I’ve found it!

    Just adding “stage.initStyle(StageStyle.UNDECORATED);” after the stage initializazion, and the window has no border. Now I can customize every aspect of appereance!

  19. Oliver PfauApril 5, 2012

    I like the JavaFX style stuff. To use it with RCP capabilities would be great. Good work 🙂

  20. Oliver PfauApril 10, 2012

    What is the state of the JavaFX integration within eclipse RCP? Do you think the JavaFX renderers will get fix part of eclipse 4 or is it too early to say?

  21. krunalApril 19, 2012


    I have tried with step that you mention but my gives error stack trace like below .
    java.lang.RuntimeException: No application id has been found.
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(
    at org.eclipse.equinox.launcher.Main.basicRun(
    at org.eclipse.equinox.launcher.Main.main(
    An error has occurred. See the log file

    Let me know what i do for run

    • Kai TödterApril 23, 2012

      Update from Github and then launch the demos from the contacts.product file (create your own launchers). Hope that helps…

  22. Oliver PfauJune 19, 2012

    I am quite new using eclipse 4. How is it configured when the DetailsView.setSelection() method invoked? The selected conact is set to IEclipseContext in the ListView. Is this a build-in mechanism of eclipse 4 (selection provider or something)?

  23. fadelJune 20, 2012

    hi @Kai Tödter,
    I’d like to use your JavaFX contact demo but not as a bundle( not as in here Do you have a contact Demo application that has a main method ?

  24. Eclipse e4 and Swing applications « Modularity MattersFebruary 7, 2013

    […] Eclipse e4 provides lot of new features ( Application model using EMF, dependency injection, custom renderer, CSS styling etc).  kai has blogged about this here […]

  25. CodexApril 29, 2017

    Seriously Javafx is beautiful and simple to write i really love this framework .And want to know more of this.

Leave a Reply to JavaFX links of the week, January 9 // JavaFX News, Demos and Insight // FX Experience Click here to cancel reply.

I accept the Privacy Policy