Actions <http://bits.netbeans.org/10.0/javadoc/org-openide-awt/org/openide/awt/Actions.html>and ActionState <http://bits.netbeans.org/dev/javadoc//org-openide-awt/org/openide/awt/ActionState.html> annotation are replacements to the deprecated BooleanActionState <https://bits.netbeans.org/10.0/javadoc/org-openide-util-ui/org/openide/util/actions/BooleanStateAction.html> which was not very elegant to work with (e.g. an example <https://jnkjava.wordpress.com/2015/02/02/recipe-15-how-to-add-a-toggle-action/>how to use it).
However, ActionState annotation is only applicable to *context* actions to define its state. Actions.CheckboxMenuItem <http://bits.netbeans.org/10.0/javadoc/org-openide-awt/org/openide/awt/Actions.CheckboxMenuItem.html> and Actions.Checkbox are static; how can they be used with a normal Action? Use case: one wants to add a toggle button on the toolbar or a check menu item (or two radio menu items) on a menu in a NB RCP application that when s/he clicks it does something (e.g. sorts an outlineview by one or another field or filter the outline view etc.) but *not* a context action. So I created an action using the NB wizard, I thought I would extend Actions.CheckboxMenuItem which causes a number of problems because it requires 2 args contructor while ActionRegistration requires only 1 arg contructor @ActionID( category = "Bugtracking", id = "todo.actions.SomeBooleanAction" ) @ActionRegistration( iconBase = "todo/actions/mixte_plot14.png", displayName = "#CTL_SomeBooleanAction" ) @ActionReferences({ @ActionReference(path = "Menu/File", position = 0) , @ActionReference(path = "Toolbars/File", position = 0) }) @Messages("CTL_SomeBooleanAction=Some Action") public final class SomeBooleanAction extends Actions.CheckboxMenuItem implements ActionListener { public SomeBooleanAction(BooleanStateAction aAction, boolean useMnemonic) { super(aAction, useMnemonic); } public SomeBooleanAction(BooleanStateAction aAction) { super(aAction, false); } @Override public void actionPerformed(ActionEvent e) { // TODO implement action body } So, is there a way to have a non context Boolean state action in the non-deprecated API (extending JToggleButton doesn't work)? Thanks. John.