|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.openide.filesystems.Repository
This singleton object contains all FileSystems in the IDE.
It corresponds to the Filesystems tab in the Explorer, or more precisely
to Filesystems Settings in Project Settings.
At any given time, no two file systems in the pool may share the same name
(unless all but one are invalid).
Use TopManager.getRepository() to retrieve the default instance.
Note that you may construct additional instances of the Repository if you
wish. The serialization replacer of this class specifically deals with the
default instance as stored by the top manager; however you may safely call
the readExternal(java.io.ObjectInput) and writeExternal(java.io.ObjectOutput) methods directly to implement
persistence of a non-default instance.
| Constructor Summary | |
Repository(FileSystem def)
Creates new instance of file system pool and registers it as the default one. |
|
| Method Summary | |
void |
addFileSystem(FileSystem fs)
Adds new file system to the pool. |
void |
addRepositoryListener(RepositoryListener list)
Adds new listener. |
Enumeration |
fileSystems()
Returns enumeration of all file systems. |
FileObject |
find(String aPackage,
String name,
String ext)
Finds file when its name is provided. |
Enumeration |
findAll(String aPackage,
String name,
String ext)
Finds all files among all file systems matching a given name, returning all matches. |
Enumeration |
findAllResources(String name)
Searches for the given resource among all file systems, returning all matches. |
FileSystem |
findFileSystem(String systemName)
Finds file system when only its system name is known. |
FileObject |
findResource(String name)
Searches for the given resource among all file systems. |
static Repository |
getDefault()
Access method to get default instance of repository in the system. |
FileSystem |
getDefaultFileSystem()
Gets the default filesystem of the IDE. |
Enumeration |
getFileSystems()
Returns enumeration of all file systems. |
void |
readExternal(ObjectInput ois)
Reads object from stream. |
void |
removeFileSystem(FileSystem fs)
Removes a file system from the pool. |
void |
removeRepositoryListener(RepositoryListener list)
Removes listener. |
void |
reorder(int[] perm)
Reorders FileSystems by given permutation. |
FileSystem[] |
toArray()
Returns a sorted array of file systems. |
void |
writeExternal(ObjectOutput oos)
Saves pool to stream by saving all file systems. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Repository(FileSystem def)
def - the default filesystem| Method Detail |
public static Repository getDefault()
org.openide.util.Lookup.getDefault ().lookup (Repository.class)
or (if the lookup query returns null) a default instance is created.public FileSystem getDefaultFileSystem()
public final void addFileSystem(FileSystem fs)
fs - file system to addpublic final void removeFileSystem(FileSystem fs)
fs - file system to removepublic final void reorder(int[] perm)
FileSystems by given permutation.
For example, if there are three file systems, new int[] {2, 0, 1} cycles the file systems forwards.perm - an array of integersIllegalArgumentException - if the array is not a permutation, or is not the same length as the current number of file systems in the poolpublic final Enumeration getFileSystems()
FileSystempublic final Enumeration fileSystems()
FileSystempublic final FileSystem[] toArray()
public final FileSystem findFileSystem(String systemName)
systemName - name of the file systemnull if there is no such
file system
public void writeExternal(ObjectOutput oos)
throws IOException
oos - object output streamIOException - if an error occures
public void readExternal(ObjectInput ois)
throws IOException,
ClassNotFoundException
oos - object output streamIOException - if an error occuresClassNotFoundException - if read class is not found
public final FileObject find(String aPackage,
String name,
String ext)
find. The first object that is found is returned or null
if none of the file systems contain such a file.aPackage - package name where each package is separated by a dotname - name of the file (without dots) or null if
one wants to obtain the name of a package and not a file in itext - extension of the file or null if one needs
a package and not a file nameFileObject that represents file with given name or
null if the file does not existpublic FileObject findResource(String name)
name - a name of the resourcenull if the resource can not be foundFileSystem.findResource(java.lang.String)public Enumeration findAllResources(String name)
name - name of the resourceFileObjects
public final Enumeration findAll(String aPackage,
String name,
String ext)
FileSystem.find(java.lang.String, java.lang.String, java.lang.String).aPackage - package name where each package is separated by a dotname - name of the file (without dots) or null if
one wants to obtain the name of a package and not a file in itext - extension of the file or null if one needs
a package and not a file nameFileObjectspublic void addRepositoryListener(RepositoryListener list)
list - the listenerpublic void removeRepositoryListener(RepositoryListener list)
list - the listener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||