@Override public void handlerChanged(HandlerEvent handlerEvent) { boolean enabledChanged = handlerEvent.isEnabledChanged(); boolean handledChanged = handlerEvent.isHandledChanged(); fireCommandChanged(new CommandEvent(Command.this, false, false, false, handledChanged, false, false, false, false, enabledChanged)); } };
@Override public String getDescription() { try { return command.getCommand().getDescription(); } catch (final NotDefinedException e) { return null; } }
private static void noVariableFound(ExecutionEvent event, String name) throws ExecutionException { throw new ExecutionException("No " + name //$NON-NLS-1$ + " found while executing " + event.getCommand().getId()); //$NON-NLS-1$ }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public String getName() throws NotDefinedException { return getName(command.getName()); }
@Override public int getStyle() { // TODO Pulldown. This does not currently support the pulldown style. final State state = command.getCommand().getState(IMenuStateIds.STYLE); if (state instanceof RadioState) { return IAction.AS_RADIO_BUTTON; } else if (state instanceof ToggleState) { return IAction.AS_CHECK_BOX; } return IAction.AS_PUSH_BUTTON; }
@Override public boolean isHandled() { final Command baseCommand = command.getCommand(); return baseCommand.isHandled(); }
@Override public Category defineCategory(String id, String name, String description) { Category cat = commandManager.getCategory(id); if (!cat.isDefined()) { cat.define(name, description); } return cat; }
public void dispose() { // not important for command ID, maybe for command though. handlerService = null; if (commandListener != null) { parameterizedCommand.getCommand().removeCommandListener( commandListener); commandListener = null; } parameterizedCommand = null; }
@Override public boolean isEnabled() { if (partHandler != null) { if (partHandler instanceof IHandler2) { ((IHandler2) partHandler).setEnabled(appContext); } return partHandler.isEnabled(); } return false; }
@Override public void undefine() { string = null; final boolean definedChanged = defined; defined = false; final boolean nameChanged = name != null; name = null; final boolean descriptionChanged = description != null; description = null; fireCategoryChanged(new CategoryEvent(this, definedChanged, descriptionChanged, nameChanged)); }
/** * Notifies listeners to this state that it has changed in some way. * * @param oldValue * The old value; may be anything. */ protected final void fireStateChanged(final Object oldValue) { for (Object listener : getListeners()) { final IStateListener stateListener = (IStateListener) listener; stateListener.handleStateChange(this, oldValue); } }
/** * Makes this parameter type become undefined. Notification is sent to all * listeners. */ @Override public final void undefine() { string = null; final boolean definedChanged = defined; defined = false; type = null; parameterTypeConverter = null; fireParameterTypeChanged(new ParameterTypeEvent(this, definedChanged)); }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public final String getName() throws NotDefinedException { return getName(command.getName()); }
@Override public void handlerChanged(HandlerEvent handlerEvent) { boolean enabledChanged = handlerEvent.isEnabledChanged(); boolean handledChanged = handlerEvent.isHandledChanged(); fireCommandChanged(new CommandEvent(Command.this, false, false, false, handledChanged, false, false, false, false, enabledChanged)); } };
@Override public void undefine() { string = null; final boolean definedChanged = defined; defined = false; final boolean nameChanged = name != null; name = null; final boolean descriptionChanged = description != null; description = null; fireCategoryChanged(new CategoryEvent(this, definedChanged, descriptionChanged, nameChanged)); }
/** * Makes this parameter type become undefined. Notification is sent to all * listeners. */ @Override public final void undefine() { string = null; final boolean definedChanged = defined; defined = false; type = null; parameterTypeConverter = null; fireParameterTypeChanged(new ParameterTypeEvent(this, definedChanged)); }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public final String getName() throws NotDefinedException { return getName(command.getName()); }
@Override public void handlerChanged(HandlerEvent handlerEvent) { boolean enabledChanged = handlerEvent.isEnabledChanged(); boolean handledChanged = handlerEvent.isHandledChanged(); fireCommandChanged(new CommandEvent(Command.this, false, false, false, handledChanged, false, false, false, false, enabledChanged)); } };
@Override public void undefine() { string = null; final boolean definedChanged = defined; defined = false; final boolean nameChanged = name != null; name = null; final boolean descriptionChanged = description != null; description = null; fireCategoryChanged(new CategoryEvent(this, definedChanged, descriptionChanged, nameChanged)); }