【发布时间】:2016-02-10 08:07:06
【问题描述】:
我在将 E3-RCP-Application 迁移到 E4 时遇到问题。 在那里我得到了 3 个部分。 2 与 Lars Vogel 的示例内容(http://www.vogella.com/tutorials/EclipseRCP/article.html#plugin_creatinge4“使用 SWT 电源小部件”)进行测试并与我的部分进行比较。
长话短说(呃):应该创建视图内容的方法,标记为@PostConstruct,不会被调用,但 SampleContent 的 @PostConstruct 会。这可能有什么原因? MyView 的构造函数被调用。
我的视图结构如下:
Many Imports
public class MyView1 implements IRefreshableView, ISomeListener {
a lot of fields, some are injected...
public MyView1() {
reference to the Activator-Class to get some item.
}
@PostConstruct
public void createControls(Composite parent) {
createViewToolbar();``
and much more Part Creation stuff that won´t be invoked...
}
much more methods
@Focus
public void setFocus() {
if (treeViewer.getTree().isVisible()) {
treeViewer.getTree().setFocus();
} else {
mainForm.setFocus();
}
}
}
new class definition in the same file.
END
很抱歉没有发布整个代码,它就像 1000 行一样长:/
我在 Win7 上使用 Mars 4.5.1
【问题讨论】:
-
这个类是如何创建的?它是否列为 Application.e4xmi 的一部分?
-
没错。类 URI 指向 MyView1 类。以及ID是一样的
-
可能注入器在您未显示的某些字段上遇到问题。查看工作区.metadata目录下的.log文件,看看是否有更详细的消息
-
不要担心代表,帮助是主要的。
-
我添加了一个答案来帮助其他有类似问题的人。
标签: eclipse eclipse-plugin eclipse-rcp e4