public abstract class BaseSourceFile extends SourceFile
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.WorkspaceSourceFile
,
FsSourceFile
ISourceFileImplSupport.NotifyingReconcileOperation, ISourceFileImplSupport.ReconcileOperation
IElementImplExtension.CloseHint
SOURCE_AST, SOURCE_CONTENTS, SOURCE_SNAPSHOT
NEW_ELEMENTS, NO_BODY
CLOSE_HINT, FORCE_OPEN
WORKING_COPY_BUFFER, WORKING_COPY_CALLBACK, WORKING_COPY_CONTEXT
Constructor and Description |
---|
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 . |
BaseSourceFile(IElement parent,
java.lang.String name)
Constructs a handle for a source file with the given parent element and
the given name.
|
BaseSourceFile(IElement parent,
java.net.URI locationUri)
Constructs a handle for a source file with the given parent element and
the given file system location URI.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.core.resources.IFile |
getFile_()
Returns the underlying
IFile , or null
if this source file has no underlying file in the workspace. |
java.lang.Object |
getFileObject_()
Returns the underlying file object, if any.
|
java.net.URI |
getLocationUri_()
Returns a file system location for this element.
|
org.eclipse.core.resources.IResource |
getResource_()
Returns the innermost resource enclosing this element, or
null
if this element is not enclosed in a workspace resource. |
equals, getName_, getParent_, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
acquireExistingWorkingCopy_, becomeWorkingCopy_, buildSourceStructure_, buildStructure_, close_, defaultEquals_, defaultHashCode_, fileExists_, getBuffer_, getFileBuffer_, getFileSnapshotProvider_, getReconcileOperation_, getWorkingCopyContext_, isWorkingCopy_, needsReconciling_, newWorkingCopyContext_, openParent_, reconcile_, releaseWorkingCopy_, toStringName_, validateExistence_, workingCopyModeChanged_
checkInRange, getSourceElementAt_, getSourceElementAt_, getSourceElementInfo_
canEqual_, exists_, findBody_, getChildrenFromBody_, getElementManager_, getModel_, isOpenable_, newDoesNotExistException_, open_, peekAtBody_, remove_, removing_, toString_, toStringAncestors_, toStringBody_, toStringChildren_
close_, getBody_, getBody_, getChildren_
getModelManager_
getFileStore_
public BaseSourceFile(IElement parent, org.eclipse.core.resources.IFile file)
IFile
.parent
- the parent of the element,
or null
if the element has no parentfile
- the underlying IFile
(not null
)public BaseSourceFile(IElement parent, java.net.URI locationUri)
EFS.getStore(URI)
. This constructor is intended to be used
for source files that have an underlying IFileStore
outside
the workspace.parent
- the parent of the element,
or null
if the element has no parentlocationUri
- a file system location URI (not null
)public BaseSourceFile(IElement parent, java.lang.String name)
parent
- the parent of the element,
or null
if the element has no parentname
- the name of the element, or null
if the element has no nameSourceFile.SourceFile(IElement, String)
public java.lang.Object getFileObject_()
ISourceFileImplSupport
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.
null
if noneISourceFileImpl.getFile_()
,
ISourceFileImpl.getFileStore_()
public org.eclipse.core.resources.IResource getResource_()
IElementImpl
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
.
null
if this element is not enclosed in a workspace resourcepublic org.eclipse.core.resources.IFile getFile_()
ISourceFileImpl
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.
IFile
, or null
if this source file has no underlying file in the workspacepublic java.net.URI getLocationUri_()
IElementImpl
EFS.getStore(URI)
. Returns
null
if no location can be determined.null
if no location can be determinedCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0