Class BaseSourceFile

java.lang.Object
org.eclipse.core.runtime.PlatformObject
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IElement, IElementImpl, IElementImplExtension, ISourceElementImpl, ISourceFileImpl, ISourceFileImplExtension, IElementImplSupport, IModelManager.Provider, ISourceElementImplSupport, ISourceFileImplSupport, ISourceElement, ISourceFile

public abstract class BaseSourceFile extends SourceFile
Provides a skeletal implementation of ISourceFileImplExtension for source files that can have an underlying file in the workspace or outside the workspace. This class is just an implementation convenience. Clients might as well implement a source file by extending SourceFile or implementing ("mixing in") ISourceFileImplSupport directly if extending this class is not possible/desirable for some reason.
Since:
1.3
See Also:
  • Constructor Details

    • BaseSourceFile

      public BaseSourceFile(IElement parent, org.eclipse.core.resources.IFile file)
      Constructs a handle for a source file with the given parent element and the given underlying IFile.
      Parameters:
      parent - the parent of the element, or null if the element has no parent
      file - the underlying IFile (not null)
    • BaseSourceFile

      public BaseSourceFile(IElement parent, URI locationUri)
      Constructs a handle for a source file with the given parent element and the given file system location URI. The URI must be suitable to passing to EFS.getStore(URI). This constructor is intended to be used for source files that have an underlying IFileStore outside the workspace.
      Parameters:
      parent - the parent of the element, or null if the element has no parent
      locationUri - a file system location URI (not null)
    • BaseSourceFile

      public BaseSourceFile(IElement parent, String name)
      Constructs a handle for a source file with the given parent element and the given name. This constructor is intended to be used for source files that have no underlying file object.
      Parameters:
      parent - the parent of the element, or null if the element has no parent
      name - the name of the element, or null if the element has no name
      See Also:
  • Method Details

    • getFileObject_

      public Object getFileObject_()
      Description copied from interface: ISourceFileImplSupport
      Returns the underlying file object, if any. The relationship between a source file and its underlying file object does not change.

      This implementation returns the underlying IFile, if any. If there is no underlying IFile, this implementation returns the corresponding IFileStore (if any), on the assumption that the relationship between this source file and the file store does not change.

      Returns:
      the underlying file object, or null if none
      See Also:
    • getResource_

      public org.eclipse.core.resources.IResource getResource_()
      Description copied from interface: IElementImpl
      Returns the innermost resource enclosing this element, or null if this element is not enclosed in a workspace resource. This is a handle-only method.

      Note that it is safe to call this method and test the return value for null even when org.eclipse.core.resources bundle is not available.

      Since 1.3, this method is no longer abstract. The default implementation always returns null.

      Returns:
      the innermost resource enclosing this element, or null if this element is not enclosed in a workspace resource
    • getFile_

      public org.eclipse.core.resources.IFile getFile_()
      Description copied from interface: ISourceFileImpl
      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
    • getLocationUri_

      public URI getLocationUri_()
      Description copied from interface: IElementImpl
      Returns a file system location for this element. The resulting URI is suitable to passing to EFS.getStore(URI). Returns null if no location can be determined.
      Returns:
      a file system location for this element, or null if no location can be determined