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); }
// 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); }