Class BaseSourceFile
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.handly.model.impl.support.Element
org.eclipse.handly.model.impl.support.SourceFile
org.eclipse.handly.model.impl.support.BaseSourceFile
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,IElement,IElementImpl,IElementImplExtension,ISourceElementImpl,ISourceFileImpl,ISourceFileImplExtension,IElementImplSupport,IModelManager.Provider,ISourceElementImplSupport,ISourceFileImplSupport,ISourceElement,ISourceFile
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.handly.model.impl.IElementImplExtension
IElementImplExtension.CloseHintNested classes/interfaces inherited from interface org.eclipse.handly.model.impl.support.ISourceFileImplSupport
ISourceFileImplSupport.NotifyingReconcileOperation, ISourceFileImplSupport.ReconcileOperation -
Field Summary
Fields inherited from interface org.eclipse.handly.model.impl.IElementImplExtension
CLOSE_HINT, FORCE_OPENFields inherited from interface org.eclipse.handly.model.impl.support.IElementImplSupport
NEW_ELEMENTS, NO_BODYFields inherited from interface org.eclipse.handly.model.impl.ISourceFileImplExtension
WORKING_COPY_BUFFER, WORKING_COPY_CALLBACK, WORKING_COPY_CONTEXTFields inherited from interface org.eclipse.handly.model.impl.support.ISourceFileImplSupport
SOURCE_AST, SOURCE_CONTENTS, SOURCE_SNAPSHOT -
Constructor Summary
ConstructorsConstructorDescriptionBaseSourceFile(IElement parent, String name) Constructs a handle for a source file with the given parent element and the given name.BaseSourceFile(IElement parent, URI locationUri) Constructs a handle for a source file with the given parent element and the given file system location URI.BaseSourceFile(IElement parent, org.eclipse.core.resources.IFile file) Constructs a handle for a source file with the given parent element and the given underlyingIFile. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.core.resources.IFilegetFile_()Returns the underlyingIFile, ornullif this source file has no underlying file in the workspace.Returns the underlying file object, if any.Returns a file system location for this element.org.eclipse.core.resources.IResourceReturns the innermost resource enclosing this element, ornullif this element is not enclosed in a workspace resource.Methods inherited from class org.eclipse.handly.model.impl.support.Element
equals, getName_, getParent_, hashCode, toStringMethods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapterMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.handly.model.impl.IElementImpl
equalsAndSameParentChain_, fetchChildren_, fetchChildrenOfType_, getChildrenOfType_, getHandleMemento_, getName_, getParent_, getRoot_, toDisplayString_Methods inherited from interface org.eclipse.handly.model.impl.IElementImplExtension
close_, getBody_, getBody_, getChildren_Methods inherited from interface org.eclipse.handly.model.impl.support.IElementImplSupport
canEqual_, exists_, findBody_, getChildrenFromBody_, getElementManager_, getModel_, isOpenable_, newDoesNotExistException_, open_, peekAtBody_, remove_, removing_, toString_, toStringAncestors_, toStringBody_, toStringChildren_Methods inherited from interface org.eclipse.handly.model.impl.support.IModelManager.Provider
getModelManager_Methods inherited from interface org.eclipse.handly.model.impl.support.ISourceElementImplSupport
getSourceElementAt_, getSourceElementAt_, getSourceElementInfo_Methods inherited from interface org.eclipse.handly.model.impl.ISourceFileImpl
getFileStore_Methods inherited from interface org.eclipse.handly.model.impl.support.ISourceFileImplSupport
acquireExistingWorkingCopy_, becomeWorkingCopy_, buildSourceStructure_, buildStructure_, close_, defaultEquals_, defaultHashCode_, fileExists_, getBuffer_, getFileBuffer_, getFileSnapshotProvider_, getReconcileOperation_, getWorkingCopyContext_, isWorkingCopy_, needsReconciling_, newWorkingCopyContext_, openParent_, reconcile_, releaseWorkingCopy_, toStringName_, validateExistence_, workingCopyModeChanged_
-
Constructor Details
-
BaseSourceFile
Constructs a handle for a source file with the given parent element and the given underlyingIFile.- Parameters:
parent- the parent of the element, ornullif the element has no parentfile- the underlyingIFile(notnull)
-
BaseSourceFile
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 toEFS.getStore(URI). This constructor is intended to be used for source files that have an underlyingIFileStoreoutside the workspace.- Parameters:
parent- the parent of the element, ornullif the element has no parentlocationUri- a file system location URI (notnull)
-
BaseSourceFile
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, ornullif the element has no parentname- the name of the element, ornullif the element has no name- See Also:
-
-
Method Details
-
getFileObject_
Description copied from interface:ISourceFileImplSupportReturns 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 underlyingIFile, this implementation returns the correspondingIFileStore(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
nullif none - See Also:
-
getResource_
public org.eclipse.core.resources.IResource getResource_()Description copied from interface:IElementImplReturns the innermost resource enclosing this element, ornullif 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
nulleven whenorg.eclipse.core.resourcesbundle 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
nullif this element is not enclosed in a workspace resource
-
getFile_
public org.eclipse.core.resources.IFile getFile_()Description copied from interface:ISourceFileImplReturns the underlyingIFile, ornullif 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, ornullif this source file has no underlying file in the workspace
-
getLocationUri_
Description copied from interface:IElementImplReturns a file system location for this element. The resulting URI is suitable to passing toEFS.getStore(URI). Returnsnullif no location can be determined.- Returns:
- a file system location for this element,
or
nullif no location can be determined
-