@Override public void interactorDeactivated(Interactor interactor) { setSelected(false); } }
public ToolCommand(String commandID, CommandStateListener listener, Interactor interactor) { this(commandID); setInteractor(interactor); addCommandStateListener(listener); }
/** * Adds a command state listener. * * @param l the command listener */ public void addCommandStateListener(CommandStateListener l) { addEventListener(CommandStateListener.class, l); }
private void setSelectToolSelectState(CommandManager commandManager) { Command selectTool = commandManager.getCommand("selectTool"); if (selectTool instanceof ToolCommand) { ToolCommand toolCommand = (ToolCommand) selectTool; selectionInteractor = toolCommand.getInteractor(); setActiveInteractor(selectionInteractor); toolCommand.setSelected(true); } }
/** * Creates a tool bar button for the given tool command. * * @param command the tool command, must not be <code>null</code> * * @return the tool bar button */ public AbstractButton createToolBarButton(ToolCommand command) { AbstractButton button = ToolButtonFactory.createButton(command.getAction(), true); button.setName(command.getCommandID()); button.setSelected(command.isSelected()); installMutualExclusiveInterest(button, command); return button; }
/** * Creates a menu item (a <code>JMenuItem</code> or <code>JCheckBoxMenuItem</code> instance) for this command * group. */ @Override public JMenuItem createMenuItem() { return getCommandUIFactory().createMenuItem(this); }
/** * Invoked when an action occurs. */ @Override public void actionPerformed(ActionEvent actionEvent) { fireActionPerformed(actionEvent, null); } };
@Override public void configure(ConfigurationElement config) throws CoreException { configureInteractor(config); super.configure(config); }
/** * Creates a new tool command for the given unique command ID an the given tool. * Finally the created command is added to internal list of registered commands. * * @param commandID a unique command ID * @param listener the command state listener used to update the tool command's state * @param tool the tool which executes the command and updates its state * * @return a new tool command * * @see #createExecCommand * @see #createCommandGroup * @see #addCommand(Command) */ @Override public ToolCommand createToolCommand(String commandID, CommandStateListener listener, Interactor tool) { Guardian.assertNotNullOrEmpty("commandID", commandID); Guardian.assertNotNull("tool", tool); ToolCommand command = new ToolCommand(commandID, listener, tool); addCommand(command); return command; }
/** * Creates an appropriate tool bar button for this command. */ @Override public AbstractButton createToolBarButton() { return getCommandUIFactory().createToolBarButton(this); }
@Override public void interactorActivated(Interactor interactor) { setSelected(true); }