1 19 20 package org.netbeans.modules.xml.schema.core.actions; 21 22 import java.io.IOException ; 23 import org.netbeans.modules.xml.schema.core.SchemaDataObject; 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 35 public class SchemaSourceViewOpenAction extends OpenAction{ 36 private static final long serialVersionUID = 1L; 37 38 48 public String getName() { 49 return NbBundle.getMessage(SchemaSourceViewOpenAction.class, "Edit"); 50 } 51 52 protected void performAction(Node[] node) { 53 if (node == null || node[0] == null){ 54 return; 55 } 56 SchemaDataObject sdo = 57 (SchemaDataObject)node[0].getLookup().lookup(SchemaDataObject.class); 58 if(sdo!=null) 59 { 60 ViewComponentCookie svc = (ViewComponentCookie) sdo.getCookie( 61 ViewComponentCookie.class); 62 if(svc!=null) 63 { 64 try 65 { 66 svc.view(ViewComponentCookie.View.SOURCE, 67 sdo.getSchemaEditorSupport().getModel().getSchema()); 68 return; 69 } 70 catch (IOException ex) 71 { 72 ErrorManager.getDefault().notify(ex); 73 } 74 } 75 } 76 OpenCookie oc = (OpenCookie)node[0].getCookie(OpenCookie.class); 78 if (oc != null){ 79 oc.open(); 80 } 81 } 82 } 83 | Popular Tags |