I am experienced with Eclipse 3.x development and now want to develop an E4 application. Therefor I tested a simple example in order to get started with the new things.
我对Eclipse 3.x开发很有经验,现在想开发一个E4应用程序。因此,我测试了一个简单的例子,以便开始使用新的东西。
I was following this tutorial step by step but it results in the same error. However, he is not getting those errors.
我一步一步地遵循本教程但导致相同的错误。但是,他没有得到这些错误。
I'm using Eclipse Luna (4.4.2) and installed the E4 Tools (0.17). I've created a new Eclipse 4 Application and added to the Application.e4xmi
the Common Resource Navigator (Project Explorer) as Shared Part using Import 3x -> View as CompatibilityView. I then added a Placeholder which references the shared part. I have added all necessary plugins to the product's dependencies. I also have added the compatibility plugins.
我正在使用Eclipse Luna(4.4.2)并安装了E4 Tools(0.17)。我创建了一个新的Eclipse 4应用程序,并使用Import 3x - > View as CompatibilityView将Application.e4xmi作为共享部件添加到Common Resource Navigator(Project Explorer)。然后我添加了一个引用共享部分的占位符。我已将所有必要的插件添加到产品的依赖项中。我还添加了兼容性插件。
However, when I start the application I get an InjectionException
at InjectorImpl#internalMake()#331
which simply is:
但是,当我启动应用程序时,我在InjectorImpl #internalMake()#331获得了一个InjectionException,它只是:
if (unresolved(actualArgs) != -1) continue;
Debugging unresolved()
let me to the following point (InjectorImpl#489
):
调试unresolved()让我到以下几点(InjectorImpl#489):
Creatable creatableAnnotation = desiredClass.getAnnotation(Creatable.class);
Where the desiredClass
is class org.eclipse.ui.internal.ViewReference
. Then the function returns 1 which leads to continue in the upper case and the exception. The stacktrace is the following (full here):
其中desiredClass是类org.eclipse.ui.internal.ViewReference。然后函数返回1,导致继续大写和异常。 stacktrace如下(在这里完整):
!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)
...
2 个解决方案
#1
To solve this problem, I had to follow this awesome tutorial. As @greg-449 already mentioned you've to use an 3.x RCP and put an e4 aware product on top of it. Then the compatibility layer will be initialized. Thus, you have to do the following (the tutorial describes it in detail):
要解决这个问题,我必须遵循这个很棒的教程。正如@ greg-449已经提到的那样,你必须使用3.x RCP并在其上放置一个e4感知产品。然后将初始化兼容层。因此,您必须执行以下操作(教程详细描述):
- create an Ecliplse-Plugin which for Eclipse 3.5 or newer
- Tick Will make contributions to the UI
- Use the Hello World RCP to generate the required extension points
- Ctrl+N -> Eclipse 4 -> Model -> New Application Model
- Add an extension point
- Ctrl+N -> Plug-in Development -> Product Configuration
为Eclipse 3.5或更新版本创建一个Ecliplse-Plugin
Tick将为UI做出贡献
使用Hello World RCP生成所需的扩展点
Ctrl + N - > Eclipse 4 - >模型 - >新应用程序模型
添加扩展点
Ctrl + N - >插件开发 - >产品配置
The rest is described in the linked tutorial. Do not forget to add -clearPersistedState to the Launching options of the product. So you will see your deltas of your application model. If you are going to use a feature based product you should create a feature plugin which references your RCP plugin and add it as dependency to the product. Thus, you don't have to change the run configuration as described in the tutorial.
其余部分在链接教程中进行了描述。不要忘记将-clearPersistedState添加到产品的Launching选项中。因此,您将看到应用程序模型的增量。如果您要使用基于功能的产品,则应创建一个引用RCP插件的功能插件,并将其作为依赖项添加到产品中。因此,您不必像教程中所述更改运行配置。
#2
From what I have searched till today, you cannot use existing Eclipse UI plugins like org.eclipse.debug.ui
, org.eclipse.ui.console
, etc in a pure e4 application (org.eclipse.e4.ui.workbench.swt.E4Application
). So if you need to use existing UI components you have to create a 3.x application (implements IApplication
, references ApplicationWorkbenchAdvisor
, PlatformUI
etc). So as of today if you want to use existing UI plugins you have to create a 3.x RCP which runs over the compatibility layer with the new 4.x runtime. This is so simple but hardly written clearly anywhere and I had to spend some time figuring it out. Discouraging introduction to Eclipse RCP.
从我搜索到今天,您不能在纯e4应用程序(org.eclipse.e4.ui.workbench.swt)中使用现有的Eclipse UI插件,如org.eclipse.debug.ui,org.eclipse.ui.console等。 .E4Application)。因此,如果您需要使用现有的UI组件,则必须创建3.x应用程序(实现IApplication,引用ApplicationWorkbenchAdvisor,PlatformUI等)。因此,截至今天,如果要使用现有的UI插件,则必须创建一个3.x RCP,它在兼容层上运行新的4.x运行时。这很简单但很难在任何地方写清楚,我不得不花一些时间搞清楚。不鼓励Eclipse RCP的介绍。
#1
To solve this problem, I had to follow this awesome tutorial. As @greg-449 already mentioned you've to use an 3.x RCP and put an e4 aware product on top of it. Then the compatibility layer will be initialized. Thus, you have to do the following (the tutorial describes it in detail):
要解决这个问题,我必须遵循这个很棒的教程。正如@ greg-449已经提到的那样,你必须使用3.x RCP并在其上放置一个e4感知产品。然后将初始化兼容层。因此,您必须执行以下操作(教程详细描述):
- create an Ecliplse-Plugin which for Eclipse 3.5 or newer
- Tick Will make contributions to the UI
- Use the Hello World RCP to generate the required extension points
- Ctrl+N -> Eclipse 4 -> Model -> New Application Model
- Add an extension point
- Ctrl+N -> Plug-in Development -> Product Configuration
为Eclipse 3.5或更新版本创建一个Ecliplse-Plugin
Tick将为UI做出贡献
使用Hello World RCP生成所需的扩展点
Ctrl + N - > Eclipse 4 - >模型 - >新应用程序模型
添加扩展点
Ctrl + N - >插件开发 - >产品配置
The rest is described in the linked tutorial. Do not forget to add -clearPersistedState to the Launching options of the product. So you will see your deltas of your application model. If you are going to use a feature based product you should create a feature plugin which references your RCP plugin and add it as dependency to the product. Thus, you don't have to change the run configuration as described in the tutorial.
其余部分在链接教程中进行了描述。不要忘记将-clearPersistedState添加到产品的Launching选项中。因此,您将看到应用程序模型的增量。如果您要使用基于功能的产品,则应创建一个引用RCP插件的功能插件,并将其作为依赖项添加到产品中。因此,您不必像教程中所述更改运行配置。
#2
From what I have searched till today, you cannot use existing Eclipse UI plugins like org.eclipse.debug.ui
, org.eclipse.ui.console
, etc in a pure e4 application (org.eclipse.e4.ui.workbench.swt.E4Application
). So if you need to use existing UI components you have to create a 3.x application (implements IApplication
, references ApplicationWorkbenchAdvisor
, PlatformUI
etc). So as of today if you want to use existing UI plugins you have to create a 3.x RCP which runs over the compatibility layer with the new 4.x runtime. This is so simple but hardly written clearly anywhere and I had to spend some time figuring it out. Discouraging introduction to Eclipse RCP.
从我搜索到今天,您不能在纯e4应用程序(org.eclipse.e4.ui.workbench.swt)中使用现有的Eclipse UI插件,如org.eclipse.debug.ui,org.eclipse.ui.console等。 .E4Application)。因此,如果您需要使用现有的UI组件,则必须创建3.x应用程序(实现IApplication,引用ApplicationWorkbenchAdvisor,PlatformUI等)。因此,截至今天,如果要使用现有的UI插件,则必须创建一个3.x RCP,它在兼容层上运行新的4.x运行时。这很简单但很难在任何地方写清楚,我不得不花一些时间搞清楚。不鼓励Eclipse RCP的介绍。