Interface ISourceFileExtension

All Superinterfaces:
IElement, ISourceElement, ISourceFile

public interface ISourceFileExtension extends ISourceFile
Model implementors may opt to extend this interface, which extends ISourceFile with a number of default methods.

This interface is not intended to be referenced for purposes other than extension.

  • Method Summary

    Modifier and Type
    Method
    Description
    default IBuffer
    Returns a buffer opened for this source file.
    default org.eclipse.core.resources.IFile
    Returns the underlying IFile, or null if this source file has no underlying file in the workspace.
    default boolean
    Returns whether this source file is a working copy.
    default boolean
    Returns whether this source file needs reconciling.
    default void
    reconcile(org.eclipse.core.runtime.IProgressMonitor monitor)
    Reconciles this source file.

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

    equals, hashCode
  • 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.
      Returns:
      the underlying IFile, or null if this source file has no underlying file in the workspace
    • isWorkingCopy

      default 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

      default 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

      default void reconcile(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 or if its buffer has not been modified since the last time it was reconciled.
      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 working copy could not be reconciled
      org.eclipse.core.runtime.OperationCanceledException - if this method is canceled
    • getBuffer

      default IBuffer getBuffer() 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.

      Returns:
      a buffer opened for this source file (never null)
      Throws:
      org.eclipse.core.runtime.CoreException - if this source file does not exist or if an exception occurs while accessing its corresponding resource