Eclipse 4.0 and tutorial on writing e4-RCP-application released


The Release

The e4-Team just announced the availability of the Eclipse 4.0 SDK “Early Adopter Release” (Reviewslides) which marks a major platform update since the inception of 3.0 6 years ago.

Just to reiterate what the 4.0 SDK is and to set expectations right. The 4.0 SDK is marked as an “Early adopter release” targeted at Plug-in Developers who want to test their code on the upcoming 4.x platform and report problems because of broken APIs or “APIs” not available anymore because they used internals of the platform.

The 4.0 SDK “Early Adopter Release” is not targeted for use as your Primary IDE so keep this rough edges in mind when giving the 4.0 SDK a try.

When takeing a closer look to the release you’ll notice that in reality multiple different things have been released:

  • Eclipse 4.0:
    • Eclipse 4.0 Application Platform: The new application platform to write OSGi-base (UI-)Applications centered around a new programming model using DI and a modeled application kernel
    • Eclipse 4.0 Compatible Rich Client Platform: Compability layer for API clean 3.x bundles to run unmodified on the new Application Platform
    • Eclipse 4.0 SDK: Eclipse 4.0 Application Platform + Eclipse 4.0 Compatible Rich Client Platform + PDE 3.6 + JDT 3.6
  • Eclipse 4.0 Technologies (also called “e4 SDK 0.10” / “e4 release July 2010” because the releasing project is e4):
    • XWT + Tooling: XAML for SWT/JFace and Visual Designer Tools
    • Semantic Filesystem implementation
    • Application Modeltooling

A small hint for Plug-in developers who are trying to debug their Plug-In by launching an inner Eclipse and all Eclipse 4.0 Application-Developers. The Eclipse 4.0 SDK misses at the moment the source bundles for the new Eclipse 4.0 components and you need to install it through the p2-repositories pre configured for you.

We recommend to install:

  • EMF SDK
  • Modeled Workbench Source
  • CSS Support Source

to successfully step through the code using the debugger.

My personal main focus in the Eclipse 4.0 development for the last 2 years has been the “Eclipse 4.0 Application Platform” whose goal is to modernize and simplify the development of OSGi-based UI-Application using DI and a modeled application approach. In the last few months I also worked on a tool to make writing applications for the Eclipse 4.0 Application Platform easier.

The model tooling

Since March I’ve been dedicated half of my 4.0 development time implementing support for the application model underpinning the Eclipse 4.0 Application Platform.

The model tooling has not yet graduated out of the e4-incubator and so is not part of the Eclipse 4.0 SDK download and you’ll have to install it using the preconfigured e4-repository – you find it in the “E4 Tools”-category.

The tooling is working in 2 modes:

  • Design/Development-Time mode: This is the standard mode you are using when developing an application. In this mode you operate on a Application-Model persisted as a XMI-File in your workspace.
  • Live mode: In this mode you are operating on the live model of a running application and are able to inspect and modify live

The Eclipse 4.0 Modeltooling is written to run native on the Eclipse 4.0 Application Platform (no useage of the Backward-Compat-Layer) but also integrates smoothly in the Eclipse 4.0 SDK.

Probably one of the most remarkable things though is that it runs also in a 3.6 SDK enabled by the so called Forward Compat Layer I started developing who does the opposite of the backward-compat-layer. It allows you to run components using the Eclipse 4.0 Progamming model which is built upon POJOs and DI in a 3.6 environment.

This makes it possible to write Eclipse 4.0 Applications using the 3.6 SDK as the screenshot demonstrates:

All you need is to install the tools using the e4 Update Site which is available on http://download.eclipse.org/e4/updates/2010.

The tutorial

When introducing new technologies we know that it is important to give people a medium sized example application which explains the concepts of the framework and provides them “monkey see, monkey do” example code. That’s why I’ve worked in the last few days/weeks on a tutorial which helps people getting started writing applications using the “Eclipse 4.0 Application Platform”

You can download the tutorial which is released under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 using this link. The sources codes are released under EDL-1.0/EPL-1.0 and are available from github and/or as individual zips (urls found in the PDF).

If you only want to take a look at an application built using the Eclipse 4.0 Application Platform you can downloaded using the links below:

