public RoiMaskSelector(BindingContext bindingContext) { this(bindingContext, VisatApp.getApp().getCommandManager().getCommand("org.esa.beam.visat.toolviews.mask.MaskManagerToolView.showCmd").createToolBarButton()); }
/** * Creates a tool button for the tool-command with the given command ID. * <p/> * <p>A command with the given ID must already been registered using any of the <code>createToolCommand</code> * methods of VisatApp, or directly using the <code>createToolCommand</code> method of VISAT's {@link * CommandManager}. Otherwise an {@link IllegalArgumentException} will be thrown. * <p/> * <p>The new button is which is automatically added to VISAT's tool button group to ensure that a only single tool * is selected. * * @param commandID the command ID * @return a tool button which is automatically added to VISAT's tool button group. * @see #getCommandManager */ public AbstractButton createToolButton(final String commandID) { final Command command = getCommandManager().getCommand(commandID); Guardian.assertNotNull("command", command); return command.createToolBarButton(); }
protected final void insertCommandToolBarButtons(JToolBar toolbar) { String[] toolBarGroups = getToolBarGroups(); if (toolBarGroups == null) { return; } boolean toolAdded = false; for (String toolBarGroup : toolBarGroups) { if (toolAdded) { toolbar.addSeparator(); toolAdded = false; } for (int j = 0; j < commandManager.getNumCommands(); j++) { Command command = commandManager.getCommandAt(j); // @todo 2 nf/nf - ask whether location=toolbar or not if (command instanceof ExecCommand && command.getLargeIcon() != null) { String rootParent = findRootParent(command); if ((rootParent == null && toolBarGroup == null) || (rootParent != null && rootParent.equalsIgnoreCase(toolBarGroup))) { AbstractButton button = command.createToolBarButton(); if (button != null) { toolbar.add(button); } toolAdded = true; } } } } }
protected void addCommandsToToolBar(final CommandBar toolBar, final String[] commandIDs) { for (final String commandID : commandIDs) { if (commandID == null) { toolBar.add(ToolButtonFactory.createToolBarSeparator()); } else { final Command command = getCommandManager().getCommand(commandID); if (command != null) { final AbstractButton toolBarButton = command.createToolBarButton(); toolBarButton.addMouseListener(getMouseOverActionHandler()); toolBar.add(toolBarButton); } else { getLogger().warning(String.format("Toolbar '%s': No command found for ID = '%s'", toolBar.getName(), commandID)); } } toolBar.add(Box.createHorizontalStrut(1)); } }
topPanel.add(refreshButton, BorderLayout.WEST); AbstractButton showMaskManagerButton = VisatApp.getApp().getCommandManager().getCommand("org.esa.beam.visat.toolviews.mask.MaskManagerToolView.showCmd").createToolBarButton();