1 19 package org.netbeans.modules.xsl; 20 21 import org.xml.sax.InputSource ; 22 import javax.xml.transform.Source ; 23 24 import org.openide.loaders.*; 25 import org.openide.filesystems.FileObject; 26 import org.openide.util.HelpCtx; 27 import org.openide.nodes.Node; 28 import org.openide.nodes.Children; 29 import org.openide.nodes.CookieSet; 30 31 import org.netbeans.spi.xml.cookies.*; 32 33 import org.netbeans.modules.xml.core.XMLDataObjectLook; 34 import org.netbeans.modules.xml.core.text.TextEditorSupport; 35 import org.netbeans.modules.xml.core.sync.*; 36 import org.netbeans.modules.xml.core.cookies.*; 37 import org.netbeans.modules.xsl.cookies.ValidateXSLSupport; 38 39 45 public final class XSLDataObject extends MultiDataObject implements XMLDataObjectLook { 46 47 private static final long serialVersionUID = -3523066651187749549L; 48 49 50 public static final String MIME_TYPE = "application/xslt+xml"; 52 private static final String XSL_ICON_BASE = 53 "org/netbeans/modules/xsl/resources/xslObject"; 55 private transient final DataObjectCookieManager cookieManager; 56 57 private transient Synchronizator synchronizator; 58 59 60 64 public XSLDataObject(final FileObject obj, final UniFileLoader loader) throws DataObjectExistsException { 65 super (obj, loader); 66 67 CookieSet set = getCookieSet(); 68 cookieManager = new DataObjectCookieManager (this, set); 69 set.add (cookieManager); 70 71 InputSource is = DataObjectAdapters.inputSource (this); 73 set.add(new CheckXMLSupport (is)); 74 set.add(new ValidateXSLSupport (is)); 75 76 Source source = DataObjectAdapters.source (this); 78 set.add (new TransformableSupport (source)); 79 80 set.add (new ScenarioSupport (this)); 82 83 TextEditorSupport.TextEditorSupportFactory editorFactory = 85 new TextEditorSupport.TextEditorSupportFactory (this, org.netbeans.modules.xml.core.XMLDataObject.MIME_TYPE); 86 editorFactory.registerCookies (set); 87 88 } 89 90 91 93 protected Node createNodeDelegate () { 94 return new XSLDataNode (this); 95 } 96 97 98 100 public HelpCtx getHelpCtx() { 101 return HelpCtx.DEFAULT_HELP; 103 } 104 105 107 public DataObjectCookieManager getCookieManager() { 108 return cookieManager; 109 } 110 111 public synchronized Synchronizator getSyncInterface() { 112 if (synchronizator == null) { 113 synchronizator = new DataObjectSyncSupport (XSLDataObject.this); 114 } 115 return synchronizator; 116 } 117 118 121 private static class XSLDataNode extends DataNode { 122 123 124 public XSLDataNode (XSLDataObject obj) { 125 super (obj, Children.LEAF); 126 setIconBase (XSL_ICON_BASE); 127 setShortDescription(Util.THIS.getString("PROP_XSLDataNode_desc")); 128 } 129 130 132 public HelpCtx getHelpCtx() { 133 return HelpCtx.DEFAULT_HELP; 135 } 136 137 } 138 139 } 140 | Popular Tags |