0

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

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

我想在处理程序中调用 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来执行它。

4

1 回答 1

0

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

IHandlerService service = window.getService(IHandlerService.class);

service.executeCommand("command id", null);
于 2018-07-20T08:37:41.170 回答