如何在E4应用程序中嵌入GEF4 MVC徽标示例

时间:2023-01-12 23:35:15

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...

我想创建一个使用GEF4的Eclipse4应用程序。更确切地说,我想在我的应用程序中使用GEF4 MVC徽标示例源。我已经导入了GEF4源,编译还可以。但是当我想引用示例视图时,或者我尝试使用我的自定义代码时;我有运行时错误......

!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

如果有人可以为我提供整合GEF4示例的任何流程,那就非常好了

1 个解决方案

#1


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.

如https://bugs.eclipse.org/bugs/show_bug.cgi?id=372171中所述,独立的MVC和MVC.FX包仍然依赖于org.eclipse.core.commands,并且集成包MVC.UI和MVC.FX.UI另外引入了对org.eclipse.ui,org.eclipse.ui.views,org.eclipse.ui.workbench等的依赖(它们是兼容层的一部分)。 MVC徽标示例取决于所有这些。也就是说,将示例集成到纯e4应用程序(没有兼容层)中是不可能的。

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).

将独立软件包中的依赖项替换为带有e4链接的org.eclipse.core.commands(IMHO尚未在相应的范围内提供)将使这些软件包可以在本机e4应用程序中使用(即没有兼容性层) )。

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.

对于集成包,必须完成相同的操作,而当前的集成主要基于兼容层,因此可能需要更多的努力。这是需要进一步调查的事情。

#1


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.

如https://bugs.eclipse.org/bugs/show_bug.cgi?id=372171中所述,独立的MVC和MVC.FX包仍然依赖于org.eclipse.core.commands,并且集成包MVC.UI和MVC.FX.UI另外引入了对org.eclipse.ui,org.eclipse.ui.views,org.eclipse.ui.workbench等的依赖(它们是兼容层的一部分)。 MVC徽标示例取决于所有这些。也就是说,将示例集成到纯e4应用程序(没有兼容层)中是不可能的。

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).

将独立软件包中的依赖项替换为带有e4链接的org.eclipse.core.commands(IMHO尚未在相应的范围内提供)将使这些软件包可以在本机e4应用程序中使用(即没有兼容性层) )。

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.

对于集成包,必须完成相同的操作,而当前的集成主要基于兼容层,因此可能需要更多的努力。这是需要进一步调查的事情。