0

I want to create an Eclipse4 app that uses GEF4. More precisely I want to use the GEF4 MVC Logo Example sources into my app. I have imported the GEF4 sources, the compilation is ok. But when I want to refer to the example view, or whatever I try with my custom code ; I have runtime errors...

!ENTRY org.eclipse.e4.ui.workbench 4 0 2015-05-06 14:11:12.430
!MESSAGE Unable to create class 'org.eclipse.gef4.mvc.examples.logo.ui.view.MvcLogoExampleView' from bundle '78'
!STACK 0
org.eclipse.e4.core.di.InjectionException: com.google.inject.CreationException: Guice creation errors:

1) An exception was caught and reported. Message: Workbench has not been created yet.
  at com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:172)

2) No implementation for org.eclipse.core.commands.operations.IOperationHistory was bound.
  at org.eclipse.gef4.mvc.ui.MvcUiModule.configure(MvcUiModule.java:24)

2 errors
       at org.eclipse.e4.core.internal.di.ConstructorRequestor.execute(ConstructorRequestor.java:55)
       at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:335)
       at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
       at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
       at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:104)
       at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:73)
       at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:55)
       at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:128)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:942)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:621)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:725)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:696)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:690)
       at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:674)
       at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1304)
       at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:71)
       at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
       at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
       at org.eclipse.swt.widgets.Display.syncExec(Display.java:4753)
       at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:212)
       at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
       at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
       at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
       at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
       at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
       at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
       at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
       at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
       at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:85)
       at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:59)
       at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
       at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
       at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$9.widgetSelected(StackRenderer.java:1082)
       at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
       at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4354)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
       at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:782)
       at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3111)
       at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1794)
       at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:283)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
       at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4354)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
       at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1112)
       at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
       at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:993)
       at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
       at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:161)
       at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
       at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
       at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
       at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
       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:648)
       at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
       at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
       at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: com.google.inject.CreationException: Guice creation errors:

1) An exception was caught and reported. Message: Workbench has not been created yet.
  at com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:172)

2) No implementation for org.eclipse.core.commands.operations.IOperationHistory was bound.
  at org.eclipse.gef4.mvc.ui.MvcUiModule.configure(MvcUiModule.java:24)

2 errors
       at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
       at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154)
       at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
       at com.google.inject.Guice.createInjector(Guice.java:95)
       at com.google.inject.Guice.createInjector(Guice.java:72)
       at com.google.inject.Guice.createInjector(Guice.java:62)
       at org.eclipse.gef4.mvc.examples.logo.ui.view.MvcLogoExampleView.<init>(MvcLogoExampleView.java:30)
       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(ConstructorRequestor.java:41)
       ... 67 more
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
       at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
       at org.eclipse.gef4.mvc.ui.MvcUiModule.configure(MvcUiModule.java:25)
       at org.eclipse.gef4.mvc.fx.ui.MvcFxUiModule.configure(MvcFxUiModule.java:28)
       at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
       at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
       at com.google.inject.spi.Elements.getElements(Elements.java:101)
       at com.google.inject.spi.Elements.getElements(Elements.java:92)
       at com.google.inject.util.Modules$RealOverriddenModuleBuilder$1.configure(Modules.java:172)
       at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
       at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
       at com.google.inject.spi.Elements.getElements(Elements.java:101)
       at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
       at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
       ... 76 more

If someone could provide me any process to integrate the GEF4 example, it'd be very nice

Bibix
  • 335
  • 2
  • 4
  • 13
  • 1
    The call to `PlatformUI.getWorkbench` giving the 'workbench has not been created yet' error would suggest this code is intended for Eclipse 3.x compatibility mode and not a pure e4 application (which does not support this call). – greg-449 May 06 '15 at 13:05
  • Ok thanks, you are right it works on an eclipse 3 app, I hope there is a clue to make it work on e4.... – Bibix May 06 '15 at 13:15

1 Answers1

0

As stated in https://bugs.eclipse.org/bugs/show_bug.cgi?id=372171, the standalone MVC and MVC.FX bundles still have dependencies to org.eclipse.core.commands, and the integration bundles MVC.UI and MVC.FX.UI in addition introduce dependencies to org.eclipse.ui, org.eclipse.ui.views, org.eclipse.ui.workbench, etc. (which are part of the compatibility layer). The MVC logo example depends on all of them. That is, integrating the example into a pure e4 app (without compatibility layer) is currently not possible.

Replacing the dependencies from the standalone bundles to org.eclipse.core.commands with its e4 pendant (that IMHO is not available in the respective scope yet) will enable that these bundles can be used in a native e4 application (i.e. without the compatibility layer).

For the integration bundles the same would have to be done, while the current integration is intensively based on the compatibility layer, so more effort would probably be needed. This is something that will need further investigation.