1 19 20 package org.netbeans.modules.xml.wsdl.ui.actions; 21 22 import java.io.IOException ; 23 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLDataObject; 24 import org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLEditorSupport; 25 import org.netbeans.modules.xml.xam.ui.cookies.ViewComponentCookie; 26 import org.openide.cookies.OpenCookie; 27 import org.openide.nodes.Node; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 import org.openide.util.actions.NodeAction; 31 32 37 public class WSDLViewOpenAction extends NodeAction{ 38 39 private static final long serialVersionUID = 1L; 40 41 protected void performAction(Node[] node) { 42 if (node == null || node[0] == null) { 43 return; 44 } 45 WSDLDataObject sdo = (WSDLDataObject) node[0].getLookup().lookup( 46 WSDLDataObject.class); 47 if (sdo != null) { 48 WSDLEditorSupport wes = sdo.getWSDLEditorSupport(); 49 ViewComponentCookie svc = (ViewComponentCookie) sdo.getCookie( 50 ViewComponentCookie.class); 51 if (svc != null) { 52 try { 53 if (wes.getOpenedPanes() == null || 54 wes.getOpenedPanes().length == 0) { 55 svc.view(ViewComponentCookie.View.STRUCTURE, 56 wes.getModel().getDefinitions()); 57 } else { 58 wes.open(); 59 } 60 return; 61 } catch (IOException ioe) { 62 } 64 } 65 } 66 OpenCookie oc = (OpenCookie) node[0].getCookie(OpenCookie.class); 68 if (oc != null) { 69 oc.open(); 70 } 71 } 72 73 protected boolean enable(Node[] node) { 74 return true; 75 } 76 77 public String getName() { 78 return NbBundle.getMessage(WSDLViewOpenAction.class, 79 "WSDLViewOpenAction_Name"); 80 } 81 82 public HelpCtx getHelpCtx() { 83 return HelpCtx.DEFAULT_HELP; 84 } 85 86 protected boolean asynchronous() { 87 return false; 88 } 89 } 90 | Popular Tags |