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.xam.ui.cookies.ViewComponentCookie; 25 import org.openide.ErrorManager; 26 import org.openide.actions.OpenAction; 27 import org.openide.cookies.OpenCookie; 28 import org.openide.nodes.Node; 29 import org.openide.util.NbBundle; 30 31 36 public class WSDLSourceViewOpenAction extends OpenAction { 37 38 private static final long serialVersionUID = 1L; 39 40 public String getName() { 41 return NbBundle.getMessage(WSDLSourceViewOpenAction.class, 42 "WSDLSourceViewOpenAction_Name"); 43 } 44 45 protected void performAction(Node[] node) { 46 if (node == null || node[0] == null) { 47 return; 48 } 49 WSDLDataObject dobj = (WSDLDataObject) node[0].getLookup().lookup( 50 WSDLDataObject.class); 51 if (dobj != null) { 52 ViewComponentCookie svc = (ViewComponentCookie) dobj.getCookie( 53 ViewComponentCookie.class); 54 if (svc != null) { 55 try { 56 svc.view(ViewComponentCookie.View.SOURCE, 57 dobj.getWSDLEditorSupport().getModel().getDefinitions()); 58 return; 59 } catch (IOException ioe) { 60 ErrorManager.getDefault().notify(ioe); 61 } 62 } 63 } 64 OpenCookie oc = (OpenCookie) node[0].getCookie(OpenCookie.class); 66 if (oc != null) { 67 oc.open(); 68 } 69 } 70 } 71 | Popular Tags |