Eclipse Platform
Release 3.0

org.eclipse.core.filebuffers
Interface IFileBufferManager

All Known Subinterfaces:
ITextFileBufferManager

public interface IFileBufferManager

A file buffer manager manages file buffers for files while the files are connected to the file buffer manager. In order to connect a file to a file buffer manager call connect. After that call has successfully completed the file buffer can be obtained by getFileBuffer. The file buffer is created on the first connect and disposed on the last disconnect. I.e. the file buffer manager keeps track of how often a file is connected and returns the same file buffer to each client as long as the file is connected.

Since:
3.0

Method Summary
 void addFileBufferListener(IFileBufferListener listener)
          Adds the given listener to the list of file buffer listeners.
 void connect(IPath location, IProgressMonitor monitor)
          Connects the file at the given location to this manager.
 void disconnect(IPath location, IProgressMonitor monitor)
          Disconnects the file at the given location from this manager.
 IFileBuffer getFileBuffer(IPath location)
          Returns the file buffer managed for the given location or null if there is no such file buffer.
 void releaseSynchronizationContext(IPath location)
          The caller no longer requests the synchronization context for the file buffer managed for the given location.
 void removeFileBufferListener(IFileBufferListener listener)
          Removes the given listener from the list of file buffer listeners.
 void requestSynchronizationContext(IPath location)
          The caller requests that the synchronization context is used to synchronize the given location with its file buffer.
 void setSynchronizationContext(ISynchronizationContext context)
          Sets the synchronization context for this file buffer manager, i.e., for all file buffers this manager manages.
 

Method Detail

connect

public void connect(IPath location,
                    IProgressMonitor monitor)
             throws CoreException
Connects the file at the given location to this manager. After that call successfully completed it is guaranteed that each call to getFileBuffer returns the same file buffer until disconnect is called.

The provided location is either a full path of a workspace resource or an absolute path in the local file system. The file buffer manager does not resolve the location of workspace resources in the case of linked resources.

Parameters:
location - the location of the file to be connected
monitor - the progress monitor
Throws:
CoreException - if the file could not successfully be connected

disconnect

public void disconnect(IPath location,
                       IProgressMonitor monitor)
                throws CoreException
Disconnects the file at the given location from this manager. After that call successfully completed there is no guarantee that getFileBuffer will return a valid file buffer.

The provided location is either a full path of a workspace resource or an absolute path in the local file system. The file buffer manager does not resolve the location of workspace resources in the case of linked resources.

Parameters:
location - the location of the file to be disconnected
monitor - the progress monitor
Throws:
CoreException - if the file could not successfully be disconnected

getFileBuffer

public IFileBuffer getFileBuffer(IPath location)
Returns the file buffer managed for the given location or null if there is no such file buffer.

The provided location is either a full path of a workspace resource or an absolute path in the local file system. The file buffer manager does not resolve the location of workspace resources in the case of linked resources.

Parameters:
location - the location
Returns:
the file buffer managed for that location or null

setSynchronizationContext

public void setSynchronizationContext(ISynchronizationContext context)
Sets the synchronization context for this file buffer manager, i.e., for all file buffers this manager manages.

Parameters:
context - the synchronization context managed by this file buffer manager

requestSynchronizationContext

public void requestSynchronizationContext(IPath location)
The caller requests that the synchronization context is used to synchronize the given location with its file buffer. This call as no effect if there is no file buffer managed for the given location.

The provided location is either a full path of a workspace resource or an absolute path in the local file system. The file buffer manager does not resolve the location of workspace resources in the case of linked resources.

Parameters:
location - the location

releaseSynchronizationContext

public void releaseSynchronizationContext(IPath location)
The caller no longer requests the synchronization context for the file buffer managed for the given location. This method has no effect if there is no file buffer managed for this location.

The provided location is either a full path of a workspace resource or an absolute path in the local file system. The file buffer manager does not resolve the location of workspace resources in the case of linked resources.

Parameters:
location - the location

addFileBufferListener

public void addFileBufferListener(IFileBufferListener listener)
Adds the given listener to the list of file buffer listeners. After that call the listener is informed about changes related to this file buffer manager. If the listener is already registered with the file buffer, this call has no effect.

Parameters:
listener - the listener to be added

removeFileBufferListener

public void removeFileBufferListener(IFileBufferListener listener)
Removes the given listener from the list of file buffer listeners. If the listener is not registered with this file buffer, this call has no effect.

Parameters:
listener - the listener to be removed

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.