|
org.openide.filesystems 6.4.22 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.filesystems.FileSystem
public abstract class FileSystem
Interface that provides basic information about a virtual filesystem in the IDE. Classes that implement it should follow JavaBean conventions because when a new instance of a filesystem class is inserted into the system, it should permit the user to modify it with standard Bean properties.
Implementing classes should also have associated subclasses of FileObject
.
Although the class is serializable, only the hidden state
and system name
are serialized, and the deserialized object is by default invalid
(and may be a distinct
object from a valid filesystem in the Repository). If you wish to safely deserialize a file
system, you should after deserialization try to replace it with a filesystem of the
same name
in the Repository.
Nested Class Summary | |
---|---|
static interface |
FileSystem.AtomicAction
An action that it is to be called atomically with respect to filesystem event notification. |
static class |
FileSystem.Environment
Deprecated. Please use the ClassPath API instead. |
static interface |
FileSystem.HtmlStatus
Extension interface for Status provides HTML-formatted annotations. |
static interface |
FileSystem.Status
Allows a filesystem to annotate a group of files (typically comprising a data object) with additional markers. |
Field Summary | |
---|---|
static String |
PROP_DISPLAY_NAME
Property name giving display name of filesystem. |
static String |
PROP_HIDDEN
Deprecated. The property is now hidden. |
static String |
PROP_READ_ONLY
Property name giving read-only state. |
static String |
PROP_ROOT
Property name giving root folder of filesystem. |
static String |
PROP_SYSTEM_NAME
Deprecated. This system name should now be avoided in favor of identifying files persistently by URL. |
static String |
PROP_VALID
Property name indicating validity of filesystem. |
Constructor Summary | |
---|---|
FileSystem()
Default constructor. |
Method Summary | |
---|---|
void |
addFileChangeListener(FileChangeListener fcl)
Add new listener to this object. |
void |
addFileStatusListener(FileStatusListener listener)
Registers FileStatusListener to receive events. |
void |
addNotify()
Notifies this filesystem that it has been added to the repository. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers PropertyChangeListener to receive events. |
void |
addVetoableChangeListener(VetoableChangeListener listener)
Adds listener for the veto of property change. |
FileObject |
find(String aPackage,
String name,
String ext)
Deprecated. Please use the ClassPath API instead, or use findResource(java.lang.String) if you are not interested in classpaths. |
abstract FileObject |
findResource(String name)
Finds a file given its full resource path. |
protected void |
fireFileStatusChanged(FileStatusEvent event)
Notifies all registered listeners about change of status of some files. |
protected void |
firePropertyChange(String name,
Object o,
Object n)
Fires property change event. |
protected void |
fireVetoableChange(String name,
Object o,
Object n)
Fires property vetoable event. |
abstract SystemAction[] |
getActions()
Returns an array of actions that can be invoked on any file in this filesystem. |
SystemAction[] |
getActions(Set foSet)
|
FileSystemCapability |
getCapability()
Deprecated. Capabilities are no longer used. |
abstract String |
getDisplayName()
Provides a name for the system that can be presented to the user. |
abstract FileObject |
getRoot()
Getter for root folder in the filesystem. |
FileSystem.Status |
getStatus()
Get a status object that can annotate a set of files by changing the names or icons associated with them. |
String |
getSystemName()
Deprecated. The system name should now be avoided in favor of identifying files persistently by URL. |
boolean |
isDefault()
Returns true if the filesystem is default one of the IDE. |
boolean |
isHidden()
Deprecated. This property is now useless. |
protected boolean |
isPersistent()
Deprecated. This property is long since useless. |
abstract boolean |
isReadOnly()
Test if the filesystem is read-only or not. |
boolean |
isValid()
Test whether filesystem is valid. |
void |
prepareEnvironment(FileSystem.Environment env)
Deprecated. Please use the ClassPath API instead. |
void |
refresh(boolean expected)
Should check for external modifications. |
void |
removeFileChangeListener(FileChangeListener fcl)
Remove listener from this object. |
void |
removeFileStatusListener(FileStatusListener listener)
Removes FileStatusListener from the list of listeners. |
void |
removeNotify()
Notifies this filesystem that it has been removed from the repository. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes PropertyChangeListener from the list of listeners. |
void |
removeVetoableChangeListener(VetoableChangeListener listener)
Removes listener for the veto of property change. |
void |
runAtomicAction(FileSystem.AtomicAction run)
Executes atomic action. |
protected void |
setCapability(FileSystemCapability capability)
Deprecated. Capabilities are no longer used. |
void |
setHidden(boolean hide)
Deprecated. This property is now useless. |
protected void |
setSystemName(String name)
Deprecated. The system name should now be avoided in favor of identifying files persistently by URL. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PROP_VALID
public static final String PROP_HIDDEN
public static final String PROP_SYSTEM_NAME
public static final String PROP_DISPLAY_NAME
public static final String PROP_ROOT
public static final String PROP_READ_ONLY
Constructor Detail |
---|
public FileSystem()
Method Detail |
---|
public void refresh(boolean expected)
expected
- should the file events be marked as expected change or not?FileEvent.isExpected()
public final boolean isValid()
public final void setHidden(boolean hide)
hide
- true
if the filesystem should be hiddenpublic final boolean isHidden()
protected boolean isPersistent()
Repository
is reloading its content, it preserves this
filesystem in the pool.
This can be used when the pool contains system level and user level filesystems. The system ones should be preserved when the user changes the content (for example when he is loading a new project).
The default implementation returns false
.
public abstract String getDisplayName()
This call should never be used to attempt to identify the file root
of the filesystem. On some systems it may happen to look the same but this is a
coincidence and may well change in the future. Either check whether
you are working with a LocalFileSystem
or similar implementation and use
LocalFileSystem.getRootDirectory()
; or better, try
FileUtil.toFile(org.openide.filesystems.FileObject)
which is designed to do this correctly.
Note: for most purposes it is probably a bad idea to use
this method. Instead look at FileUtil.getFileDisplayName(org.openide.filesystems.FileObject)
.
public final String getSystemName()
A change of the system name should be interpreted as a change of the internal state of the filesystem. For example, if the root directory is moved to different location, one should rebuild representations for all files in the system.
This call should never be used to attempt to identify the file root
of the filesystem. On Unix systems it may happen to look the same but this is a
coincidence and may well change in the future. Either check whether
you are working with a LocalFileSystem
or similar implementation and use
LocalFileSystem.getRootDirectory()
; or better, try
FileUtil.toFile(org.openide.filesystems.FileObject)
which is designed to do this correctly.
protected final void setSystemName(String name) throws PropertyVetoException
Warning: this method is protected so that only subclasses can change the system name.
name
- new system name
PropertyVetoException
- if the change is not allowed by a listenerpublic final boolean isDefault()
true
if the filesystem is default one of the IDE.
Repository.getDefaultFileSystem()
public abstract boolean isReadOnly()
public abstract FileObject getRoot()
public FileObject find(String aPackage, String name, String ext)
findResource(java.lang.String)
if you are not interested in classpaths.
The default implementation converts dots in the package name into slashes,
concatenates the strings, adds any extension prefixed by a dot and calls
the findResource
method.
Note: when both of name
and ext
are null
then name and
extension should be ignored and scan should look only for a package.
aPackage
- package name where each package component is separated by a dotname
- name of the file (without dots) or null
if
one wants to obtain a folder (package) and not a file in itext
- extension of the file (without leading dot) or null
if one needs
a package and not a file
null
if the file does not existpublic abstract FileObject findResource(String name)
name
- the resource path, e.g. "dir/subdir/file.ext" or "dir/subdir" or "dir"
null
if no such file existspublic abstract SystemAction[] getActions()
Menu
,
Popup
,
and Toolbar
presenters.
public SystemAction[] getActions(Set foSet)
public String toString()
public void prepareEnvironment(FileSystem.Environment env) throws EnvironmentNotSupportedException
FileSystem.Environment
interface.
The default implementation throws an exception to signal that it does not support external compilation or execution.
env
- the environment to setup
EnvironmentNotSupportedException
- if external execution
and compilation cannot be supportedpublic FileSystem.Status getStatus()
The default implementation returns a status object making no modifications.
public final FileSystemCapability getCapability()
protected final void setCapability(FileSystemCapability capability)
capability
- the capability to usepublic final void runAtomicAction(FileSystem.AtomicAction run) throws IOException
Warning: the action should not take a significant amount of time, and should finish as soon as possible--otherwise all event notifications will be blocked.
Warning: do not be misled by the name of this method; it does not require the filesystem to treat the changes as an atomic block of commits in the database sense! That is, if an exception is thrown in the middle of the action, partial results will not be undone (in general this would be impossible to implement for all filesystems anyway).
run
- the action to run
IOException
- if there is an IOException
thrown in the actions' run
methodpublic final void addFileStatusListener(FileStatusListener listener)
listener
- The listener to register.public final void removeFileStatusListener(FileStatusListener listener)
listener
- The listener to remove.protected final void fireFileStatusChanged(FileStatusEvent event)
event
- The event to be firedpublic final void addVetoableChangeListener(VetoableChangeListener listener)
listener
- the listenerpublic final void removeVetoableChangeListener(VetoableChangeListener listener)
listener
- the listenerprotected final void fireVetoableChange(String name, Object o, Object n) throws PropertyVetoException
name
- name of the propertyo
- old value of the propertyn
- new value of the property
PropertyVetoException
- if an listener vetoed the changepublic final void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to register.public final void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to remove.protected final void firePropertyChange(String name, Object o, Object n)
name
- name of the propertyo
- old value of the propertyn
- new value of the propertypublic void addNotify()
Note that this method is advisory and serves as an optimization to avoid retaining resources for too long etc. Filesystems should maintain correct semantics regardless of whether and when this method is called.
public void removeNotify()
Note that this method is advisory and serves as an optimization to avoid retaining resources for too long etc. Filesystems should maintain correct semantics regardless of whether and when this method is called.
public final void addFileChangeListener(FileChangeListener fcl)
fcl
- the listenerpublic final void removeFileChangeListener(FileChangeListener fcl)
fcl
- the listener
|
org.openide.filesystems 6.4.22 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |