1 19 20 package org.netbeans.modules.websvc.registry.actions; 21 22 import org.netbeans.modules.websvc.api.registry.WebServiceMethod; 23 import org.openide.nodes.Node; 24 import org.openide.util.HelpCtx; 25 import org.openide.util.NbBundle; 26 import org.openide.util.actions.NodeAction; 27 28 import org.netbeans.modules.websvc.registry.nodes.*; 29 import org.netbeans.modules.websvc.registry.ui.TestWebServiceMethodDlg; 30 import org.netbeans.modules.websvc.registry.model.WebServiceData; 31 import org.netbeans.modules.websvc.registry.nodes.WebServicesCookie; 32 33 import com.sun.xml.rpc.processor.model.java.JavaMethod; 34 35 import javax.swing.SwingUtilities ; 36 37 38 42 public class TestWebServiceMethodAction extends NodeAction { 43 44 protected boolean enable(Node[] activatedNodes) { 45 if(activatedNodes != null && activatedNodes.length > 0 && 49 activatedNodes[0].getCookie(WebServiceMethod.class) != null) { 50 return true; 51 } else { 52 return false; 53 } 54 } 55 56 public boolean asynchronous() { 57 return false; 58 } 59 60 public HelpCtx getHelpCtx() { 61 return HelpCtx.DEFAULT_HELP; 62 } 63 64 public String getName() { 65 return NbBundle.getMessage(TestWebServiceMethodAction.class, "TEST_METHOD"); 66 } 67 68 protected void performAction(Node[] activatedNodes) { 69 if(null != activatedNodes && activatedNodes.length > 0) { 70 WebServiceMethod methodCookie = (WebServiceMethod) activatedNodes[0].getCookie(WebServiceMethod.class); 71 72 76 78 String methodName = activatedNodes[0].getName(); 79 final JavaMethod currentMethod = (JavaMethod)methodCookie.getJavaMethod(); 80 81 83 Node portNodeWrapper = activatedNodes[0].getParentNode(); 84 final String portName = (String ) portNodeWrapper.getName(); 85 86 88 Node webServiceNodeWrapper = portNodeWrapper.getParentNode(); 89 WebServicesCookie serviceCookie = (WebServicesCookie) webServiceNodeWrapper.getCookie(WebServicesCookie.class); 90 final WebServiceData wsData = serviceCookie.getWebServiceData(); 91 92 if(null != wsData) { 93 SwingUtilities.invokeLater(new Runnable () { 94 public void run() { 95 TestWebServiceMethodDlg dlg = new TestWebServiceMethodDlg(wsData, currentMethod, portName); 96 dlg.displayDialog(); 97 } 98 }); 99 } 100 } 101 } 102 } 103 | Popular Tags |