Creates new "callback" action. Such action has an assigned key
which is used to find proper delegate in
ActionMap of currently
active component. You can use
ActionRegistration annotation to
register your action:
ActionRegistration(displayName="#Key", key="KeyInActionMap")
ActionID(category="Tools", id = "action.pkg.ClassName")
public final class Fallback implements
ActionListener {
public void actionPerformed(
ActionEvent e) {
// your code
}
}
If you want to create callback action without any fallback implementation,
you can annotate any string constant:
ActionRegistration(displayName = "#Key")
ActionID(category = "Edit", id = "my.field.action")
public static final String ACTION_MAP_KEY = "KeyInActionMap";
This action can be lazily declared in a
layer file using following XML snippet:
<file name="action-pkg-ClassName.instance">
<attr name="instanceCreate" methodvalue="org.openide.awt.Actions.callback"/>
<attr name="key" stringvalue="KeyInActionMap"/>
<attr name="surviveFocusChange" boolvalue="false"/> <!-- defaults to false -->
<attr name="fallback" newvalue="action.pkg.DefaultAction"/> <!-- may be missing -->
<attr name="displayName" bundlevalue="your.pkg.Bundle#key"/>
<attr name="iconBase" stringvalue="your/pkg/YourImage.png"/>
<!-- if desired: <attr name="noIconInMenu" boolvalue="true"/> -->
<!-- if desired: <attr name="asynchronous" boolvalue="true"/> -->
</file>