public TextParameterControl(IParameter parameter, Text parameterText) { fParameter = parameter; fParameterText = parameterText; fParameterText.addModifyListener(this); if (fPreSel != null) { Object obj = fPreSel.getParameterMap().get(parameter.getId()); if (obj != null) fParameterText.setText(obj.toString()); } }
public ObjectParameterControl(IParameter parameter, AbstractParameterValueConverter valueConverter, Text parameterText, Object selectedObject) { fParameter = parameter; fValueConverter = valueConverter; fParameterText = parameterText; fParameterText.addModifyListener(this); if (selectedObject != null) setParameterText(selectedObject); if (fPreSel != null) { Object obj = fPreSel.getParameterMap().get(parameter.getId()); if (obj != null) fParameterText.setText(obj.toString()); } }
public ValuesParameterControl(IParameter parameter, Map<?, ?> values, Combo valuesCombo, Button clearButton) { fParameter = parameter; fValues = values; fValuesCombo = valuesCombo; fValuesCombo.addModifyListener(this); if (fPreSel != null && fValues != null) { Object obj = fPreSel.getParameterMap().get(parameter.getId()); if (obj != null) { for (Entry<?, ?> entry : fValues.entrySet()) { if (obj.equals(entry.getValue())) { fValuesCombo.setText(entry.getKey().toString()); break; } } } } fClearButton = clearButton; fClearButton.addSelectionListener(this); }
/** * 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)); }
/** * Fill in a temporary static context for execution. * * @param command */ @SuppressWarnings("rawtypes") private void addParms(ParameterizedCommand command, IEclipseContext staticContext) { final Map parms = command.getParameterMap(); Iterator i = parms.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); String parameterId = (String) entry.getKey(); staticContext.set( parameterId, convertParameterValue(command.getCommand(), parameterId, (String) entry.getValue())); } staticContext.set(PARM_MAP, parms); staticContext.set(ParameterizedCommand.class, command); }
/** * Executes this command with its parameters. This does extra checking to * see if the command is enabled and defined. If it is not both enabled and * defined, then the execution listeners will be notified and an exception * thrown. * * @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 NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.2 */ public final Object executeWithChecks(final Object trigger, final Object applicationContext) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { return command.executeWithChecks(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
/** * Executes this command with its parameters. This does extra checking to * see if the command is enabled and defined. If it is not both enabled and * defined, then the execution listeners will be notified and an exception * thrown. * * @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 NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.2 */ public final Object executeWithChecks(final Object trigger, final Object applicationContext) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { return command.executeWithChecks(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
/** * Executes this command with its parameters. This does extra checking to * see if the command is enabled and defined. If it is not both enabled and * defined, then the execution listeners will be notified and an exception * thrown. * * @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 NotDefinedException * If the command you are trying to execute is not defined. * @throws NotEnabledException * If the command you are trying to execute is not enabled. * @throws NotHandledException * If there is no handler. * @since 3.2 */ public Object executeWithChecks(final Object trigger, final Object applicationContext) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { return command.executeWithChecks(new ExecutionEvent(command, getParameterMap(), trigger, applicationContext)); }
private void updateState() { if (styleState != null) { model.setSelected(((Boolean) styleState.getValue()).booleanValue()); } else if (toggleState != null) { model.setSelected(((Boolean) toggleState.getValue()).booleanValue()); } else if (radioState != null && model.getWbCommand() != null) { ParameterizedCommand c = model.getWbCommand(); Object parameter = c.getParameterMap().get( ORG_ECLIPSE_UI_COMMANDS_RADIO_STATE_PARAMETER); String value = (String) radioState.getValue(); model.setSelected(value != null && value.equals(parameter)); } }
@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; }
private void updateState() { if (styleState != null) { getModel().setSelected(((Boolean) styleState.getValue()).booleanValue()); } else if (toggleState != null) { getModel().setSelected(((Boolean) toggleState.getValue()).booleanValue()); } else if (radioState != null && getModel().getWbCommand() != null) { ParameterizedCommand c = getModel().getWbCommand(); Object parameter = c.getParameterMap().get(ORG_ECLIPSE_UI_COMMANDS_RADIO_STATE_PARAMETER); String value = (String) radioState.getValue(); getModel().setSelected(value != null && value.equals(parameter)); } }
} else { Map<?, ?> m = binding.getParameterizedCommand().getParameterMap(); String key = null; if (CustomizePerspectiveDialog.isNewWizard(item)) {
if (parameterizedCommand != null) { final Map parameterizations = parameterizedCommand .getParameterMap(); final Iterator parameterizationItr = parameterizations.entrySet() .iterator();
@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? } }
keyBinding.setKeySequence(binding.getTriggerSequence().toString()); for (Object obj : parmCmd.getParameterMap().entrySet()) { @SuppressWarnings({ "unchecked" }) Map.Entry<String, String> entry = (Map.Entry<String, String>) obj;
@Override public IElementReference registerElementForCommand( ParameterizedCommand command, UIElement element) throws NotDefinedException { if (!command.getCommand().isDefined()) { throw new NotDefinedException( "Cannot define a callback for undefined command " //$NON-NLS-1$ + command.getCommand().getId()); } if (element == null) { throw new NotDefinedException("No callback defined for command " //$NON-NLS-1$ + command.getCommand().getId()); } ElementReference ref = new ElementReference(command.getId(), element, command.getParameterMap()); registerElement(ref); return ref; }
@Override public IElementReference registerElementForCommand( ParameterizedCommand command, UIElement element) throws NotDefinedException { if (!command.getCommand().isDefined()) { throw new NotDefinedException( "Cannot define a callback for undefined command " //$NON-NLS-1$ + command.getCommand().getId()); } if (element == null) { throw new NotDefinedException("No callback defined for command " //$NON-NLS-1$ + command.getCommand().getId()); } ElementReference ref = new ElementReference(command.getId(), element, command.getParameterMap()); registerElement(ref); return ref; }