如何使用E4编程模型创建一个视图作为Eclipse 4.2或更高版本的插件? [英] How can I create a view using the E4 programming model to be a plug-in for Eclipse 4.2 or above?

查看:313
本文介绍了如何使用E4编程模型创建一个视图作为Eclipse 4.2或更高版本的插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数现有的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 是不可变的,不能添加到)。



我在 4.3,我们计划直接支持。


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或更高版本的插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