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 InPlaceEditAction 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) { 50 FormDesigner designer = FormEditor.getFormDesigner(metacomp.getFormModel()); 51 if (designer != null) 52 designer.startInPlaceEditing(metacomp); 53 } 54 } 55 } 56 57 protected boolean asynchronous() { 58 return false; 59 } 60 61 68 protected boolean enable(Node[] activatedNodes) { 69 if (activatedNodes != null && activatedNodes.length == 1) { 70 RADComponentCookie radCookie = (RADComponentCookie)activatedNodes[0] 71 .getCookie(RADComponentCookie.class); 72 RADComponent metacomp = radCookie == null ? null : 73 radCookie.getRADComponent(); 74 if (metacomp != null) { 75 FormDesigner designer = FormEditor.getFormDesigner(metacomp.getFormModel()); 76 if (designer != null) 77 return designer.isEditableInPlace(metacomp); 78 } 79 } 80 return false; 81 } 82 83 88 public String getName() { 89 if (name == null) 90 name = org.openide.util.NbBundle.getBundle(InPlaceEditAction.class) 91 .getString("ACT_InPlaceEdit"); return name; 93 } 94 95 99 public HelpCtx getHelpCtx() { 100 return new HelpCtx("gui.quickref"); } 102 } 103 | Popular Tags |