Package org.eclipse.handly.buffer

# Interface ICoreTextFileBufferProvider

public interface ICoreTextFileBufferProvider
An object capable of providing `ITextFileBuffer` for an underlying file. Essentially, combines an `ITextFileBufferManager` and a file location.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `connect(org.eclipse.core.runtime.IProgressMonitor monitor)`
  Connects the underlying file buffer to this provider.
  `void`
  `disconnect(org.eclipse.core.runtime.IProgressMonitor monitor)`
  Disconnects the underlying file buffer from this provider.
  `static ICoreTextFileBufferProvider`
  `forFileStore(org.eclipse.core.filesystem.IFileStore fileStore, org.eclipse.core.filebuffers.ITextFileBufferManager bufferManager)`
  Returns an `ICoreTextFileBufferProvider` for the given file store and buffer manager.
  `static ICoreTextFileBufferProvider`
  `forLocation(org.eclipse.core.runtime.IPath location, org.eclipse.core.filebuffers.LocationKind locationKind, org.eclipse.core.filebuffers.ITextFileBufferManager bufferManager)`
  Returns an `ICoreTextFileBufferProvider` for the given file location and buffer manager.
  `org.eclipse.core.filebuffers.ITextFileBuffer`
  `getBuffer()`
  Returns the `ITextFileBuffer` managed for the underlying file, or `null` if there is no such buffer.
  `org.eclipse.core.filebuffers.ITextFileBufferManager`
  `getBufferManager()`
  Returns the underlying `ITextFileBufferManager`.

- ## Method Details

  - ### connect

    void connect(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
    Connects the underlying file buffer to this provider. After this method has successfully completed it is guaranteed that each invocation of `getBuffer()` returns the same buffer instance until `disconnect` is called.
    Parameters:
      `monitor` - a progress monitor, or `null` if progress reporting is not desired. The caller must not rely on `IProgressMonitor.done()` having been called by the receiver
    Throws:
      `org.eclipse.core.runtime.CoreException` - if the file buffer could not be connected
      `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled

  - ### disconnect

    void disconnect(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
    Disconnects the underlying file buffer from this provider. After this method has successfully completed there is no guarantee that `getBuffer()` will return a valid buffer.
    Parameters:
      `monitor` - a progress monitor, or `null` if progress reporting is not desired. The caller must not rely on `IProgressMonitor.done()` having been called by the receiver
    Throws:
      `org.eclipse.core.runtime.CoreException` - if the file buffer could not be disconnected
      `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled

  - ### getBuffer

    org.eclipse.core.filebuffers.ITextFileBuffer getBuffer()
    Returns the `ITextFileBuffer` managed for the underlying file, or `null` if there is no such buffer.
    Returns:
      the buffer managed for the underlying file, or `null` if none

  - ### getBufferManager

    org.eclipse.core.filebuffers.ITextFileBufferManager getBufferManager()
    Returns the underlying `ITextFileBufferManager`.
    Returns:
      the underlying buffer manager (never `null`)

  - ### forLocation

    static ICoreTextFileBufferProvider forLocation(org.eclipse.core.runtime.IPath location, org.eclipse.core.filebuffers.LocationKind locationKind, org.eclipse.core.filebuffers.ITextFileBufferManager bufferManager)
    Returns an `ICoreTextFileBufferProvider` for the given file location and buffer manager.
    Parameters:
      `location` - not `null`
      `locationKind` - not `null`
      `bufferManager` - not `null`
    Returns:
      a buffer provider for the given file location and buffer manager (never `null`)

  - ### forFileStore

    static ICoreTextFileBufferProvider forFileStore(org.eclipse.core.filesystem.IFileStore fileStore, org.eclipse.core.filebuffers.ITextFileBufferManager bufferManager)
    Returns an `ICoreTextFileBufferProvider` for the given file store and buffer manager.
    Parameters:
      `fileStore` - not `null`
      `bufferManager` - not `null`
    Returns:
      a buffer provider for the given file store and buffer manager (never `null`)