【发布时间】:2015-05-07 05:45:18
【问题描述】:
我有 Eclipse 3.x 开发经验,现在想开发一个 E4 应用程序。因此,我测试了一个简单的示例,以便开始使用新事物。
我一步一步关注this tutorial,但它导致了同样的错误。但是,他没有收到这些错误。
我正在使用 Eclipse Luna (4.4.2) 并安装了 E4 Tools (0.17)。
我创建了一个新的 Eclipse 4 应用程序,并使用 Import 3x -> View as CompatibilityView 将 Common Resource Navigator (Project Explorer) 作为 Shared Part 添加到 Application.e4xmi。然后我添加了一个引用共享部分的 Placeholder。我已将所有必要的插件添加到产品的依赖项中。我还添加了兼容性插件。
但是,当我启动应用程序时,我会在 InjectorImpl#internalMake()#331 收到一个 InjectionException,这就是:
if (unresolved(actualArgs) != -1) continue;
调试unresolved() 让我进入以下几点(InjectorImpl#489):
Creatable creatableAnnotation = desiredClass.getAnnotation(Creatable.class);
desiredClass 是类org.eclipse.ui.internal.ViewReference。
然后该函数返回 1 导致继续大写和异常。堆栈跟踪如下(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)
...
【问题讨论】:
-
这看起来像here 的讨论,它说您只能通过初始化所有 3.x 兼容模式来使用它。 3.x 视图需要很多纯粹的 e4 应用程序中没有的东西。
-
我确实读过这个。 Eclipse 工作人员 (P. Webster) 的唯一回答是 是的,您需要整个 4.2 Workbench(以及它的所有服务)才能正确实例化 3.x IViewPart。 好吧,我添加了一个依赖项
org.eclipse.ui.workbench及其依赖项。线程中的人无法解决此问题,因此未发表评论。 -
是的,但这不会初始化任何东西。据我所知,唯一的方法是使用传统的 3.x RCP
-
我找到的所有教程都在做我所做的并且对他们有用。我安装的 E4 工具是针对
Eclipse 4.3 SDK构建的。但是没有最近的。 tutorial of Lars Vogel (vogella) 也已经过时了。 -
Lars 提到的兼容层是在你使用 3.x RCP 时初始化的,这在 4.4 中没有改变。
标签: java eclipse e4 eclipse-pde