/** * Executes this command with its parameters. This method will succeed * regardless of whether the command is enabled or defined. It is * preferrable to use {@link #executeWithChecks(Object, Object)}. * * @param trigger * The object that triggered the execution; may be * <code>null</code>. * @param applicationContext * The state of the application at the time the execution was * triggered; may be <code>null</code>. * @return The result of the execution; may be <code>null</code>. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotHandledException * If there is no handler. * @deprecated Please use {@link #executeWithChecks(Object, Object)} * instead. */ @Deprecated public final Object execute(final Object trigger, final Object applicationContext) throws ExecutionException, NotHandledException { return command.execute(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
/** * Executes this command with its parameters. This method will succeed * regardless of whether the command is enabled or defined. It is * preferrable to use {@link #executeWithChecks(Object, Object)}. * * @param trigger * The object that triggered the execution; may be * <code>null</code>. * @param applicationContext * The state of the application at the time the execution was * triggered; may be <code>null</code>. * @return The result of the execution; may be <code>null</code>. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotHandledException * If there is no handler. * @deprecated Please use {@link #executeWithChecks(Object, Object)} * instead. */ @Deprecated public Object execute(final Object trigger, final Object applicationContext) throws ExecutionException, NotHandledException { return command.execute(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
/** * Executes this command with its parameters. This method will succeed * regardless of whether the command is enabled or defined. It is * preferrable to use {@link #executeWithChecks(Object, Object)}. * * @param trigger * The object that triggered the execution; may be * <code>null</code>. * @param applicationContext * The state of the application at the time the execution was * triggered; may be <code>null</code>. * @return The result of the execution; may be <code>null</code>. * @throws ExecutionException * If the handler has problems executing this command. * @throws NotHandledException * If there is no handler. * @deprecated Please use {@link #executeWithChecks(Object, Object)} * instead. */ @Deprecated public final Object execute(final Object trigger, final Object applicationContext) throws ExecutionException, NotHandledException { return command.execute(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
@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? } }