@Override public final void run(final IAction action) { try { execute(new ExecutionEvent()); } catch (final ExecutionException e) { // TODO Do something meaningful and poignant. } }
/** * This simply calls execute with a <code>null</code> map of parameter * values. If an <code>ExecutionException</code> occurs, then this should * be handle somehow. It's not clear what we'll do yet. * * @param action * The action proxy that handles the presentation portion of the * action * @see org.eclipse.ui.IActionDelegate#run(IAction) */ @Override public void run(final IAction action) { try { execute(new ExecutionEvent()); } catch (final ExecutionException e) { // TODO Do something meaningful and poignant. } }
IServiceLocator serviceLocator = PlatformUI.getWorkbench(); ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); try { Command command = commandService.getCommand("my_command_id"); Map<String, String> map = new HashMap<String, String>(); map.put("param_name", "param_value"); /*more parameter's can be added to Map and passed*/ command.executeWithChecks(new ExecutionEvent(null, map, null, null)); } catch (ExecutionException e1) { } catch (NotDefinedException e2){ } catch(NotEnabledException e3){ } catch(NotHandledException e4){ }
IServiceLocator serviceLocator = PlatformUI.getWorkbench(); ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); try { Command command = commandService.getCommand("de.xx.mycommand"); command.executeWithChecks(new ExecutionEvent()); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { e.printStackTrace(); }
@Override public ExecutionEvent createExecutionEvent(Command command, Event event) { EvaluationContext legacy = new EvaluationContext(evalContext, evalContext.getDefaultVariable()); ExecutionEvent e = new ExecutionEvent(command, Collections.EMPTY_MAP, event, legacy); return e; }
@Override public void run() { try { mergeHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
@Override public void run() { try { markAsMergedHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
public void run() { try { mergeHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
@Override public void run() { try { markAsMergedHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
public void run() { try { markAsMergedHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
@Override public void run() { try { mergeHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } } };
public void run() { try { overwriteHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
@Override public void run() { try { overwriteHandler.execute(new ExecutionEvent()); } catch (ExecutionException e) { TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } }
public void preExecute(IAction action, Event event) { String actionDefinitionId = action.getActionDefinitionId(); if (actionDefinitionId==null || !applicabilityChecker.isApplicable(action)) { return; } Command command = commandManager.getCommand(actionDefinitionId); ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, event, null); commandManager.firePreExecute(actionDefinitionId, executionEvent); }
@Override public ExecutionEvent createExecutionEvent(ParameterizedCommand command, Event event) { EvaluationContext legacy = new EvaluationContext(evalContext, evalContext.getDefaultVariable()); ExecutionEvent e = new ExecutionEvent(command.getCommand(), command.getParameterMap(), event, legacy); return e; }
/** * Executes the search. */ private void executeSearch() { String searchString = searchText.getText(); if (StringUtils.isNotBlank(searchString)) { ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); IEvaluationService evaluationService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class); try { Command searchCommand = commandService.getCommand("rocks.inspectit.ui.rcp.commands.searchDocumentation"); Map<String, String> params = new HashMap<>(); params.put(SearchDocumentationHandler.SEARCH_DOCUMENTATION_PARAMETER, searchString); searchCommand.executeWithChecks(new ExecutionEvent(searchCommand, params, searchText, evaluationService.getCurrentState())); } catch (Exception e) { InspectIT.getDefault().createErrorDialog("There was an exception executing the wiki search.", e, -1); } } } }
/** * @since 3.4 */ @Override public void preExecute(IAction action, Event event) { String actionDefinitionId = action.getActionDefinitionId(); if (actionDefinitionId==null || !applicabilityChecker.isApplicable(action)) { return; } Command command = commandManager.getCommand(actionDefinitionId); ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, event, null); commandManager.firePreExecute(actionDefinitionId, executionEvent); }
/** * @since 3.4 */ @Override public void preExecute(IAction action, Event event) { String actionDefinitionId = action.getActionDefinitionId(); if (actionDefinitionId==null || !applicabilityChecker.isApplicable(action)) { return; } Command command = commandManager.getCommand(actionDefinitionId); ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, event, null); commandManager.firePreExecute(actionDefinitionId, executionEvent); }
@Override public Object execute(Map parameterValuesByName) throws ExecutionException, NotHandledException { try { IHandlerService service = PlatformUI.getWorkbench().getService( IHandlerService.class); return command.execute(new ExecutionEvent(command, (parameterValuesByName == null) ? Collections.EMPTY_MAP : parameterValuesByName, null, service.getCurrentState())); } catch (final org.eclipse.core.commands.ExecutionException e) { throw new ExecutionException(e); } catch (final org.eclipse.core.commands.NotHandledException e) { throw new NotHandledException(e); } }
@Override public void runWithEvent(final Event event) { final Command baseCommand = command.getCommand(); final ExecutionEvent executionEvent = new ExecutionEvent(command .getCommand(), command.getParameterMap(), event, null); try { baseCommand.execute(executionEvent); firePropertyChange(IAction.RESULT, null, Boolean.TRUE); } catch (final NotHandledException e) { firePropertyChange(IAction.RESULT, null, Boolean.FALSE); } catch (final ExecutionException e) { firePropertyChange(IAction.RESULT, null, Boolean.FALSE); // TODO Should this be logged? } }