use of org.eclipse.core.commands.ParameterizedCommand in project translationstudio8 by heartsome.
the class KeyAssistHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbench workbench = PlatformUI.getWorkbench();
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
BindingService service = (BindingService) bindingService;
ArrayList<Binding> lstBinding = new ArrayList<Binding>(Arrays.asList(bindingService.getBindings()));
List<String> lstRemove = Constants.lstRemove;
Iterator<Binding> it = lstBinding.iterator();
while (it.hasNext()) {
Binding binding = it.next();
ParameterizedCommand pCommand = binding.getParameterizedCommand();
if (pCommand == null || lstRemove.contains(pCommand.getCommand().getId())) {
it.remove();
}
}
service.getKeyboard().openKeyAssistShell(lstBinding);
return null;
}
use of org.eclipse.core.commands.ParameterizedCommand in project eclipse.platform.text by eclipse.
the class ShowInSystemExplorerHyperlink method open.
@Override
public void open() {
ECommandService commandService = PlatformUI.getWorkbench().getService(ECommandService.class);
EHandlerService handlerService = PlatformUI.getWorkbench().getService(EHandlerService.class);
Command command = commandService.getCommand(ShowInSystemExplorerHandler.ID);
if (command.isDefined()) {
ParameterizedCommand parameterizedCommand = commandService.createCommand(ShowInSystemExplorerHandler.ID, Collections.singletonMap(ShowInSystemExplorerHandler.RESOURCE_PATH_PARAMETER, fileLocation));
if (handlerService.canExecute(parameterizedCommand)) {
handlerService.executeHandler(parameterizedCommand);
}
}
}
Aggregations