1 19 20 package org.netbeans.modules.websvc.wsdl; 21 22 import org.netbeans.api.xml.cookies.CheckXMLCookie; 23 import org.netbeans.spi.xml.cookies.CheckXMLSupport; 24 import org.netbeans.spi.xml.cookies.DataObjectAdapters; 25 import org.openide.cookies.SaveCookie; 27 import org.openide.loaders.MultiDataObject; 28 import org.openide.nodes.CookieSet; 29 import org.openide.nodes.Node; 30 import org.openide.loaders.MultiFileLoader; 31 import org.openide.loaders.DataObjectExistsException; 32 import org.openide.filesystems.FileObject; 33 34 35 import org.xml.sax.InputSource ; 36 37 38 42 public class WsdlDataObject extends MultiDataObject implements CookieSet.Factory { 43 private static final long serialVersionUID = 1871655333534008660L; 44 public static final String WSDL_EXTENSION = "wsdl"; protected WsdlEditorSupport editor; 46 47 private boolean clientResolved, isClientWsdl; 52 53 55 public WsdlDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException { 56 super(pf, loader); 57 init(); 58 } 59 60 private void init() { 61 getCookieSet().add(WsdlEditorSupport.class, this); 64 InputSource in = DataObjectAdapters.inputSource(this); 66 CheckXMLCookie checkCookie = new CheckXMLSupport(in); 67 getCookieSet().add(checkCookie); 68 } 69 70 71 public org.openide.nodes.Node.Cookie createCookie(Class clazz) { 72 if(clazz.isAssignableFrom(WsdlEditorSupport.class)) 73 return getEditorSupport(); 74 else 75 return null; 76 } 77 78 79 protected synchronized WsdlEditorSupport getEditorSupport() { 80 if(editor == null) { 81 editor = new WsdlEditorSupport(this); 82 } 83 return editor; 84 } 85 86 public boolean isRenameAllowed() { 87 return true; 88 } 89 90 public boolean isDeleteAllowed() { 91 return true; 92 } 93 94 96 protected Node createNodeDelegate() { 97 return new WsdlDataNode(this); 98 } 99 100 public void addSaveCookie(SaveCookie cookie){ 101 getCookieSet().add(cookie); 102 } 103 104 public void removeSaveCookie(){ 105 org.openide.nodes.Node.Cookie cookie = getCookie(SaveCookie.class); 106 if (cookie!=null) getCookieSet().remove(cookie); 107 } 108 } 109 | Popular Tags |