我对Eclipse 3.x开发很有经验,现在想开发一个E4应用程序。因此,我测试了一个简单的例子,以便开始使用新的东西。
我一步一步地关注this tutorial,但导致同样的错误。但是,他没有收到这些错误。
我正在使用Eclipse Luna(4.4.2)并安装了E4 Tools (0.17)。
我已经创建了一个新的Eclipse 4应用程序,并使用Import 3x添加到Application.e4xmi
公共资源导航器(Project Explorer)作为共享部件 - >以兼容性视图查看。然后我添加了一个引用共享部分的占位符。我已将所有必要的插件添加到产品的依赖项中。我还添加了兼容性插件。
但是,当我启动该应用程序时,我在InjectionException
获得了InjectorImpl#internalMake()#331
,这只是:
if (unresolved(actualArgs) != -1) continue;
调试unresolved()
让我转到以下几点(InjectorImpl#489
):
Creatable creatableAnnotation = desiredClass.getAnnotation(Creatable.class);
desiredClass
是org.eclipse.ui.internal.ViewReference
类。
然后函数返回1,导致继续大写和异常。 stacktrace是以下(full here):
!ENTRY org.eclipse.e4.ui.workbench 4 0 2015-05-06 13:00:05.899
!MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityView' from bundle '96'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in org.eclipse.ui.internal.e4.compatibility.CompatibilityView
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:346)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:258)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
...
答案 0 :(得分:2)
要解决此问题,我必须关注this awesome tutorial。正如@ greg-449已经提到你使用3.x RCP并在其上放置 e4识别产品。然后将初始化兼容层。因此,您必须执行以下操作(教程详细描述):
其余内容在链接教程中进行了描述。 不忘记将 -clearPersistedState 添加到产品的启动选项中。因此,您将看到应用程序模型的增量。如果您要使用基于功能的产品,则应创建一个引用RCP插件的功能插件,并将其作为依赖项添加到产品中。因此,您不必像教程中所述更改运行配置。
答案 1 :(得分:-2)
从我搜索到今天,你不能在纯e4应用程序(org.eclipse.debug.ui
)中使用现有的Eclipse UI插件,如org.eclipse.ui.console
,org.eclipse.e4.ui.workbench.swt.E4Application
等。因此,如果您需要使用现有的UI组件,则必须创建3.x应用程序(实现IApplication
,引用ApplicationWorkbenchAdvisor
,PlatformUI
等)。因此,截至今天,如果要使用现有的UI插件,则必须创建一个3.x RCP,它在兼容层上运行新的4.x运行时。这很简单但很难在任何地方写清楚,我不得不花一些时间搞清楚。不鼓励Eclipse RCP的介绍。