[英]Eclipse command to close/start my plugin
因此,我正在开发我的第一个Eclipse插件,并且希望能够关闭(或停用)该插件。
现在,我在这里和那里阅读了有关绑定和命令的信息,我设法使binding(CTRL + 4)出现在Eclipse-> Preferences-> Keys中 。
但是似乎不知道如何从实现IHandler的类中实现execute方法来实际关闭我的插件。
在下面的代码中,您可以看到我尝试显示的内容,但是它们也没有用。
<extension
point="org.eclipse.ui.commands">
<category
id="com.myplugin.myCategory"
name="Category"
description="a description">
</category>
<command
defaultHandler="mypackage.ExitHandler"
id="myproject.exit"
categoryId="com.myplugin.myCategory"
name="Close Plugin">
</command>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="myproject.exit"
contextId="org.eclipse.ui.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+4">
</key>
</extension>
public class ExitHandler implements IHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
MessageDialog.openInformation(HandlerUtil.getActiveWorkbenchWindow(
event).getShell(), "Info", "Info for you");
System.out.println("I wanna exittttttttttttttt");
return null;
}
}
那么关于如何关闭然后启动使用此方法创建的插件的任何想法吗? 如果仅实现execute方法,就足够了吗?
担
解
因此,正如Gred在下面的评论中所述,我应该扩展org.eclipse.core.commands.AbstractHandler
并实现execute
方法。
解
因此,正如Gred在下面的评论中所述,我应该扩展org.eclipse.core.commands.AbstractHandler并实现execute方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.