Klasse JavaElement
- Alle implementierten Schnittstellen:
IJavaElement,org.eclipse.core.runtime.IAdaptable
- Bekannte direkte Unterklassen:
Openable,SourceRefElement
- Siehe auch:
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final charstatic final charstatic final charstatic final charstatic final charBefore ')', 'Ungültige Eingabe: "&"' and '"' became the newest additions as delimiters, the former two were allowed as part of element attributes and possibly stored.static final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charstatic final charprotected static final JavaElement[]protected static final Objectprotected static final String[]Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.IJavaElement
ANNOTATION, 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 -
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotectedJavaElement(JavaElement parent) Constructs a handle for a java element with the given parent element. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected voidappendEscapedDelimiter(StringBuffer buffer, char delimiter) voidclose()protected abstract voidThis element is being closed.protected abstract ObjectbooleanReturns true if this handle represents the same Java element as the given handle.protected voidescapeMementoName(StringBuffer buffer, String mementoName) booleanexists()Returns whether this Java element exists in the model.findNode(CompilationUnit ast) Returns theASTNodethat corresponds to thisJavaElementornullif there is no corresponding node.protected abstract voidgenerateInfos(Object info, HashMap newElements, org.eclipse.core.runtime.IProgressMonitor pm) Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable).getAncestor(int ancestorType) Returns this Java element or the first ancestor of this element that has the given type.getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the Javadoc as HTML source if this element has attached Javadoc,nullotherwise.getChildrenOfType(int type) Returns a collection of (immediate) children of this node of the specified type.Returns the info for this handle.getElementInfo(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the info for this handle.Returns the name of this element.abstract IJavaElementgetHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) getHandleFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) Returns a string representation of this element handle.protected voidgetHandleMemento(StringBuffer buff) protected abstract charReturns thecharthat marks the start of this handles contribution to a memento.protected URLReturns the Java model.Returns the Java project this element is contained in, ornullif this element is not contained in any Java project (for instance, theIJavaModelis not contained in any Java project).protected static URLReturns the first openable parent.Return the first instance of IOpenable in the parent hierarchy of this element.Returns the element directly containing this element, ornullif this element has no parent.Returns the primary element (whose compilation unit is the primary compilation unit) this working copy element was created from, or this element if it is a descendant of a primary compilation unit or if it is not a descendant of a working copy (e.g. it is a binary member).getPrimaryElement(boolean checkOwner) org.eclipse.core.resources.IResourceReturns the innermost resource enclosing this element.org.eclipse.core.runtime.jobs.ISchedulingRuleReturns the scheduling rule associated with this Java element.protected IJavaElementgetSourceElementAt(int position) Returns the element that is located at the given source position in this element.Returns the SourceMapper facility for this element, ornullif this element does not have a SourceMapper.protected StringgetURLContents(URL baseLoc, String docUrlValue) booleaninthashCode()Returns the hash code for this Java element.booleanReturns true if this element is an ancestor of the given element, otherwise false.booleanReturns whether this Java element is read-only.protected JavaModelStatusnewJavaModelException(org.eclipse.core.runtime.IStatus status) Creates and returns a new Java model exception for this element with the given status.Creates and returns a new not present exception for this element.protected ObjectopenWhenClosed(Object info, boolean forceAdd, org.eclipse.core.runtime.IProgressMonitor monitor) abstract org.eclipse.core.resources.IResourceresource()protected voidsetParent(JavaElement parent) protected StringtabString(int tab) Debugging purposestoString()Debugging purposesprotected voidtoString(int tab, StringBuffer buffer) Debugging purposesprotected voidtoStringAncestors(StringBuffer buffer) Debugging purposesprotected voidtoStringChildren(int tab, StringBuffer buffer, Object info) Debugging purposestoStringInfo(int tab, StringBuffer buffer) Debugging purposesprotected voidtoStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) Debugging purposesprotected voidtoStringName(StringBuffer buffer) Debugging purposesDebugging purposestoStringWithAncestors(boolean showResolvedInfo) Debugging purposesprotected voidvalidateAndCache(URL baseLoc, FileNotFoundException e) Von Klasse geerbte Methoden org.eclipse.core.runtime.PlatformObject
getAdapterVon Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitVon Schnittstelle geerbte Methoden org.eclipse.core.runtime.IAdaptable
getAdapterVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.IJavaElement
getCorrespondingResource, getElementType, getPath, getUnderlyingResource, isStructureKnown
-
Felddetails
-
JEM_ESCAPE
public static final char JEM_ESCAPE- Siehe auch:
-
JEM_JAVAPROJECT
public static final char JEM_JAVAPROJECT- Siehe auch:
-
JEM_PACKAGEFRAGMENTROOT
public static final char JEM_PACKAGEFRAGMENTROOT- Siehe auch:
-
JEM_PACKAGEFRAGMENT
public static final char JEM_PACKAGEFRAGMENT- Siehe auch:
-
JEM_FIELD
public static final char JEM_FIELD- Siehe auch:
-
JEM_METHOD
public static final char JEM_METHOD- Siehe auch:
-
JEM_INITIALIZER
public static final char JEM_INITIALIZER- Siehe auch:
-
JEM_COMPILATIONUNIT
public static final char JEM_COMPILATIONUNIT- Siehe auch:
-
JEM_CLASSFILE
public static final char JEM_CLASSFILE- Siehe auch:
-
JEM_MODULAR_CLASSFILE
public static final char JEM_MODULAR_CLASSFILE- Siehe auch:
-
JEM_TYPE
public static final char JEM_TYPE- Siehe auch:
-
JEM_PACKAGEDECLARATION
public static final char JEM_PACKAGEDECLARATION- Siehe auch:
-
JEM_IMPORTDECLARATION
public static final char JEM_IMPORTDECLARATION- Siehe auch:
-
JEM_COUNT
public static final char JEM_COUNT- Siehe auch:
-
JEM_LOCALVARIABLE
public static final char JEM_LOCALVARIABLE- Siehe auch:
-
JEM_TYPE_PARAMETER
public static final char JEM_TYPE_PARAMETER- Siehe auch:
-
JEM_ANNOTATION
public static final char JEM_ANNOTATION- Siehe auch:
-
JEM_LAMBDA_EXPRESSION
public static final char JEM_LAMBDA_EXPRESSION- Siehe auch:
-
JEM_LAMBDA_METHOD
public static final char JEM_LAMBDA_METHOD- Siehe auch:
-
JEM_STRING
public static final char JEM_STRING- Siehe auch:
-
JEM_MODULE
public static final char JEM_MODULE- Siehe auch:
-
JEM_DELIMITER_ESCAPE
public static final char JEM_DELIMITER_ESCAPEBefore ')', 'Ungültige Eingabe: "&"' and '"' became the newest additions as delimiters, the former two were allowed as part of element attributes and possibly stored. Trying to recreate elements from such memento would cause undesirable results. Consider the following valid project name: (abc) If we were to use ')' alone as the delimiter and decode the above name, the memento would be wrongly identified to contain a lambda expression. In order to differentiate delimiters from characters that are part of element attributes, the following escape character is being introduced and all the new delimiters must be escaped with this. So, a lambda expression would be written as: "=)..."- Siehe auch:
-
NO_STRINGS
-
NO_ELEMENTS
-
NO_INFO
-
-
Konstruktordetails
-
JavaElement
Constructs a handle for a java element with the given parent element.- Parameter:
parent- The parent of java element- Löst aus:
IllegalArgumentException- if the type is not one of the valid Java element type constants
-
-
Methodendetails
-
close
- Löst aus:
JavaModelException- Siehe auch:
-
closing
This element is being closed. Do any necessary cleanup.- Löst aus:
JavaModelException
-
createElementInfo
-
equals
Returns true if this handle represents the same Java element as the given handle. By default, two handles represent the same element if they are identical or if they represent the same type of element, have equal names, parents, and occurrence counts.If a subclass has other requirements for equality, this method must be overridden.
-
appendEscapedDelimiter
- Siehe auch:
-
escapeMementoName
-
exists
public boolean exists()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns whether this Java element exists in the model.Java elements are handle objects that may or may not be backed by an actual element. Java elements that are backed by an actual element are said to "exist", and this method returns
true. For Java elements that are not working copies, it is always the case that if the element exists, then its parent also exists (provided it has one) and includes the element as one of its children. It is therefore possible to navigated to any existing Java element from the root of the Java model along a chain of existing Java elements. On the other hand, working copies are said to exist until they are destroyed (withIWorkingCopy.destroy). Unlike regular Java elements, a working copy never shows up among the children of its parent element (which may or may not exist).- Angegeben von:
existsin SchnittstelleIJavaElement- Gibt zurück:
trueif this element exists in the Java model, andfalseif this element does not exist- Siehe auch:
-
findNode
Returns theASTNodethat corresponds to thisJavaElementornullif there is no corresponding node. -
generateInfos
protected abstract void generateInfos(Object info, HashMap newElements, org.eclipse.core.runtime.IProgressMonitor pm) throws JavaModelException Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable). Puts the newly created element info in the given map.- Löst aus:
JavaModelException
-
getAncestor
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns this Java element or the first ancestor of this element that has the given type. Returnsnullif no such element can be found. This is a handle-only method.- Angegeben von:
getAncestorin SchnittstelleIJavaElement- Parameter:
ancestorType- the given type- Gibt zurück:
- this Java element or the first ancestor of this element that has the given type, or
nullif no such element can be found - Siehe auch:
-
getChildren
- Löst aus:
JavaModelException- Siehe auch:
-
getChildrenOfType
Returns a collection of (immediate) children of this node of the specified type.- Parameter:
type- - one of the JEM_* constants defined by JavaElement- Löst aus:
JavaModelException
-
getClassFile
- Siehe auch:
-
getCompilationUnit
- Siehe auch:
-
getElementInfo
Returns the info for this handle. If this element is not already open, it and all of its parents are opened. Does not return null. NOTE: BinaryType infos are NOT rooted under JavaElementInfo.- Löst aus:
JavaModelException- if the element is not present or not accessible
-
getElementInfo
public Object getElementInfo(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Returns the info for this handle. If this element is not already open, it and all of its parents are opened. Does not return null. NOTE: BinaryType infos are NOT rooted under JavaElementInfo.- Löst aus:
JavaModelException- if the element is not present or not accessible
-
getElementName
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the name of this element. This is a handle-only method.- Angegeben von:
getElementNamein SchnittstelleIJavaElement- Gibt zurück:
- the element name
- Siehe auch:
-
getHandleFromMemento
public abstract IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) -
getHandleFromMemento
-
getHandleIdentifier
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns a string representation of this element handle. The format of the string is not specified; however, the identifier is stable across workspace sessions, and can be used to recreate this handle via theJavaCore.create(String)method.- Angegeben von:
getHandleIdentifierin SchnittstelleIJavaElement- Gibt zurück:
- the string handle identifier
- Siehe auch:
-
getHandleMemento
- Siehe auch:
-
getHandleMemento
-
getHandleMementoDelimiter
protected abstract char getHandleMementoDelimiter()Returns thecharthat marks the start of this handles contribution to a memento. -
getJavaModel
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the Java model. This is a handle-only method.- Angegeben von:
getJavaModelin SchnittstelleIJavaElement- Gibt zurück:
- the Java model
- Siehe auch:
-
getJavaProject
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the Java project this element is contained in, ornullif this element is not contained in any Java project (for instance, theIJavaModelis not contained in any Java project). This is a handle-only method.- Angegeben von:
getJavaProjectin SchnittstelleIJavaElement- Gibt zurück:
- the containing Java project, or
nullif this element is not contained in a Java project - Siehe auch:
-
getOpenable
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the first openable parent. If this element is openable, the element itself is returned. Returnsnullif this element doesn't have an openable parent. This is a handle-only method.- Angegeben von:
getOpenablein SchnittstelleIJavaElement- Gibt zurück:
- the first openable parent or
nullif this element doesn't have an openable parent.
-
getOpenableParent
Return the first instance of IOpenable in the parent hierarchy of this element.Subclasses that are not IOpenable's must override this method.
-
getParent
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the element directly containing this element, ornullif this element has no parent. This is a handle-only method.- Angegeben von:
getParentin SchnittstelleIJavaElement- Gibt zurück:
- the parent element, or
nullif this element has no parent - Siehe auch:
-
setParent
-
getPrimaryElement
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the primary element (whose compilation unit is the primary compilation unit) this working copy element was created from, or this element if it is a descendant of a primary compilation unit or if it is not a descendant of a working copy (e.g. it is a binary member). The returned element may or may not exist.- Angegeben von:
getPrimaryElementin SchnittstelleIJavaElement- Gibt zurück:
- the primary element this working copy element was created from, or this element.
-
getPrimaryElement
-
getResource
public org.eclipse.core.resources.IResource getResource()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the innermost resource enclosing this element. If this element is included in an archive and this archive is not external, this is the underlying resource corresponding to the archive. If this element is included in an external library,nullis returned. This is a handle-only method.- Angegeben von:
getResourcein SchnittstelleIJavaElement- Gibt zurück:
- the innermost resource enclosing this element,
nullif this element is included in an external archive
-
resource
public abstract org.eclipse.core.resources.IResource resource() -
getSourceElementAt
Returns the element that is located at the given source position in this element. This is a helper method forICompilationUnit#getElementAt, and only works on compilation units and types. The position given is known to be within this element's source range already, and if no finer grained element is found at the position, this element is returned.- Löst aus:
JavaModelException
-
getSourceMapper
Returns the SourceMapper facility for this element, ornullif this element does not have a SourceMapper. -
getSchedulingRule
public org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the scheduling rule associated with this Java element. This is a handle-only method.- Angegeben von:
getSchedulingRulein SchnittstelleIJavaElement- Gibt zurück:
- the scheduling rule associated with this Java element
-
hasChildren
- Löst aus:
JavaModelException- Siehe auch:
-
hashCode
public int hashCode()Returns the hash code for this Java element. By default, the hash code for an element is a combination of its name and parent's hash code. Elements with other requirements must override this method. -
isAncestorOf
Returns true if this element is an ancestor of the given element, otherwise false. -
isReadOnly
public boolean isReadOnly()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns whether this Java element is read-only. An element is read-only if its structure cannot be modified by the java model.Note this is different from IResource.isReadOnly(). For example, .jar files are read-only as the java model doesn't know how to add/remove elements in this file, but the underlying IFile can be writable.
This is a handle-only method.
- Angegeben von:
isReadOnlyin SchnittstelleIJavaElement- Gibt zurück:
trueif this element is read-only- Siehe auch:
-
newNotPresentException
Creates and returns a new not present exception for this element. -
newDoesNotExistStatus
-
newJavaModelException
Creates and returns a new Java model exception for this element with the given status. -
openWhenClosed
protected Object openWhenClosed(Object info, boolean forceAdd, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException - Löst aus:
JavaModelException
-
readableName
-
resolved
-
unresolved
-
tabString
-
toDebugString
Debugging purposes -
toString
Debugging purposes -
toString
Debugging purposes -
toStringWithAncestors
Debugging purposes -
toStringWithAncestors
Debugging purposes -
toStringAncestors
Debugging purposes -
toStringChildren
Debugging purposes -
toStringInfo
Debugging purposes -
toStringInfo
Debugging purposes- Parameter:
showResolvedInfo- TODO
-
toStringName
Debugging purposes -
getJavadocBaseLocation
- Löst aus:
JavaModelException
-
getLibraryJavadocLocation
- Löst aus:
JavaModelException
-
getAttachedJavadoc
public String getAttachedJavadoc(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the Javadoc as HTML source if this element has attached Javadoc,
nullotherwise.This should be used only for binary elements. Source elements will always return
null.The encoding used to read the Javadoc is the one defined by the content type of the file. If none is defined, then the project's encoding of this Java element is used. If the project's encoding cannot be retrieved, then the platform encoding is used.
In case the Javadoc doesn't exist for this element,
nullis returned.The HTML is extracted from the attached Javadoc and provided as is. No transformation or validation is done.
- Angegeben von:
getAttachedJavadocin SchnittstelleIJavaElement- Parameter:
monitor- the given progress monitor, can benull- Gibt zurück:
- the extracted javadoc from the attached javadoc,
nullif none - Löst aus:
JavaModelException- if:- this element does not exist
- retrieving the attached javadoc fails (timed-out, invalid URL, ...)
- the format of the javadoc doesn't match expected standards (different anchors,...)
- Siehe auch:
-
validateAndCache
- Löst aus:
JavaModelException
-
getURLContents
- Löst aus:
JavaModelException
-