【发布时间】:2013-11-14 17:16:49
【问题描述】:
我有一个菜单,其中有一个绑定到命令的标签。
让我们说:
插件.xml
<menu label="Settings">
<command
commandId="prototype.standalone.MainDirectory"
label="Main">
</command>
</menu>
public class MainDirectory extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// How can I call from here all my business methods from my main View.
// Do I have to use DI? If yes, can you give me an easy example related to this snippet?
return null;
}
}
如评论中所述。我怎样才能调用我的方法?因为如果我从不实例化MainDirectory,那么我也不能只从createControls 传递对象——我认为我必须使用依赖注入,但我不知道如何使用。谁能给我一个例子或其他解决方案
编辑: 或者是否可以在菜单项中添加一个监听器?会让一切变得容易得多。什么都没找到
【问题讨论】:
标签: java swt eclipse-rcp jface