01: package testRename;
02:
03: import org.openide.loaders.DataObject;
04: import org.openide.nodes.Node;
05: import org.openide.util.HelpCtx;
06: import org.openide.util.NbBundle;
07: import org.openide.util.actions.CookieAction;
08:
09: public final class MyAction extends CookieAction {
10:
11: protected void performAction(Node[] activatedNodes) {
12: DataObject c = (DataObject) activatedNodes[0]
13: .getCookie(DataObject.class);
14: // TODO use c
15: }
16:
17: protected int mode() {
18: return CookieAction.MODE_EXACTLY_ONE;
19: }
20:
21: public String getName() {
22: return NbBundle.getMessage(MyAction.class, "CTL_MyAction");
23: }
24:
25: protected Class[] cookieClasses() {
26: return new Class[] { DataObject.class };
27: }
28:
29: protected void initialize() {
30: super .initialize();
31: // see org.openide.util.actions.SystemAction.iconResource() javadoc for more details
32: putValue("noIconInMenu", Boolean.TRUE);
33: }
34:
35: public HelpCtx getHelpCtx() {
36: return HelpCtx.DEFAULT_HELP;
37: }
38:
39: protected boolean asynchronous() {
40: return false;
41: }
42:
43: }
|