/** * Gets a status object that can annotate a set of files by changing the names or icons * associated with them. * <p> * The default implementation returns a status object making no modifications, * unless this {@link #isDefault()} in which case certain special attributes * will be honored as of org.openide.filesystems 7.25: * <dl> * <dt>{@code displayName}</dt> * <dd>Value of {@link Status#annotateName}. Often used with {@code bundlevalue} in an {@link XMLFileSystem}.</dd> * <dt>{@code SystemFileSystem.localizingBundle}</dt> * <dd>Name of a bundle (as per {@link NbBundle#getBundle(String)}) in which to look up a display name. * The bundle key is the {@link FileObject#getPath}. * {@code displayName} is preferred for new code.</dd> * <dt>{@code iconBase}</dt> * <dd>Resource path to icon for {@link Status#annotateIcon}. * {@code _32} will be inserted before the file suffix for 32x32 icons.</dd> * <dt>{@code SystemFileSystem.icon} and {@code SystemFileSystem.icon32}</dt> * <dd>Icon specified directly as a {@link URL} (usually {@code nbresloc} protocol) * or {@link Image}. {@code iconBase} is preferred for new code.</dd> * </dl> * @return the status object for this filesystem */ public Status getStatus() { return isDefault() ? SFS_STATUS : STATUS_NONE; }
private static String encodeFsPart(FileObject fo) throws FileStateInvalidException { FileSystem fs = fo.getFileSystem(); assert fs != null : "File object " + fo + " returns null from getFileSystem()"; String n = fs.isDefault() ? SYSTEM_FILE_SYSTEM_NAME : fs.getSystemName(); if (n.isEmpty()) { n = String.format("%s.%h", fs.getClass().getName(), fs); } return encoder(n); }
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ @Deprecated public final synchronized void writeExternal(ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem) iter.next(); if (!fs.isDefault() && !fs.isPersistent()) { oos.writeObject(new NbMarshalledObject(fs)); } } oos.writeObject(null); }
if (fs.isDefault()) { return;
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ public final synchronized void writeExternal (ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem)iter.next(); if (!fs.isDefault () && !fs.isPersistent ()) { oos.writeObject (new NbMarshalledObject (fs)); } } oos.writeObject (null); }
private static boolean couldBeTemplate(FileObject fo) { FileSystem fs; try { fs = fo.getFileSystem(); } catch (FileStateInvalidException e) { return false; } return fs.isDefault() && fo.getPath().startsWith("Templates/"); // NOI18N }
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ public final synchronized void writeExternal (ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem)iter.next(); if (!fs.isDefault () && !fs.isPersistent ()) { oos.writeObject (new NbMarshalledObject (fs)); } } oos.writeObject (null); }
if (file.getFileSystem().isDefault()) { delegates.add(Charset.forName(UTF_8)); } else {
@Override public JavacParser createParser(final Collection<Snapshot> snapshots) { assert snapshots != null; if (snapshots.size() == 1) { final FileObject fo = snapshots.iterator().next().getSource().getFileObject(); try { if (fo == null) { return null; } if (fo.getFileSystem().isDefault() && fo.getAttribute("javax.script.ScriptEngine") != null //NOI18N && fo.getAttribute("template") == Boolean.TRUE) { //NOI18N // Do not create javac parser for templates return null; } } catch (FileStateInvalidException fsie) {} } JavacParser parser = new JavacParser(snapshots, false); if (TIMER.isLoggable(Level.FINE)) { LogRecord rec = new LogRecord(Level.FINE, "JavacParser"); rec.setParameters(new Object[] { parser }); TIMER.log(rec); } return parser; }
public HelpCtx getHelpCtx () { // help for fix #23528, objects represents 'settings' nodes in Options dialog // returns DEFAULT_HELP for next processing try { if (getPrimaryFile ().getFileSystem ().isDefault ()) { if (getCookie (InstanceCookie.class)!=null) { return HelpCtx.DEFAULT_HELP; } } } catch (FileStateInvalidException fsie) { // cannot determine type of this file object ==> return help id as normal } return new HelpCtx (XMLDataObject.class); }
/** * Just avoids loaders.ser, which is not a well-formed ser file and causes confusing * exceptions when browsing system file system. * Anyway reading the contents would mutate loader singletons! Evil. */ protected FileObject findPrimaryFile(FileObject fo) { FileObject r = super.findPrimaryFile(fo); if (r != null && r.getPath().equals("loaders.ser")) { // NOI18N try { if (r.getFileSystem().isDefault()) { // Skip it. return null; } } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } return r; }
/** Removes a filesystem from the pool. * @param fs filesystem to remove * @deprecated Please use the <a href="@JAVA/API@/org/netbeans/api/java/classpath/api.html">ClassPath API</a> instead. */ public final void removeFileSystem (FileSystem fs) { boolean fireIt = false; synchronized (this) { if (fs.isDefault()) return; if (fireIt = fileSystems.remove(fs)) { fs.setRepository (null); fileSystemsClone = (ArrayList)fileSystems.clone(); // the filesystem realy was here if (fs.isValid ()) { // if the filesystem is valid then is in names hashtable names.remove (fs.getSystemName ()); fs.setValid (false); } // in all cases remove it from listeners fs.removePropertyChangeListener (propListener); fs.removeVetoableChangeListener (vetoListener); // notify filesystem itself that it has been removed fs.removeNotify(); } // unassign the filesystem fs.assigned = false; } // postponed firing after synchronized block to prevent deadlock if (fireIt) fireFileSystem (fs, false); }
FileObject ff = URLMapper.findFileObject(u.toURL()); if (ff != null) { if (ff.getFileSystem().isDefault()) { targetFile = ff; } else {
/** Removes a filesystem from the pool. * @param fs filesystem to remove * @deprecated Please use the <a href="@JAVA/API@/org/netbeans/api/java/classpath/api.html">ClassPath API</a> instead. */ public final void removeFileSystem (FileSystem fs) { boolean fireIt = false; synchronized (this) { if (fs.isDefault()) return; if (fireIt = fileSystems.remove(fs)) { fs.setRepository (null); fileSystemsClone = (ArrayList)fileSystems.clone(); // the filesystem realy was here if (fs.isValid ()) { // if the filesystem is valid then is in names hashtable names.remove (fs.getSystemName ()); fs.setValid (false); } // in all cases remove it from listeners fs.removePropertyChangeListener (propListener); fs.removeVetoableChangeListener (vetoListener); // notify filesystem itself that it has been removed fs.removeNotify(); } // unassign the filesystem fs.assigned = false; } // postponed firing after synchronized block to prevent deadlock if (fireIt) fireFileSystem (fs, false); }
if ( fileObject.getFileSystem().isDefault() && fileObject.getAttribute("javax.script.ScriptEngine") != null && fileObject.getAttribute("template") == Boolean.TRUE) {