【问题标题】:Calling a command id in the handler of plugin在插件的处理程序中调用命令 id
【发布时间】:2018-12-28 12:22:54
【问题描述】:

我有一个触发 Run(Ctrl + F11)

的菜单

但我想做比跑步更多的动作。

我想在handler中调用run的命令id

public class CheckCodesHandler extends AbstractHandler{

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

        /*
         * call the commandid = org.eclipse.debug.ui.runLast here?????
         * */
        return null;
    }
}

到目前为止,我只是调用了plugin.xml中的命令id来执行它。

【问题讨论】:

    标签: java eclipse plugin.xml


    【解决方案1】:

    对于不需要参数的简单命令,您可以使用

    IHandlerService service = window.getService(IHandlerService.class);
    
    service.executeCommand("command id", null);
    

    【讨论】:

      猜你喜欢
      • 2023-03-23
      • 1970-01-01
      • 2012-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多