public <T extends Node.Cookie> T getCookie(Class<T> c) { Node.Cookie retValue = null; if (ValidateXMLCookie.class.isAssignableFrom(c)) { if (validateCookie == null) { InputSource in = DataObjectAdapters.inputSource(this); validateCookie = new ValidateXMLSupport(in); } return (T) validateCookie; } else if (CheckXMLCookie.class.isAssignableFrom(c)) { if (checkCookie == null) { InputSource in = DataObjectAdapters.inputSource(this); checkCookie = new CheckXMLSupport(in); } return (T) checkCookie; } if (retValue == null) { retValue = super.getCookie(c); } return (T) retValue; }
public LayerDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); final CookieSet cookies = getCookieSet(); final Lookup baseLookup = cookies.getLookup(); lkp = new ProxyLookup(baseLookup) { final AtomicBoolean checked = new AtomicBoolean(); protected @Override void beforeLookup(Template<?> template) { if (template.getType() == LayerHandle.class && checked.compareAndSet(false, true)) { FileObject xml = getPrimaryFile(); Project p = FileOwnerQuery.getOwner(xml); if (p != null) { setLookups(baseLookup, Lookups.singleton(new LayerHandle(p, xml))); } } } }; registerEditor("text/x-netbeans-layer+xml", true); cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this))); }
public TestNGSuiteDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); CookieSet cookies = getCookieSet(); cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this))); cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this))); registerEditor(MIME_TYPE, true); }
public SpringXMLConfigDataObject(FileObject pf, SpringXMLConfigDataLoader loader) throws DataObjectExistsException { super(pf, loader); CookieSet cookies = getCookieSet(); InputSource in = DataObjectAdapters.inputSource(this); cookies.add(new CheckXMLSupport(in)); cookies.add(new ValidateXMLSupport(in)); cookies.assign(FileEncodingQueryImplementation.class, XmlFileEncodingQueryImpl.singleton()); registerEditor(SpringConstants.CONFIG_MIME_TYPE, true); }
private void init() { CookieSet cookies = getCookieSet(); cookies.add(JSFConfigEditorSupport.class, this); //Lookup JSFConfigEditorContext for Page Flow Editor multiview cookies.assign(JSFConfigEditorContext.class, new JSFConfigEditorContextImpl((JSFConfigDataObject)this)); // Creates Check XML and Validate XML context actions InputSource in = DataObjectAdapters.inputSource(this); cookies.add(new CheckXMLSupport(in)); cookies.add(new ValidateXMLSupport(in)); cookies.assign(FileEncodingQueryImplementation.class, XmlFileEncodingQueryImpl.singleton()); }
InputSource in = DataObjectAdapters.inputSource(this); CheckXMLCookie checkCookie = new CheckXMLSupport(in); getCookieSet().add(checkCookie); ValidateXMLCookie validateCookie = new ValidateXMLSupport(in); getCookieSet().add(validateCookie); getCookieSet().assign(FileEncodingQueryImplementation.class, XmlFileEncodingQueryImpl.singleton());
public SVGDataObject(FileObject pf, SVGDataLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); org.xml.sax.InputSource in = DataObjectAdapters.inputSource(this); CheckXMLCookie checkCookie = new CheckXMLSupport(in); getCookieSet().add(checkCookie); ValidateXMLCookie validateCookie = new ValidateXMLSupport(in); getCookieSet().add(validateCookie); XmlMultiViewEditorSupport edSup = getEditorSupport(); edSup.setSuppressXmlView(true); setLastOpenView( SVG_VIEW_INDEX); //call the method getMultiViewDescriptions() to //recalculate the xmlMultiViewIndex member after default //XML view has been suppressed. edSup.getMultiViewDescriptions(); getCookieSet().assign( SaveAsCapable.class, new SaveAsCapable() { public void saveAs(FileObject folder, String fileName) throws IOException { getEditorSupport().saveAs( folder, fileName ); } }); SceneManager.log(Level.INFO, "SVGDataObject created for " + pf.getPath()); //NOI18N }
InputSource in = DataObjectAdapters.inputSource(this); CheckXMLCookie checkCookie = new CheckXMLSupport(in); getCookieSet().add(checkCookie); ValidateXMLCookie validateCookie = new ValidateXMLSupport(in); CookieSet set = getCookieSet(); set.add(validateCookie);