问题描述
大多数现有的Eclipse插件使用扩展注册表和 ViewPart
的子类,再加上兼容性层。因此,编写新视图(特别是在PDE中使用新的插件向导)会导致插件看起来像: <插件>
< extension point =org.eclipse.ui.views>
< view name =示例视图class =org.example.ExampleView/>
< / extension>
< / plugin>
public class ExampleView extends ViewPart {
public void createPartControl(Composite parent){
...
}
}
是否可以利用E4编程模型创建一个视图,如:
public class示例{
@Inject
public示例(复合父项){
...
}
并将其挂接到现有的Eclipse 4.2实例中,以便它显示在显示查看菜单?如果是这样,它如何声明性地连接(因为 LegacyIDE.e4xmi
是不可变的,不能添加到)。
Most of the existing Eclipse plug-ins use the extension registry and subclasses of ViewPart
, coupled with the compatibility layer. As a result, writing a new view (especially using the new plug-in wizard in PDE) results in plug-ins that look like:
<plugin>
<extension point="org.eclipse.ui.views">
<view name="Example View" class="org.example.ExampleView"/>
</extension>
</plugin>
public class ExampleView extends ViewPart {
public void createPartControl(Composite parent) {
...
}
}
Is it possible to take advantage of the E4 programming model to create a view like:
public class Example {
@Inject
public Example(Composite parent) {
...
}
}
and have that hooked into an existing Eclipse 4.2 instance, so that it shows up in the 'Show View' menu? If so, how is it declaratively wired in (since that the LegacyIDE.e4xmi
is immutable and can't be added to).
Look at the code I've written for the e4 model editor (http://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/tree/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x).
I've a set of wrappers for this at http://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/tree/bundles/org.eclipse.e4.tools.compat for 4.3 we plan on direct support.
这篇关于如何使用E4编程模型创建一个视图作为Eclipse 4.2或更高版本的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!