com.intellij.openapi.vcs.vfs
Class VcsFileSystem

java.lang.Object
  extended by com.intellij.openapi.vfs.VirtualFileSystem
      extended by com.intellij.openapi.vcs.vfs.VcsFileSystem
All Implemented Interfaces:
ApplicationComponent, BaseComponent

public class VcsFileSystem
extends VirtualFileSystem
implements ApplicationComponent


Constructor Summary
VcsFileSystem()
           
 
Method Summary
 void disposeComponent()
          Component should dispose system resources or perform another cleanup in this method.
 VirtualFile findFileByPath(java.lang.String path)
          Searches for the file specified by given path.
protected  void fireBeforeContentsChange(java.lang.Object requestor, VirtualFile file)
           
protected  void fireBeforeFileDeletion(java.lang.Object requestor, VirtualFile file)
           
 void fireContentsChanged(java.lang.Object requestor, VirtualFile file, long oldModificationStamp)
           
protected  void fireFileDeleted(java.lang.Object requestor, VirtualFile file, java.lang.String fileName, boolean isDirectory, VirtualFile parent)
           
 void forceRefreshFile(VirtualFile file)
           
 void forceRefreshFiles(boolean asynchronous, VirtualFile... files)
          Reloads files from disk regardless of their changed timestamp/contents
 java.lang.String getComponentName()
          Unique name of this component.
static VcsFileSystem getInstance()
           
 java.lang.String getProtocol()
          Gets the protocol for this file system.
 void initComponent()
          Component should do initialization and communication with another components in this method.
 void refresh(boolean asynchronous)
          Refreshes the cached information for all files in this file system from the physical file system.
 VirtualFile refreshAndFindFileByPath(java.lang.String path)
          Refreshes only the part of the file system needed for searching the file by the given path and finds file by the given path.
 
Methods inherited from class com.intellij.openapi.vfs.VirtualFileSystem
addVirtualFileListener, extractPresentableUrl, fireBeforeFileMovement, fireBeforePropertyChange, fireFileCreated, fireFileMoved, firePropertyChanged, removeVirtualFileListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VcsFileSystem

public VcsFileSystem()
Method Detail

getInstance

public static VcsFileSystem getInstance()

getProtocol

public java.lang.String getProtocol()
Description copied from class: VirtualFileSystem
Gets the protocol for this file system. Protocols should differ for all file systems.

Specified by:
getProtocol in class VirtualFileSystem
Returns:
String representing the protocol
See Also:
VirtualFile.getUrl(), VirtualFileManager.getFileSystem(java.lang.String)

findFileByPath

public VirtualFile findFileByPath(java.lang.String path)
Description copied from class: VirtualFileSystem
Searches for the file specified by given path. Path is a string which uniquely identifies file within given VirtualFileSystem. Format of the path depends on the concrete file system. For LocalFileSystem it is an absoulute file path with file separator characters (File.separatorChar) replaced to the forward slash ('/').

Example: to find a VirtualFile corresponding to the physical file with the specified path one can use the followoing code: LocalFileSystem.getInstance().findFileByPath(path.replace(File.separatorChar, '/'));

Specified by:
findFileByPath in class VirtualFileSystem
Parameters:
path - the path to find file by
Returns:
VirtualFile if the file was found, null otherwise

refresh

public void refresh(boolean asynchronous)
Description copied from class: VirtualFileSystem
Refreshes the cached information for all files in this file system from the physical file system.

If asynchronous is false this method should be only called within write-action. See Application.runWriteAction(java.lang.Runnable).

Specified by:
refresh in class VirtualFileSystem
Parameters:
asynchronous - if true then the operation will be performed in a separate thread, otherwise will be performed immediately
See Also:
VirtualFile.refresh(boolean, boolean), VirtualFileManager.refresh(boolean)

refreshAndFindFileByPath

public VirtualFile refreshAndFindFileByPath(java.lang.String path)
Description copied from class: VirtualFileSystem
Refreshes only the part of the file system needed for searching the file by the given path and finds file by the given path.

This method is useful when the file was created externally and you need to find VirtualFile corresponding to it.

This method should be only called within write-action. See Application.runWriteAction(java.lang.Runnable).

Specified by:
refreshAndFindFileByPath in class VirtualFileSystem
Parameters:
path - the path
Returns:
VirtualFile if the file was found, null otherwise

fireContentsChanged

public void fireContentsChanged(java.lang.Object requestor,
                                VirtualFile file,
                                long oldModificationStamp)
Overrides:
fireContentsChanged in class VirtualFileSystem

fireBeforeFileDeletion

protected void fireBeforeFileDeletion(java.lang.Object requestor,
                                      VirtualFile file)
Overrides:
fireBeforeFileDeletion in class VirtualFileSystem

fireFileDeleted

protected void fireFileDeleted(java.lang.Object requestor,
                               VirtualFile file,
                               java.lang.String fileName,
                               boolean isDirectory,
                               VirtualFile parent)
Overrides:
fireFileDeleted in class VirtualFileSystem

getComponentName

public java.lang.String getComponentName()
Description copied from interface: BaseComponent
Unique name of this component. If there is another component with the same name or name is null internal assertion will occur.

Specified by:
getComponentName in interface BaseComponent
Returns:
the name of this component

initComponent

public void initComponent()
Description copied from interface: BaseComponent
Component should do initialization and communication with another components in this method.

Specified by:
initComponent in interface BaseComponent

disposeComponent

public void disposeComponent()
Description copied from interface: BaseComponent
Component should dispose system resources or perform another cleanup in this method.

Specified by:
disposeComponent in interface BaseComponent

fireBeforeContentsChange

protected void fireBeforeContentsChange(java.lang.Object requestor,
                                        VirtualFile file)
Overrides:
fireBeforeContentsChange in class VirtualFileSystem

forceRefreshFiles

public void forceRefreshFiles(boolean asynchronous,
                              VirtualFile... files)
Description copied from class: VirtualFileSystem
Reloads files from disk regardless of their changed timestamp/contents

Overrides:
forceRefreshFiles in class VirtualFileSystem
Parameters:
asynchronous - if true, the reload is done asynchronously.
files - the list of files to refresh (must not contain directories).

forceRefreshFile

public void forceRefreshFile(VirtualFile file)
Specified by:
forceRefreshFile in class VirtualFileSystem