1 19 package org.netbeans.modules.xsl.actions; 20 21 import org.openide.nodes.Node; 22 import org.openide.util.HelpCtx; 23 import org.openide.util.actions.CookieAction; 24 25 import org.netbeans.api.xml.cookies.TransformableCookie; 26 import org.netbeans.modules.xml.core.actions.CollectXMLAction; 27 28 import org.netbeans.modules.xsl.XSLDataObject; 29 import org.netbeans.modules.xsl.transform.TransformPerformer; 30 31 38 public class TransformAction extends CookieAction implements CollectXMLAction.XMLAction { 39 40 private static final long serialVersionUID = -640535981015250507L; 41 42 private static TransformPerformer recentPerfomer; 43 44 protected boolean enable(Node[] activatedNodes) { 45 return super.enable(activatedNodes) && ready(); 46 } 47 48 52 private boolean ready() { 53 if (recentPerfomer == null) { 54 return true; 55 } else { 56 if (recentPerfomer.isActive()) { 57 return false; 58 } else { 59 recentPerfomer = null; 60 return true; 61 } 62 } 63 } 64 65 66 protected Class [] cookieClasses () { 67 return new Class [] { TransformableCookie.class, XSLDataObject.class }; 68 } 69 70 71 protected int mode () { 72 return MODE_ALL; 73 } 74 75 76 77 public String getName() { 78 return Util.THIS.getString ("NAME_transform_action"); 79 } 80 81 82 protected String iconResource () { 83 return "org/netbeans/modules/xsl/resources/xsl_transformation.png"; } 85 86 87 public HelpCtx getHelpCtx () { 88 return new HelpCtx (TransformAction.class); 89 } 90 91 92 93 protected void performAction (Node[] nodes) { 94 recentPerfomer = new TransformPerformer (nodes); 95 recentPerfomer.perform(); 96 } 97 98 protected boolean asynchronous() { 99 return false; 100 } 101 102 } 103 | Popular Tags |