我已遵循本教程:https://eclipsesource.com/blogs/tutorials/getting-started-with-EMF-Forms 现在我试图嵌入我在RCP插件中创建(视图)的EMF表单。 我创建了一个简单的RCP4项目,我修改了SamplePart类,如下所示:
public class SamplePart {
private EObject getDummyEObject() {
final EClass eClass = MyPackage.eINSTANCE.getMyModelClass();
return EcoreUtil.create(eClass);
}
@PostConstruct
public void createComposite(Composite parent) {
final EObject dummyObject = getDummyEObject();
try {
final Composite content = new Composite(parent, SWT.NONE);
content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
content.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
content.setLayoutData(GridDataFactory.fillDefaults().create());
ECPSWTViewRenderer.INSTANCE.render(content, dummyObject);
content.layout();
} catch (final ECPRendererException e) {
e.printStackTrace();
}
parent.layout();
}
}
这是我的依赖项列表:
javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="[3.9.100,4.0.0)",
org.eclipse.swt;bundle-version="[3.102.1,4.0.0)",
org.eclipse.e4.ui.model.workbench;bundle-version="[1.0.1,3.0.0)",
org.eclipse.jface;bundle-version="[3.9.1,4.0.0)",
org.eclipse.e4.ui.services;bundle-version="[1.0.1,2.0.0)",
org.eclipse.e4.ui.workbench;bundle-version="[1.0.2,2.0.0)",
org.eclipse.e4.core.di;bundle-version="[1.3.0,2.0.0)",
org.eclipse.e4.ui.di;bundle-version="[1.0.0,2.0.0)",
org.eclipse.e4.core.contexts;bundle-version="[1.3.1,2.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.8.0,3.0.0)",
org.eclipse.emf.ecp.ui.view.swt;bundle-version="[1.15.0,1.16.0)",
org.eclipse.emf.ecp.ui.view;bundle-version="[1.15.0,1.16.0)",
org.eclipse.emf.ecp.edit;bundle-version="[1.15.0,1.16.0)",
com.myproject.ecore.mymodel;bundle-version="0.1.0",
org.eclipse.emf.ecp.view.model.provider.xmi;bundle-version="1.15.0",
org.eclipse.emf.ecp.view.model.provider.generator;bundle-version="1.15.0"
当我运行插件时,我收到此错误...有任何建议吗? 如果我使用"它可以实现:样本e4应用程序"
编辑:我也有一些这样的消息:org.eclipse.e4.core.di.InjectionException:java.lang.NullPointerException:不允许使用null服务引用。 在org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:966) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:151) 在org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:375) 在org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:294) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:56) 在org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:975) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:651) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1324) 在org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer $ 1.handleEvent(LazyStackRenderer.java:72) 在org.eclipse.e4.ui.services.internal.events.UIEventHandler $ 1.run(UIEventHandler.java:40) 在org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233) 在org.eclipse.swt.widgets.Display.syncExec(Display.java:4814) 在org.eclipse.e4.ui.internal.workbench.swt.E4Application $ 1.syncExec(E4Application.java:211) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) 在org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 在org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 在org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) 在org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) 在org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:94) 在org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) 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:173) 在org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:108) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:669) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70) 在org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java:142) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70) 在org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java:49) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:82) 在org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer $ 1.handleEvent(LazyStackRenderer.java:72) 在org.eclipse.e4.ui.services.internal.events.UIEventHandler $ 1.run(UIEventHandler.java:40) 在org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233) 在org.eclipse.swt.widgets.Display.syncExec(Display.java:4814) 在org.eclipse.e4.ui.internal.workbench.swt.E4Application $ 1.syncExec(E4Application.java:211) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) 在org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) 在org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 在org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) 在org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) 在org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) 在org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:94) 在org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:135) at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1) 在org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:108) at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:63) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:669) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:70) 在org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:725) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:665) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:757) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:728) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:722) 在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:706) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 4.run(PartRenderingEngine.java:1059) 在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) 在org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) 在org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) 在org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:161) 在org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) 在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) 在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) 在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) 在org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) 在org.eclipse.equinox.launcher.Main.run(Main.java:1519) 在org.eclipse.equinox.launcher.Main.main(Main.java:1492) 引发者:java.lang.NullPointerException:不允许使用null服务引用。 在org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:617) 在org.eclipse.emfforms.internal.core.services.controlmapper.ViewModelListener。(ViewModelListener.java:73) at org.eclipse.emfforms.internal.core.services.controlmapper.SettingToControlMapperImpl。(SettingToControlMapperImpl.java:123) at org.eclipse.emfforms.internal.core.services.controlmapper.SettingToControlMapFactoryImpl.createService(SettingToControlMapFactoryImpl.java:91) at org.eclipse.emfforms.internal.core.services.controlmapper.SettingToControlMapFactoryImpl.createService(SettingToControlMapFactoryImpl.java:1) at org.eclipse.emfforms.internal.core.services.scoped.EMFFormsViewServiceManagerImpl.getServiceOptional(EMFFormsViewServiceManagerImpl.java:100) at org.eclipse.emfforms.internal.core.services.scoped.EMFFormsViewServiceManagerImpl.createGlobalImmediateService(EMFFormsViewServiceManagerImpl.java:132) at org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl.loadImmediateServices(ViewModelContextImpl.java:320) at org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl.instantiate(ViewModelContextImpl.java:277) at org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl。(ViewModelContextImpl.java:171) at org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory.createViewModelContext(ViewModelContextFactory.java:42) at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:76) 在org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:65) 在com.myproject.ecore.myplugin.parts.SamplePart.createComposite(SamplePart.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 在org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) ... 112更多
!ENTRY org.eclipse.equinox.ds 1 0 2018-03-19 10:46:54.715
!MESSAGE Could not bind a reference of component
org.eclipse.emfforms.swt.core.rendererfactory. The reference is:
Reference[name = EMFFormsRendererService, interface =
org.eclipse.emfforms.spi.swt.core.EMFFormsRendererService, policy = dynamic,
cardinality = 0..n, target = null, bind = addEMFFormsRendererService, unbind =
removeEMFFormsRendererService]
答案 0 :(得分:0)
您需要向启动配置中添加org.eclipse.emfforms.setup.base
和所有必需的插件