You need Java 6 to run the demo although Eclipse 4.0 itself only needs Java5. To get accounts displayed on the left you should enter the following values in the Preference Dialog:

  • Username: john
  • Password: doe
  • Host: blabla.com

It looks like the update-code triggering of the AccountView is a bit weak so if you are not informed about the opening of the session after clicking around stop and starting the application should help you (I’ll try to work on a solution in the days to come).

Just in case you like the service I’m providing to you for free with this tutorial and you want to donate some cents here’s the button to push:

Tutorial-Update

  • 2010-08-10:
    • Fixed unclear section on page 6
    • Added warning to not install Visual WorkbenchTooling
This entry was posted in e4, tutorials. Bookmark the permalink.

71 Responses to Eclipse 4.0 and tutorial on writing e4-RCP-application released

  1. Hans Hierrer says:

    Thank you, Tom! This is an excellent post, great job and a perfect tutorial!!

  2. suraj says:

    Thanks for good tutorial.It would be great if there is sample e4 with Hibernate with persistence context .

  3. Hi,

    I try to follow this excellent tutorial, but i don’t manage to add Tools with update manager. EMF dependancy is missing. Do you know this issue? Wich version of SDK is better to download to follow the tutorial?

    Thanks

    • tomeclipsedev says:

      Did you download the 4.0 SDK? The update-manager should resolve EMF just fine but you could also install EMF-SDK first using the Helios-Update-Site part of the preconfigured Repository in 4.0 SDK.

  4. Faath Claude says:

    OK with : C:~\eclipse-SDK-4.0-win32>eclipsec.exe -application org.eclipse.equinox.p2.director -consoleLog -noSplash -repository http://download.eclipse.org/eclipse/updates/4.0,http://download.eclipse.org/e4/updates/2010,http://download.eclipse.org/releases/helios -installIU org.eclipse.releng.tools.feature.group,org.eclipse.emf.sdk.feature.group,org.eclipse.e4.ui.css.source.feature.feature.group,org.eclipse.e4.ui.source.feature.feature.group,org.eclipse.e4.ui.css.feature.feature.group,org.eclipse.e4.ui.feature.feature.group,org.eclipse.e4.core.tools.feature.feature.group

  5. Frank Fröhlich says:

    Wow, really impressive! Finally a thread for RCP programming. I feel I’m starting to get a fan of e4 – even at this early stage. Thanks a lot for the tutorial and additional information!

  6. zango says:

    On Page 6, I could not find the Plugin.xml. Should I create one?
    -Thanks much

    • tomeclipsedev says:

      If you have the MANIFEST.MF open you can click on the Extension-Tab on the bottom and the add and the “org.eclipse.core.runtime.products”-extension point

      • zango says:

        Thanks for the response, the ‘new->other->e4’ does not provide the options for the ‘plugin.xml’ or ‘application.e4xmi’ or ‘.product’ file.

        Also, when I had the MANIFEST.MF file open in the default editor, I could not see the extensions tab.
        So, I created a brand new project, this time used the wizard and then I copied the plugin.xml from the new project to the old project, searched and replaced the project names.
        Then when I open the MANIFEST.XML, I could see the ‘extensions’ tab.

        Since the ‘new->other’ is not helping me in generating the .e4xmi and .product file, I had to copy them from the new project, and I am at page 10, but when I click runas -> java app, nothing happens.

        Is my download from the eclipse.org not the right one? I did update the e4tools from the help-> install new software, but it looks like limited functionality. is the a seperate bundle somewhere to download as a whole?

        -thanks a lot

      • tomeclipsedev says:
        • The product-File is part of the PDE-Section
        • You see the other sections by clicking on the first Page of MANIFEST.MF on the right
        • There should be subentries in e4-section else the tooling ist not installed appropriately

        You can’t run this as a Java-App because you need to have a Equinox-Application.

  7. Stefan says:

    I do appreciate your effort to write this tutorial (I really do), but its current version is simply useless. It just doesn’t work with the Eclipse 4.0 SDK that was released a week ago.

    First, as others pointed out, when you get to the bottom of page 6 there is no plugin.xml created in the project. I was able to find the Extension Points link in the Overview tab of MANIFEST.MF, but when I press it and go to Extension Points -> Add, it is not apparent to me what to put in those fields (Extension Point ID, Name, Schema). If I put “product”, “org.eclipse.core.runtime.products” and leave the schema intact, I get a SWTException. If I edit the plugin.xml with the text editor and paste the sample from the PDF it is still the same.

    If I put this problem aside and continue the tutorial, the next road block is on the next page, 7. When I create the Application Model and press finish, I get “‘Setup’ encountered an error” message with a NPE in the details.

    Either I am really stupid, or the SDK and the tutorials are far from ready for any kind of adopters. Sad but true.

    • tomeclipsedev says:

      Thanks for your feedback and I’m sorry that you find it and the 4.0 SDK useless. I’ll try rework this section to clarify this point.

      Beside that you are using the wrong “Tab”. You’ll have to use “Extensions”-Tab and not “Extension Points” – that’s exactly the answer I gave to another comment! I don’t know what you installed and if you got an NPE I’d have hoped you filed a bugzilla with the details attached without seeing at least a stacktrace I can only say that it works on my installation, maybe you have installed the visual designer which doesn’t work but that’s something I can’t influence because its not written by me. Without getting stacktraces and bug reports we can’t fix your problems.

      You can also get help at the e4-newsgroup if you are not comfortable filing bugs. You need to understand that you are working with a bleeding edge kind of framework which we are going to mature in the year to come.

    • tomeclipsedev says:

      I’ve now clarified the section on the plugin.xml and added a warning to NOT install an XWT-Workbench-Tooling stuff which at least doesn’t work for me.

      • Stefan says:

        I tried again, with the latest version of the tutorial and taking your advice into consideration and it works! Thanks!
        It must have been the XWT that was causing the main problem – this time I took the SDK and only installed the E4 Tools, as you suggest and it works fine.

        A couple of suggestions, that I believe will make the tutorial even better:

        1. On page 6, in the initial version of the plugin.xml, the root element is missing from the sample code.
        2. On page 11, when starting the mail application for the first time, it would be nice to point out that you should select the product file and then Run As -> Eclipse application. My first attempt was by selecting the project and it didn’t work as I expected – new Eclipse instance was started.

        Thanks again! And sorry if my first comment was a bit harsh. I am playing with e4 in my spare time and it was really annoying not to be able to get it to work (after a hard day at work ;)).

      • Tom Schindl says:

        Thanks Stefan – I/we (the whole e4-team) appreciate any feedback and incooperate it into the tutorial. To your suggestions:

        • page 6: I believe the latest .pdf already holds this change probably not the one I produced after your initial feedback. Would you mind rechecking the latest tutorial
        • page 11: Ok I’ll add a paragraph explaining what one has to start
      • Stefan says:

        About the first one, the Create a plugin.xml section on page 6 – I probably didn’t explain it clearly.
        The problem is that the sample XML after Add a product definition like this misses the root element for a plugin.xml file, the plugin element. It starts with an extension element instead.

      • Tom Schindl says:

        The latest PDF-version holds a complete plugin.xml:

        <?xml version="1.0" encoding="UTF-8"?> 
        <?eclipse version="3.4"?> 
        <extension 
          id="product" 
          point="org.eclipse.core.runtime.products"> 
          <product 
            application="org.eclipse.e4.ui.workbench.swt.E4Application" 
            name="Mail App"> 
          </product> 
        </extension>
        
      • Stefan says:

        When I use the sample XML, I get a “Invalid root element” error in the editor. But when I put plugin element around the extension element, like this:

        everything seems to be fine. That is why I suggested a change in the tutorial.

      • Stefan says:

        Ooops, the sample code didn’t show up. Retry:

        
        
        
        
          
               
                 
                 
                 
           
        
        
        
      • Tom Schindl says:

        You are right – fixed the plugin.xml to hold the plugin-element in the root

  8. Faath Claude says:

    Hello
    Sorry for my English school.
    Excellent tutorial.
    Besides the keyboard shortcut section untreated( ExitHandler + DirectMenuItem), no problem with eclipse-SDK-4.0-win32 and all Java code.
    Page 29 of the tutorial should specify one Add -> Dependencies -> org.eclipse.e4.core.di.extensions.
    Thank you,

    • tomeclipsedev says:

      Thanks for your info the info. On the KeyBinding stuff did the explanation not work for you? Should I improve it in some way (e.g. more screenshots?)

    • tomeclipsedev says:

      I’ve fixed the missing dependency information and pushed a new version to the git-repo. Thanks for the feedback!

  9. Faath Claude says:

    Sorry for the confusion, I have not dealt with the keyboard shortcut section for personal reasons (FOR ME not interesting).

  10. Gerald Brown says:

    At the step where I try to first create the Application.e4xmi the Visual Design Editor does not open properly, but instead presents a NullPointer exception. That implies something is missing, yet I HAVE updated everything available at the update site.

    • Tom Schindl says:

      Please don’t install the Visual Editor stuff because it’s not working (at least for me it never worked on OS-X). Now that you have already installed it you could work around it by right clicking an selecting “Open With”

  11. Pingback: 2010 in review « Tomsondev Blog

  12. Holger Sachse says:

    I have a comment/ question regarding an aspect of the e4 architecture.
    Going through the contribution part of the tutorial I am wondering about why you have to wire things in the “NewMailHandler” which can be modeled in “Application.e4xmi” of the main plugin. Seeing the concepts of the “Application.e4xmi” model I would have expected that things like the “controls” part may be available also in the “fragment.e4xmi” and the most of the things in “NewMailHandler” would be provided by the framework.
    Is this intentional or did the team not see/ consider the potential extensions of the architectural concept? I think that the current design of fragments is (for some areas) behind the capabilities of the old extension point concept.

    Holger Sachse

    • Tom Schindl says:

      I’m not sure I can follow you can you try to rephrase so that I better understand what we could/should improve. The fragement concept is as powerful and as the old plugin.xml. If you are not satisfied with the current model you can extend is quite easily (e.g. see our SimpleIDE project) if you know a little about EMF.

      • Holger Sachse says:

        Thanks, for the response. Before I rephrase I have to study more your tutorial. Maybe I have overseen something.

  13. I do not get the newmail part to run in e4.1 m5. The window pops up but while rendering the trimbar I get a nullPointer Exception.

    java.lang.NullPointerException
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimBarLayout.isStatusLine(TrimBarLayout.java:245)
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimBarLayout.computeSize(TrimBarLayout.java:146)
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimBarLayout.access$0(TrimBarLayout.java:142)
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimBarLayout$TrimLine.addControl(TrimBarLayout.java:36)
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimBarLayout.computeSize(TrimBarLayout.java:104)
    at org.eclipse.swt.widgets.Composite.computeSize(Composite.java:233)
    at org.eclipse.e4.ui.workbench.renderers.swt.TrimmedPartLayout.layout(TrimmedPartLayout.java:120)
    at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1263)
    at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1249)
    at org.eclipse.swt.widgets.Composite.setLayoutDeferred(Composite.java:1086)
    at org.eclipse.swt.widgets.Display.runDeferredLayouts(Display.java:4150)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3708)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:824)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:740)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:87)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:134)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    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(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

    Any idea where to start searching? Deleting the trimBar part all works fine.

    Holger

  14. Ben says:

    First of all, thanks for the tutorial – it’s a nice way to learn about E4. However, I have run across a number of issues as I try to go through the tutorial. For example:

    * Some of the examples do not seem to run on Eclipse 4.1. For example, opening the preference dialog bombs in 4.1 with java.lang.NullPointerException at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.getShellContext(ShellActivationListener.java:193). Note: I ran the code directly from chapter8.zip to make sure this wasn’t due to my own mistake. This code works in Eclipse 4.0 however.

    * Running the code from contributions.zip in Eclipse 4.1 results in org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature ‘bindingContextId’ not found. Trying Eclipse 4.0 yields java.lang.ClassNotFoundException: org.eclipse.e4.core.commands.CommandServiceAddon and others.

    * The document suggests all the source code is available from the git repository, but it looks to me like the git repository only contains the document – not the source. I was hoping to gain a little more insight about the differences between 4.0 and 4.1 via the history in git.

    • Tom Schindl says:

      I started updating the stuff to 4.1 but didn’t had time to finish it. The source is also in the git repo and found in various branches. I’m going to take a look (maybe tonight) and publish a blog post when done. So if you simply subscribe to my blog you should get informed when I’m done.

      • Stefan Nöbauer says:

        Hi Tom,
        Thanx very much for the tutorial. I just have one question about the NPE. I still get this Exception on the 4.1 Platform. What exaclty is the problem?

        i also get another problem when running the code downloaded from git:
        org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature ‘bindingContextId’ not found. (platform:/plugin/org.eclipse.e4.demo.mailapp/Application.e4xmi, 30, 166)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
        at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadResource(ResourceHandler.java:187)
        at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadBaseModel(ResourceHandler.java:167)
        at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:236)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:346)

        What am I doing wrong?

      • Tom Schindl says:

        The problem is that we’ve changed the model slightly in this area while working on 4.1 but I haven’t had the chance to fix my tutorial sources

  15. Ben says:

    Thanks Tom! I’m sorry – I’m a bit of a git noob. I see the branches now. I guess what confused me was that there appears to be no source in master. I’ll be watching the blog for updates. Thanks again.

  16. Stefan Nöbauer says:

    Thanx for the quick answer. Is there a fast way to solve the NPE in the ShellActivationListener?

    Caused by: java.lang.NullPointerException
    at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.getShellContext(ShellActivationListener.java:193)
    at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.activate(ShellActivationListener.java:114)
    at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.handleEvent(ShellActivationListener.java:73)

  17. Andreas Dessner says:

    Very nice e4 tutorial ! But wenn i try to start the example the same Problem here: Feature ‘bindingContextId’ not found.

    will check your blog and hope you will find the time to update the sources 😉

  18. Thomas says:

    Interesting tutorial.
    I also ran into this nullpointer with eclipse 4.1. It works with 4.0. (older release of org.eclipse.e4.ui.workbench.swt)
    Another thing to mention: Chapter “Event-System”. You didn’t mention, that you’ve created the interface EventConstants.

  19. Jim says:

    Hello Tom,
    Nice tutorial. I am using the 4.1 version of your tutorial and doing testing with it on Juno 4.2. I guess something has changed again to cause NPE errors ( I have reached the end of page 26.) Don’t know if this was true on earlier Eclipse builds but the use of @Optional and ESelectionService are discouraged giving warnings. So I suppress the warnings and then when selection changes the NullPointerException error occurs. Trying to learn the right way to do things here…any suggestions would be helpful. Regards

  20. Jim says:

    Ok. So how hard should it be to eliminate the NPE error on 4.2. Are you interested in assisting?

    • Tom Schindl says:

      So who is NULL at this point? Can you show me the NPE you get?

      • Jim says:

        Ok Tom..thanks for looking at it

        Here is first part of console output when the product is launched, there is a problem but it still opens:

        !SESSION 2012-08-10 10:36:32.375 ———————————————–
        eclipse.buildId=unknown
        java.version=1.6.0_33
        java.vendor=Sun Microsystems Inc.
        BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
        Framework arguments: -product org.eclipse.e4.demo.mailapp.product
        Command-line arguments: -product org.eclipse.e4.demo.mailapp.product -data C:\Users\Jim\workspace2/../runtime-MailDemo-4.0.product -dev file:C:/Users/Jim/workspace2/.metadata/.plugins/org.eclipse.pde.core/MailDemo-4.0.product/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

        !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-08-10 10:36:35.937
        !MESSAGE Unable to create class ‘org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon’ from bundle ’27’
        !STACK 0
        org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException

        -snipped here

        …selecting an Account throws an NPE exception modal dialog, the app does sort of work as folders and mail
        are mostly updated/displayed, here is console output when account is selected:

        Exception occurred
        org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
        at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:77)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:106)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:308)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:322)
        at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$4.changed(SelectionAggregator.java:160)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:109)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:308)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:322)
        at org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl.setSelection(SelectionServiceImpl.java:30)
        at org.eclipse.e4.demo.mailapp.ui.AccountView$4.selectionChanged(AccountView.java:75)
        at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
        at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:128)
        at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
        at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
        at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
        at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211)
        at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1241)
        at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:239)
        at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:233)
        at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:403)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
        Caused by: java.lang.NullPointerException
        at org.eclipse.e4.demo.mailapp.ui.FolderView.setFolder(FolderView.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
        … 42 more

      • Tom Schindl says:

        so it looks like:

        org.eclipse.e4.demo.mailapp.ui.FolderView.setFolder(FolderView.java:83)

        produces the NPE. what does this line look like? Did you tried adding syserr’s there to see who is null?

      • Winne says:

        Hi,

        the problem is getMails() in org.eclipse.e4.demo.mailapp.mailservice.mock.MailSessionImpl

        You could guard

        return folderMails.get(folder).subList(startIndex, startIndex + amount);

        by

        if (folderMails.get(folder) == null) return new ArrayList();

        JM2C, Winne

  21. nEm says:

    Hi!
    Sorry this maybe an immature question but I am quite new to Eclipse 4.x.

    From what I understand by reading your tutorial and various others, that without your E4 Tool, it is not possible to create an E4 Application?

    The reason I am asking is because I recently downloaded Eclipse Juno and when I go to create a plugin project, it asks me for which Eclipse 3.x should the plugin be for; there is no option for 4.x. Also, I went to the E4 RCP Eclipse wiki and it gives me a permission denied on the chapters relating to `Creating an e4xmi file’. (http://wiki.eclipse.org/Eclipse4/RCP).

    I have been working on an RCP for the last year in Eclipse 3.x and I was debating whether it is worth porting the project into 4.x or if I should wait longer (for example, until the E4 Tools comes out of incubation).

    Thank you.

    • Tom Schindl says:

      It is of course possible but a lot harder. The tooling though not released directly is useable and bugs get fixed so. Not having the tooling released should not stop you from using e4.

  22. Sinisa says:

    Hi, I am new to this and I’ve been trying to use your tutorial with Juno. Other than a few minor issues, it has been going fine. I have just gotten to the part where I add the annotations, create the parts, and wire them to the classes and I get the following NPE:

    !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-09-13 15:19:13.208
    !MESSAGE Unable to create class ‘org.eclipse.e4.demo.mailapp.AccountView’ from bundle ’71’
    !STACK 0
    org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in org.eclipse.e4.demo.mailapp.AccountView

    plus other similar errors for FolderView.

    I am using a Juno release with Build id: 20120614-1722.

    Dependency Injection is really not working for me very well.

    Any help here would be very much appreciated.

    Thanks

  23. Matt Bucknam says:

    Tom:
    Excellent tutorial on a pretty complicated topic. It appears that e4 is undergoing a lot of work and changing rapidly. One thing that hung me up for a full day is that changes to the .e4xmi file are not reflected when running the application after the INITIAL create. I finally found an entry in the FAQ stating that you must use persistState=false and/or clearPersistedState=true to get changes reflected in the runtime. This is painful as the run configuration gets re-generated whenever you synch so the added entries go away. What do you think about this? Seems like the default should be to NOT save the state… For that matter when would you ever want to save the state when running in an IDE???

    • Tom Schindl says:

      Yeah when i wrote the tutorial 2 years ago there was no need to clear the state. Once i have a launch config i always adjust it and don’t regenerate.

      Tom

  24. Aljo says:

    Hi, it appears to be a good tutorial, but I just can’t find the source codes.
    On the github page there is the tutorial and a bunch images and the links in the pdf don’t work. Am I just to stupid or are the files gone?

  25. Peter Gassner says:

    Hi Tom, did you remove the sources? I can’t find them in the repository even the zip links doesn’t work

  26. guile says:

    Hi, the URLs include the in the tutorial PDF are not availables anymore.

    Ps: When are you updating this great toturial for the new Eclipse 4.2/4.3

    Keep the good work.

    • Tom Schindl says:

      The pdf is part of the repo and I doubt I’ll update it to 4.2 – but all stuff is released under Creative Commons so you are free to update the the odt and sources and provide a patch.

  27. ententchen says:

    Hi Tom,

    very nice tutorial and thanks for that ! Is it possible to fix that broken source code links ?

    many thanks in advance 🙂

  28. Fatih says:

    Hi Tom,

    In this way of creating E4 RCP project, does it allow us to use “3.X Compatibility Layer” in order to create views such as Project Explorer which is based on 3.X API. As I searched and experienced if we create a pure e4 application, compatibility layer is not enabled for use.

    Thanks in advance!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.