public abstract class SourceRefElement extends JavaElement implements ISourceReference
| Modifier and Type | Field and Description |
|---|---|
int |
occurrenceCount |
JEM_ANNOTATION, JEM_CLASSFILE, JEM_COMPILATIONUNIT, JEM_COUNT, JEM_DELIMITER_ESCAPE, JEM_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LAMBDA_EXPRESSION, JEM_LAMBDA_METHOD, JEM_LOCALVARIABLE, JEM_METHOD, JEM_MODULAR_CLASSFILE, JEM_MODULE, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_STRING, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, NO_STRINGS, parentANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER| Modifier | Constructor and Description |
|---|---|
protected |
SourceRefElement(JavaElement parent) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closing(java.lang.Object info)
This element is being closed.
|
void |
copy(IJavaElement container,
IJavaElement sibling,
java.lang.String rename,
boolean force,
IProgressMonitor monitor) |
protected java.lang.Object |
createElementInfo()
Returns a new element info for this element.
|
void |
delete(boolean force,
IProgressMonitor monitor) |
boolean |
equals(java.lang.Object o)
Returns true if this handle represents the same Java element
as the given handle.
|
ASTNode |
findNode(CompilationUnit ast)
Returns the
ASTNode that corresponds to this JavaElement
or null if there is no corresponding node. |
protected void |
generateInfos(java.lang.Object info,
java.util.HashMap newElements,
IProgressMonitor pm)
Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable).
|
IAnnotation |
getAnnotation(java.lang.String name) |
IAnnotation[] |
getAnnotations() |
ICompilationUnit |
getCompilationUnit() |
IResource |
getCorrespondingResource()
Elements within compilation units and class files have no
corresponding resource.
|
IJavaElement |
getHandleFromMemento(java.lang.String token,
MementoTokenizer memento,
WorkingCopyOwner workingCopyOwner) |
protected void |
getHandleMemento(java.lang.StringBuffer buff) |
IJavaElement |
getHandleUpdatingCountFromMemento(MementoTokenizer memento,
WorkingCopyOwner owner) |
int |
getOccurrenceCount() |
IOpenable |
getOpenableParent()
Return the first instance of IOpenable in the hierarchy of this
type (going up the hierarchy from this type);
|
IPath |
getPath()
Returns the path to the innermost resource enclosing this element.
|
java.lang.String |
getSource()
Returns the source code associated with this element.
|
ISourceRange |
getSourceRange()
Returns the source range associated with this element.
|
IResource |
getUnderlyingResource()
Returns the smallest underlying resource that contains
this element, or
null if this element is not contained
in a resource. |
boolean |
hasChildren() |
boolean |
isStructureKnown()
Returns whether the structure of this element is known.
|
void |
move(IJavaElement container,
IJavaElement sibling,
java.lang.String rename,
boolean force,
IProgressMonitor monitor) |
void |
rename(java.lang.String newName,
boolean force,
IProgressMonitor monitor) |
IResource |
resource() |
protected void |
toStringName(java.lang.StringBuffer buffer)
Debugging purposes
|
appendEscapedDelimiter, close, escapeMementoName, exists, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getClassFile, getElementInfo, getElementInfo, getElementName, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getHandleMementoDelimiter, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenable, getParent, getPrimaryElement, getPrimaryElement, getResource, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hashCode, isAncestorOf, isReadOnly, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheclone, finalize, getClass, notify, notifyAll, wait, wait, waitexists, getNameRangegetElementTypeprotected SourceRefElement(JavaElement parent)
protected void closing(java.lang.Object info)
throws JavaModelException
closing in class JavaElementJavaModelExceptionprotected java.lang.Object createElementInfo()
createElementInfo in class JavaElementpublic void copy(IJavaElement container, IJavaElement sibling, java.lang.String rename, boolean force, IProgressMonitor monitor) throws JavaModelException
JavaModelExceptionISourceManipulationpublic void delete(boolean force,
IProgressMonitor monitor)
throws JavaModelException
JavaModelExceptionISourceManipulationpublic boolean equals(java.lang.Object o)
JavaElementIf a subclass has other requirements for equality, this method must be overridden.
equals in class JavaElementObject.equals(java.lang.Object)public ASTNode findNode(CompilationUnit ast)
ASTNode that corresponds to this JavaElement
or null if there is no corresponding node.findNode in class JavaElementprotected void generateInfos(java.lang.Object info,
java.util.HashMap newElements,
IProgressMonitor pm)
throws JavaModelException
JavaElementgenerateInfos in class JavaElementJavaModelExceptionpublic IAnnotation getAnnotation(java.lang.String name)
public IAnnotation[] getAnnotations() throws JavaModelException
JavaModelExceptionpublic ICompilationUnit getCompilationUnit()
getCompilationUnit in class JavaElementIMemberpublic IResource getCorrespondingResource()
throws JavaModelException
getCorrespondingResource in interface IJavaElementnull if noneJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIJavaElementpublic IJavaElement getHandleFromMemento(java.lang.String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner)
getHandleFromMemento in class JavaElementprotected void getHandleMemento(java.lang.StringBuffer buff)
getHandleMemento in class JavaElementpublic IJavaElement getHandleUpdatingCountFromMemento(MementoTokenizer memento, WorkingCopyOwner owner)
public int getOccurrenceCount()
public IOpenable getOpenableParent()
getOpenableParent in class JavaElementpublic IPath getPath()
IJavaElementgetPath in interface IJavaElementpublic IResource resource()
resource in class JavaElementpublic java.lang.String getSource()
throws JavaModelException
ISourceReferencegetSourceRange.
For class files, this returns the source of the entire compilation unit associated with the class file (if there is one).
getSource in interface ISourceReferencenull if this element has no
associated source codeJavaModelException - if an exception occurs while accessing its corresponding resourceISourceReferencepublic ISourceRange getSourceRange() throws JavaModelException
ISourceReferenceFor class files, this returns the range of the entire compilation unit associated with the class file (if there is one).
If this element has no associated source code, either null is returned,
or a source range with a -1 offset and a 0 length. SourceRange.isAvailable(ISourceRange)
can be used to detect that case.
getSourceRange in interface ISourceReferencenull or [-1, 0] if this element has no
associated source codeJavaModelException - if an exception occurs while accessing its corresponding resourceISourceReferencepublic IResource getUnderlyingResource()
throws JavaModelException
IJavaElementnull if this element is not contained
in a resource.getUnderlyingResource in interface IJavaElementnull if noneJavaModelException - if this element does not exist or if an
exception occurs while accessing its underlying resourceIJavaElementpublic boolean hasChildren()
throws JavaModelException
hasChildren in class JavaElementJavaModelExceptionIParentpublic boolean isStructureKnown()
throws JavaModelException
IJavaElementfalse is returned.
If the structure of an element is unknown, navigations will return reasonable
defaults. For example, getChildren for a compilation unit with
syntax errors will return a collection of the children that could be parsed.
Note: This does not imply anything about consistency with the underlying resource/buffer contents.
isStructureKnown in interface IJavaElementtrue if the structure of this element is knownJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resourceIJavaElementpublic void move(IJavaElement container, IJavaElement sibling, java.lang.String rename, boolean force, IProgressMonitor monitor) throws JavaModelException
JavaModelExceptionISourceManipulationpublic void rename(java.lang.String newName,
boolean force,
IProgressMonitor monitor)
throws JavaModelException
JavaModelExceptionISourceManipulationprotected void toStringName(java.lang.StringBuffer buffer)
JavaElementtoStringName in class JavaElement