public void addConfigurationAction( String category, ConfigurationAction<?> action, Activator activator) { JCheckBoxMenuItem item = MenuBar.makeMenuItem(action.getValue(Action.NAME).toString(), JCheckBoxMenuItem.class); menuBar.addItem(category, item); item.setToolTipText(action.getValue(Action.SHORT_DESCRIPTION).toString()); item.setIcon((Icon) action.getValue(Action.SMALL_ICON)); if (activator != null) { registerComponent(item, activator); } item.addActionListener(action); enableComponents.registerConfigurationAction(action, item); }
public void addAction(String category, Action action, Activator activator) { if (action != null) { String iconName = (String) action.getValue(Actions.ICON_NAME); if (iconName != null) { Icon icon = Icons.getIcon(iconName); action.putValue(Action.SMALL_ICON, icon); } } JMenuItem item = menuBar.addAction(category, action, -1); if (activator != null) { registerComponent(item, activator); } }
// TODO // change into addToggleAction public void addPredicateAction( String category, String name, String description, String tooltip, Icon icon, final Predicate predicate, boolean initialValue) { final JCheckBoxMenuItem checkBox = MenuBar.makeMenuItem(name, JCheckBoxMenuItem.class); checkBox.setIcon(icon); checkBox.setText(description); checkBox.setToolTipText(tooltip); checkBox.setSelected(initialValue); checkBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { predicate.set(checkBox.isSelected()); fireCodeChanged(false); } }); menuBar.addItem(category, checkBox); }
/** * This method is called when the state of the ATabbedPane changes, i. e. when the tab to be * displayed changes. * * @param e */ public void stateChanged(ChangeEvent e) { setTitle(tabbedPane.getCurrentTitle() + " - Quick Sequence Diagram Editor"); Action closeAction = menuBar.getActionByName("[F12]&Close"); if (closeAction != null) { closeAction.setEnabled(tabbedPane.getTabCount() > 1); } final Tab tab = currentTab(); if (tab != null) { tab.leaveFilterMode(); scalePanel.setScalable(tab.getZoomPane()); fireCodeChanged(false); SwingUtilities.invokeLater( new Runnable() { public void run() { tab.getTextArea().requestFocusInWindow(); } }); } enableComponents(); }
public void removeAction(String category, Action action) { menuBar.removeAction(category, action); }
public void addCategory(String category, String icon) { ImageIcon imageIcon = icon == null || icon.equals("") ? null : Icons.getIcon(icon); menuBar.addMenu(category, imageIcon); }