/** * Try to load a config XML file from a named path. If the file does not exist, return * NONEXISTENT; or if there is any load error, return null. */ private Document loadXml(String path) { assert ProjectManager.mutex().isReadAccess() || ProjectManager.mutex().isWriteAccess(); assert Thread.holdsLock(modifiedMetadataPaths); FileObject xml = dir.getFileObject(path); if (xml == null || !xml.isData()) { return NONEXISTENT; } try { Document doc = XMLUtil.parse( new InputSource(xml.getInputStream()), false, true, XMLUtil.defaultErrorHandler(), null); return doc; } catch (IOException e) { if (!QUIETLY_SWALLOW_XML_LOAD_ERRORS) { LOG.log(Level.INFO, "Load XML: {0}", xml.getPath()); // NOI18N ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } catch (SAXException e) { if (!QUIETLY_SWALLOW_XML_LOAD_ERRORS) { LOG.log(Level.INFO, "Load XML: {0}", xml.getPath()); // NOI18N ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } return null; }
public FOBNode(Node n, FileObject fo) { super(n, fo.isData() ? org.openide.nodes.Children.LEAF : new FOBChildren(n)); this.fo = fo; disableDelegation( DELEGATE_SET_NAME | DELEGATE_GET_NAME | DELEGATE_SET_DISPLAY_NAME | DELEGATE_GET_DISPLAY_NAME); setName(fo.getNameExt()); setDisplayName(fo.getNameExt()); }