1 19 20 package org.netbeans.modules.form.actions; 21 22 import org.netbeans.api.java.source.JavaSource; 23 import org.netbeans.modules.form.palette.BeanInstaller; 24 import org.openide.filesystems.FileObject; 25 import org.openide.nodes.Node; 26 import org.openide.util.HelpCtx; 27 import org.openide.util.actions.NodeAction; 28 29 34 35 public class InstallToPaletteAction extends NodeAction { 36 37 private static String name; 38 39 public InstallToPaletteAction () { 40 putValue("noIconInMenu", Boolean.TRUE); } 42 43 public String getName() { 44 if (name == null) 45 name = org.openide.util.NbBundle.getBundle(InstallToPaletteAction.class) 46 .getString("ACT_InstallToPalette"); return name; 48 } 49 50 public HelpCtx getHelpCtx() { 51 return new HelpCtx("beans.adding"); } 53 54 protected boolean asynchronous() { 55 return false; 56 } 57 58 protected void performAction(Node[] activatedNodes) { 59 BeanInstaller.installBeans(activatedNodes); 60 } 61 62 protected boolean enable(Node[] activatedNodes) { 63 for (Node n: activatedNodes) { 64 FileObject fobj = n.getLookup().lookup(FileObject.class); 65 if (fobj == null || JavaSource.forFileObject(fobj) == null) { 66 return false; 67 } 68 } 69 70 return true; 71 } 72 73 } 74 | Popular Tags |