Interface IFileBufferManager
- All Known Subinterfaces:
ITextFileBufferManager
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.
Clients are not supposed to implement that interface.
- Since:
- 3.0
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFileBufferListener
(IFileBufferListener listener) Adds the given listener to the list of file buffer listeners.void
connect
(IPath location, LocationKind locationKind, IProgressMonitor monitor) Connects the file at the given location to this manager.void
connect
(IPath location, IProgressMonitor monitor) Deprecated.void
connectFileStore
(IFileStore fileStore, IProgressMonitor monitor) Connects the given file store to this manager.void
disconnect
(IPath location, LocationKind locationKind, IProgressMonitor monitor) Disconnects the file at the given location from this manager.void
disconnect
(IPath location, IProgressMonitor monitor) Deprecated.As of 3.3, replaced bydisconnect(IPath, LocationKind, IProgressMonitor)
void
disconnectFileStore
(IFileStore fileStore, IProgressMonitor monitor) Disconnects the given file store from this manager.void
Executes the given runnable in the synchronization context of this file buffer manager.getFileBuffer
(IPath location) Deprecated.As of 3.3, replaced bygetFileBuffer(IPath, LocationKind)
getFileBuffer
(IPath location, LocationKind locationKind) Returns the file buffer managed for the given location ornull
if there is no such file buffer.Returns all managed file buffers that are currently connected.getFileStoreFileBuffer
(IFileStore fileStore) Returns the file buffer managed for the given file store ornull
if there is no such file buffer.Returns all managed file store file buffers that are currently connected.void
releaseSynchronizationContext
(IPath location) Deprecated.As of 3.1, replaced byIFileBuffer.releaseSynchronizationContext()
void
removeFileBufferListener
(IFileBufferListener listener) Removes the given listener from the list of file buffer listeners.void
requestSynchronizationContext
(IPath location) Deprecated.As of 3.1, replaced byIFileBuffer.requestSynchronizationContext()
void
Sets the synchronization context for this file buffer manager, i.e., for all file buffers this manager manages.void
validateState
(IFileBuffer[] fileBuffers, IProgressMonitor monitor, Object computationContext) Validates the state of the given file buffers and tries to bring the buffer's underlying file into a state in which it can be modified.
-
Method Details
-
connect
Deprecated.As of 3.3, replaced byconnect(IPath, LocationKind, IProgressMonitor)
Connects the file at the given location to this manager. After that call successfully completed it is guaranteed that each call togetFileBuffer
returns the same file buffer untildisconnect
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 connectedmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be connected
-
connect
void connect(IPath location, LocationKind locationKind, 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 togetFileBuffer
returns the same file buffer untildisconnect
is called.The type of the provided location is specified by the given
locationKind
.- Parameters:
location
- the location of the file to be connectedlocationKind
- the kind of the given locationmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be connected- Since:
- 3.3
- See Also:
-
connectFileStore
Connects the given file store to this manager. After that call successfully completed it is guaranteed that each call togetFileBuffer
returns the same file buffer untildisconnect
is called.Note: This API must not be used if the given file store maps to a resource contained in the workspace. A file buffer that has been connected using a path will not be found. The encoding of the file in the workspace will not be considered.
We had to use a different name than
connect
for this method due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=148844- Parameters:
fileStore
- the file store to be connectedmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be connected- Since:
- 3.3
-
disconnect
Deprecated.As of 3.3, replaced bydisconnect(IPath, LocationKind, IProgressMonitor)
Disconnects the file at the given location from this manager. After that call successfully completed there is no guarantee thatgetFileBuffer
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 disconnectedmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be disconnected
-
disconnect
void disconnect(IPath location, LocationKind locationKind, IProgressMonitor monitor) throws CoreException Disconnects the file at the given location from this manager. After that call successfully completed there is no guarantee thatgetFileBuffer
will return a valid file buffer.The type of the provided location is specified by the given
locationKind
.- Parameters:
location
- the location of the file to be disconnectedlocationKind
- the kind of the given locationmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be disconnected- Since:
- 3.3
- See Also:
-
disconnectFileStore
Disconnects the given file store from this manager. After that call successfully completed there is no guarantee thatgetFileBuffer
will return a valid file buffer.Note: This API must not be used if the given file store maps to a resource contained in the workspace. A file buffer that has been connected using a path will not be found. The encoding of the file in the workspace will not be considered.
We had to use a different name than
disconnect
for this method due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=148844- Parameters:
fileStore
- the file store to be disconnectedmonitor
- the progress monitor, ornull
if progress reporting is not desired- Throws:
CoreException
- if the file could not successfully be disconnected- Since:
- 3.3
-
getFileBuffer
Deprecated.As of 3.3, replaced bygetFileBuffer(IPath, LocationKind)
Returns the file buffer managed for the given location ornull
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
-
getFileBuffer
Returns the file buffer managed for the given location ornull
if there is no such file buffer.The type of the provided location is specified by the given
locationKind
.- Parameters:
location
- the locationlocationKind
- the kind of the given location- Returns:
- the file buffer managed for that location or
null
- Since:
- 3.3
- See Also:
-
getFileStoreFileBuffer
Returns the file buffer managed for the given file store ornull
if there is no such file buffer.Note: This API must not be used if the given file store maps to a resource contained in the workspace. A file buffer that has been connected using a path will not be found. The encoding of the file in the workspace will not be considered.
We had to use a different name than
getFileBuffer
for this method due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=148844- Parameters:
fileStore
- the file store- Returns:
- the file buffer managed for that file store or
null
- Since:
- 3.3
-
getFileBuffers
IFileBuffer[] getFileBuffers()Returns all managed file buffers that are currently connected.Note: It is the clients responsibility to handle disconnected file buffers as buffers can be disconnected after calling this method.
- Returns:
- the file buffers managed by this file buffer manager
- Since:
- 3.4
- See Also:
-
getFileStoreFileBuffers
IFileBuffer[] getFileStoreFileBuffers()Returns all managed file store file buffers that are currently connected.Note: It is the clients responsibility to handle disconnected file buffers as buffers can be disconnected after calling this method.
- Returns:
- the file buffers managed by this file buffer manager
- Since:
- 3.4
- See Also:
-
setSynchronizationContext
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
-
execute
Executes the given runnable in the synchronization context of this file buffer manager. If there is no synchronization context connected with this manager, the runnable is directly executed.- Parameters:
runnable
- the runnable to be executed- Since:
- 3.5
-
requestSynchronizationContext
Deprecated.As of 3.1, replaced byIFileBuffer.requestSynchronizationContext()
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
Deprecated.As of 3.1, replaced byIFileBuffer.releaseSynchronizationContext()
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
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
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
-
validateState
void validateState(IFileBuffer[] fileBuffers, IProgressMonitor monitor, Object computationContext) throws CoreException Validates the state of the given file buffers and tries to bring the buffer's underlying file into a state in which it can be modified. File buffers which do not support state validation are left untouched.In case of a single file buffer,
IFileBuffer.validateState(IProgressMonitor, Object)
should be used.- Parameters:
fileBuffers
- the file buffers to validatemonitor
- the progress monitor, ornull
if progress reporting is not desiredcomputationContext
- the context in which the validation is performed, e.g., a SWT shell- Throws:
CoreException
- if the underlying file can not be accessed or its state cannot be changed- Since:
- 3.1
-
connect(IPath, LocationKind, IProgressMonitor)