RCP Command with object argument

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:24:43

问题


I want to call an RCP command in code, like this:

IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IHandlerService handlerService = (IHandlerService)window.getService(IHandlerService.class);
    handlerService.executeCommand(cmdID, null);

With considerably more code, I can call the command with a string argument by assembling a Parameterization object then building a ParameterizedCommand and so forth but Paramaterization only allows for string values, and can't be subclassed.

What I really want to do is call the command with an object as a parameter. How can I do this?


回答1:


Use ParameterizedCommand.generateCommand(). You can pass the command object (obtained from ICommandService) and the parameters in a map.



来源:https://stackoverflow.com/questions/3599269/rcp-command-with-object-argument

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!