//if only one editor is available then open it
if(nameViewerMap.size()==1){
Command command = nameViewerMap.keySet().iterator().next();
- executeCommand(command.getId(), input);
+ executeCommand(command, input);
}
else{
if(nameViewerMap.isEmpty()){
}
}
- private void executeCommand(String commandId, Object input) {
- ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
- //get the command from plugin.xml
- Command command = commandService.getCommand(commandId);
-
+ private void executeCommand(Command command, Object input) {
//set uuid parameter
if(input instanceof ICdmBase){
Map<String, UUID> params = new HashMap<String, UUID>();
- params.put(commandId+".uuid", ((ICdmBase) input).getUuid());
+ String commandId = command.getId();
+ params.put(commandId+".uuid", ((ICdmBase) input).getUuid());
//build the parameterized command
ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, params);
ISelection selection = event.getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if(firstElement instanceof String && nameViewerMap.containsKey(firstElement)){
- executeCommand((String) firstElement, this.input);
+ if(firstElement instanceof Command && nameViewerMap.containsKey(firstElement)){
+ executeCommand((Command) firstElement, this.input);
this.close();
}
}