Package org.eclipse.handly.model.impl

# Interface ISourceFileImpl

All Superinterfaces:
  `IElement`, `IElementImpl`, `ISourceElement`, `ISourceElementImpl`, `ISourceFile`

All Known Subinterfaces:
  `ISourceFileImplExtension`, `ISourceFileImplSupport`

All Known Implementing Classes:
  `BaseSourceFile`, `FsSourceFile`, `SourceFile`, `WorkspaceSourceFile`

public interface ISourceFileImpl extends ISourceElementImpl, ISourceFile
All `ISourceFile`s must implement this interface.

Restriction:
  This interface is not intended to be extended by clients.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `IBuffer`
  `getBuffer_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor)`
  Returns a buffer opened for this source file.
  `default org.eclipse.core.resources.IFile`
  `getFile_()`
  Returns the underlying `IFile`, or `null` if this source file has no underlying file in the workspace.
  `default org.eclipse.core.filesystem.IFileStore`
  `getFileStore_()`
  Returns the corresponding `IFileStore`, or `null` if this source file has no corresponding file store.
  `boolean`
  `isWorkingCopy_()`
  Returns whether this source file is a working copy.
  `boolean`
  `needsReconciling_()`
  Returns whether this source file needs reconciling.
  `void`
  `reconcile_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor)`
  Reconciles this source file.

  ### Methods inherited from interface org.eclipse.handly.model.IElement

  `equals, hashCode`

  ### Methods inherited from interface org.eclipse.handly.model.impl.IElementImpl

  `equalsAndSameParentChain_, exists_, fetchChildren_, fetchChildrenOfType_, getChildren_, getChildrenOfType_, getHandleMemento_, getLocationUri_, getModel_, getName_, getParent_, getResource_, getRoot_, toDisplayString_, toString_`

  ### Methods inherited from interface org.eclipse.handly.model.impl.ISourceElementImpl

  `getSourceElementAt_, getSourceElementInfo_`

- ## Method Details

  - ### getFile_

    default org.eclipse.core.resources.IFile getFile_()
    Returns the underlying `IFile`, or `null` if this source file has no underlying file in the workspace. This is a handle-only method.

    This method returns the same value as `IElementImpl.getResource_()`, but saves a downcast.

    Returns:
      the underlying `IFile`, or `null` if this source file has no underlying file in the workspace

  - ### getFileStore_

    default org.eclipse.core.filesystem.IFileStore getFileStore_()
    Returns the corresponding `IFileStore`, or `null` if this source file has no corresponding file store.

    This implementation returns the file store corresponding to the `location URI`, if any.

    Returns:
      the corresponding `IFileStore`, or `null` if this source file has no corresponding file store
    Since:
      1.3

  - ### isWorkingCopy_

    boolean isWorkingCopy_()
    Returns whether this source file is a working copy.
    Returns:
      `true` if this source file is a working copy, and `false` otherwise

  - ### needsReconciling_

    boolean needsReconciling_()
    Returns whether this source file needs reconciling. A source file needs reconciling if it is a working copy and its buffer has been modified since the last time it was reconciled.
    Returns:
      `true` if this source file needs reconciling, and `false` otherwise

  - ### reconcile_

    void reconcile_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
    Reconciles this source file. Does nothing if the source file is not in working copy mode.

    Implementations are encouraged to support the following standard options, which may be specified in the given context:

    - `FORCE_RECONCILING` - Indicates whether reconciling has to be performed even if the working copy buffer has not been modified since the last time the working copy was reconciled.
    Parameters:
      `context` - the operation context (not `null`)
      `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 working copy could not be reconciled
      `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled

  - ### getBuffer_

    IBuffer getBuffer_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
    Returns a buffer opened for this source file. Note that buffers may be shared by multiple clients, so the returned buffer may have unsaved changes if it has been modified by another client.

    The client takes (potentially shared) ownership of the returned buffer and is responsible for releasing it when finished. The buffer will be disposed only after it is released by every owner. The buffer must not be accessed by clients which do not own it.

    A new object may be returned, even for the same underlying buffer, each time this method is invoked. For working copies, the relationship between the source file and the underlying working copy buffer does not change over the lifetime of a working copy.

    Implementations are encouraged to support the following standard options, which may be specified in the given context:

    - `CREATE_BUFFER` - Indicates whether a new buffer should be created if none already exists for this source file.
    Parameters:
      `context` - the operation context (not `null`)
      `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
    Returns:
      a buffer opened for this source file. May return `null` if `CREATE_BUFFER` is `false` in the given context and there is no buffer currently opened for the source file
    Throws:
      `org.eclipse.core.runtime.CoreException` - if this source file does not exist or if an exception occurs while accessing its corresponding resource
      `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled