Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Headless Workspace(Using HeadlessContextPresentationEngine to have a headless workspace.)
Headless Workspace [message #897090] Sat, 21 July 2012 15:44 Go to next message
Eric Van Dewoestine is currently offline Eric Van DewoestineFriend
Messages: 2
Registered: July 2009
Junior Member
I'm attempting to migrate my code for starting up a headless eclipse workspace from 3.x to Juno. With e4 it seems that the proper route would be to create a headless presentation engine to replace the default PartRenderingEngine, but in my attempts to use the HeadlessContextPresentationEngine, I've run into a problem where the event broker is never injected resulting in the headless engine failing with an NPE during its postConstruct.

Here is how I'm overriding the default PartRenderingEngine
  <extension point="org.eclipse.core.runtime.products" id="org.eclipse.sdk.ide">
    <product application="org.eclipse.e4.ui.workbench.swt.E4Application">
      <property name="presentationURI" value="bundleclass://org.sample/org.eclipse.e4.ui.tests.application.HeadlessContextPresentationEngine" />
    </product>
  </extension>


I then start eclipse normally letting it run the default workbench application which fails to start with this NPE due to the eventBroker being null:

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.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
        at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
        at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
        at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
        at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
        at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.instantiateRenderer(E4Workbench.java:101)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:83)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        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.ui.tests.application.HeadlessContextPresentationEngine.postConstruct(HeadlessContextPresentationEngine.java:124)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
        ... 28 more


Looking at the eclipse source I can't figure out why the default PartRenderingEngine would have its eventBroker injected, but the HeadlessContextPresentationEngine wouldn't.
Re: Headless Workspace [message #897538 is a reply to message #897090] Tue, 24 July 2012 12:52 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Just curious, but if it's headless, why don't you just supply your own IApplication? Why bother running the workbench?

Re: the event rocker not being injected. It I sounds like you're missing a key bundle. Are you including all the bundles specified by org.eclipse.e4.rcp feature?

Brian.
Re: Headless Workspace [message #897541 is a reply to message #897538] Tue, 24 July 2012 12:59 Go to previous messageGo to next message
Eclipse UserFriend
Brian de Alwis wrote on Tue, 24 July 2012 15:52

Re: the event rocker not being injected. It I sounds like you're missing a key bundle. Are you including all the bundles specified by org.eclipse.e4.rcp feature?

Brian.


We have an IEventRocker ? Cool. eventRocker.rockTheParty(Club club);
Re: Headless Workspace [message #897661 is a reply to message #897538] Wed, 25 July 2012 01:16 Go to previous message
Eric Van Dewoestine is currently offline Eric Van DewoestineFriend
Messages: 2
Registered: July 2009
Junior Member
Brian de Alwis wrote on Tue, 24 July 2012 08:52
Just curious, but if it's headless, why don't you just supply your own IApplication? Why bother running the workbench?


I need to run the workbench because I'm exposing eclipse features via console commands (eclim.org). For eclipse 3.x I had a dedicated IApplication which included some gross hacks so I could call PlatformUI.createAndRunWorkbench(...) and prevent it from rending anything, but those hacks no longer work.

Brian de Alwis wrote on Tue, 24 July 2012 08:52
Re: the event rocker not being injected. It I sounds like you're missing a key bundle. Are you including all the bundles specified by org.eclipse.e4.rcp feature?


Thanks for the hint! Turns out I was just missing javax.inject in my dependencies. Now on to the next set of NPEs...
Previous Topic:(Announce) "Jeeeyul's Eclipse Themes" is Updated
Next Topic:Missing Toolbar when migrating to e4
Goto Forum:
  


Current Time: Thu Apr 18 18:42:15 GMT 2024

Powered by FUDForum. Page generated in 0.01824 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top