This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Motivation: I would like to simplify creation of actions that implement org.openide.util.ContextAwareAction. In repository you can find several places where modules c&p NodeAction implementation in order to access the context. As NodeAction subclasses SharedClassedObject it is necessary to have 2 classes and a lot of delegating code. Solution: I propose to introduce new helper method Action org.openide.awt.Actions.contextAwareAction( ContextActionHandler delegate, String displayName, String iconBase, boolean noIconInMenu) and interface org.openide.awt.ContextActionHandler that clients would implement to handle particular action with a given context. public interface ContextActionHandler { public boolean isEnabled(Lookup context); public void perform(ActionEvent e, Lookup context); }
There are org.openide.awt.ContextEnabler and ContextPerformer. However they have problems with delivering changes when the enabled state is changed. Your interface suffers similar problem too.
There is @ActionRegistration and it supports some for of context sensitivity.