1 19 package org.netbeans.modules.xml.schema; 20 21 import javax.xml.transform.Source ; 22 23 import org.openide.loaders.*; 24 import org.openide.filesystems.FileObject; 25 import org.openide.util.HelpCtx; 26 import org.openide.nodes.Node; 27 import org.openide.nodes.Children; 28 import org.openide.nodes.CookieSet; 29 30 import org.netbeans.modules.xml.core.XMLDataObjectLook; 31 import org.netbeans.modules.xml.core.text.TextEditorSupport; 32 import org.netbeans.modules.xml.core.sync.*; 33 import org.netbeans.modules.xml.core.cookies.*; 34 35 import org.netbeans.spi.xml.cookies.*; 36 import org.netbeans.modules.xml.schema.cookies.*; 37 import org.xml.sax.InputSource ; 38 39 45 public final class SchemaObject extends MultiDataObject implements XMLDataObjectLook { 46 47 48 private static final long serialVersionUID = 290911236522999000L; 49 50 private static final String SCHEMA_ICON_BASE = 51 "org/netbeans/modules/xml/schema/resources/xmlSchemaObject.gif"; 53 private transient final DataObjectCookieManager cookieManager; 54 55 private transient Synchronizator synchronizator; 56 57 61 public SchemaObject(final FileObject obj, final UniFileLoader loader) throws DataObjectExistsException { 62 super (obj, loader); 63 64 CookieSet set = getCookieSet(); 65 cookieManager = new DataObjectCookieManager (this, set); 66 set.add (cookieManager); 67 68 TextEditorSupport.TextEditorSupportFactory editorFactory = 70 new TextEditorSupport.TextEditorSupportFactory (this, org.netbeans.modules.xml.core.XMLDataObject.MIME_TYPE); 71 editorFactory.registerCookies (set); 72 73 InputSource is = DataObjectAdapters.inputSource(this); 75 set.add(new CheckXMLSupport(is)); 76 set.add(new ValidateSchemaSupport(is)); 77 78 Source source = DataObjectAdapters.source(this); 80 set.add (new TransformableSupport (source)); 81 } 82 83 84 86 protected Node createNodeDelegate () { 87 return new SchemaNode (this); 88 } 89 90 91 93 public HelpCtx getHelpCtx() { 94 return HelpCtx.DEFAULT_HELP; 96 } 97 98 100 public DataObjectCookieManager getCookieManager() { 101 return cookieManager; 102 } 103 104 public synchronized Synchronizator getSyncInterface() { 105 if (synchronizator == null) { 106 synchronizator = new DataObjectSyncSupport(SchemaObject.this); 107 } 108 return synchronizator; 109 } 110 111 114 private static class SchemaNode extends DataNode { 115 116 117 public SchemaNode (SchemaObject obj) { 118 super (obj, Children.LEAF); 119 setIconBaseWithExtension( SCHEMA_ICON_BASE); 120 setShortDescription( Util.THIS.getString("PROP_SchemaNode_desc")); 121 } 122 123 125 public HelpCtx getHelpCtx() { 126 return HelpCtx.DEFAULT_HELP; 128 } 129 130 } 131 132 } 133 | Popular Tags |