1 19 20 package org.netbeans.modules.form.actions; 21 22 import org.openide.nodes.Node; 23 import org.openide.util.actions.*; 24 import org.openide.util.HelpCtx; 25 26 import org.netbeans.modules.form.*; 27 28 29 31 public class EditFormAction extends NodeAction { 32 33 private static String name; 34 35 43 protected void performAction(Node[] activatedNodes) { 44 if (activatedNodes != null && activatedNodes.length == 1) { 45 RADComponentCookie radCookie = (RADComponentCookie)activatedNodes[0] 46 .getCookie(RADComponentCookie.class); 47 RADComponent metacomp = radCookie == null ? null : 48 radCookie.getRADComponent(); 49 if (metacomp != null) { FormDesigner designer = FormEditor.getFormDesigner(metacomp.getFormModel()); 51 if (designer != null) { 52 designer.resetTopDesignComponent(true); 53 designer.requestActive(); 54 } 55 } 56 } 57 } 58 59 protected boolean asynchronous() { 60 return false; 61 } 62 63 70 protected boolean enable(Node[] activatedNodes) { 71 if (activatedNodes != null && activatedNodes.length == 1) { 72 RADComponentCookie radCookie = (RADComponentCookie)activatedNodes[0] 73 .getCookie(RADComponentCookie.class); 74 RADComponent metacomp = radCookie == null ? null : 75 radCookie.getRADComponent(); 76 if (metacomp instanceof RADVisualContainer) { 77 FormModel formModel = metacomp.getFormModel(); 78 FormDesigner designer = FormEditor.getFormDesigner(formModel); 79 return designer != null 80 && designer.getTopDesignComponent() != formModel.getTopRADComponent(); 81 } 82 } 83 return false; 84 } 85 86 91 public String getName() { 92 if (name == null) 93 name = org.openide.util.NbBundle.getBundle(EditFormAction.class) 94 .getString("ACT_EditForm"); return name; 96 } 97 98 102 public HelpCtx getHelpCtx() { 103 return new HelpCtx("gui.containers.designing"); } 105 } 106 | Popular Tags |