1 19 package org.netbeans.modules.xml.core; 20 21 import org.openide.loaders.*; 22 import org.openide.filesystems.FileObject; 23 import org.openide.util.HelpCtx; 24 import org.openide.actions.EditAction; 25 import org.openide.util.actions.SystemAction; 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.text.TextEditorSupport; 31 import org.netbeans.modules.xml.core.sync.*; 32 import org.netbeans.modules.xml.core.cookies.*; 33 34 import org.netbeans.spi.xml.cookies.*; 35 import org.xml.sax.InputSource ; 36 37 43 public final class EntityDataObject extends MultiDataObject implements XMLDataObjectLook { 44 45 private static final long serialVersionUID = 2909112365229995364L; 46 47 48 public static final String MIME_TYPE = "text/xml-external-parsed-entity"; 50 51 private transient Synchronizator synchronizator; 52 53 54 private transient final DataObjectCookieManager cookieManager; 55 56 57 61 public EntityDataObject (final FileObject obj, final UniFileLoader loader) throws DataObjectExistsException { 62 super (obj, loader); 63 64 CookieSet set = getCookieSet(); 65 set.add (cookieManager = new DataObjectCookieManager (this, set)); 66 67 TextEditorSupport.TextEditorSupportFactory editorFactory = 68 new TextEditorSupport.TextEditorSupportFactory (this, MIME_TYPE); 69 editorFactory.registerCookies (set); 70 71 74 InputSource in = DataObjectAdapters.inputSource(this); 76 set.add(new CheckXMLSupport(in, CheckXMLSupport.CHECK_ENTITY_MODE)); 77 78 } 80 81 82 84 protected Node createNodeDelegate () { 85 return new EntityDataNode (this); 86 } 87 88 89 90 public synchronized Synchronizator getSyncInterface() { 91 if (synchronizator == null) { 92 synchronizator = new EntitySyncSupport (this); 93 94 } 95 return synchronizator; 96 } 97 98 public DataObjectCookieManager getCookieManager() { 99 return cookieManager; 100 } 101 102 103 105 public HelpCtx getHelpCtx() { 106 return HelpCtx.DEFAULT_HELP; 108 } 109 110 111 115 118 private static class EntityDataNode extends DataNode { 119 120 121 public EntityDataNode (EntityDataObject obj) { 122 super (obj, Children.LEAF); 123 124 setDefaultAction (SystemAction.get (EditAction.class)); 125 setIconBase ("org/netbeans/modules/xml/core/resources/entObject"); setShortDescription(Util.THIS.getString("PROP_EntityDataNode_desc")); 127 } 128 129 131 public HelpCtx getHelpCtx() { 132 return HelpCtx.DEFAULT_HELP; 134 } 135 136 } 138 139 143 148 150 } 151 | Popular Tags |