Klasse JavaElement
- Alle implementierten Schnittstellen:
IJavaElement
,org.eclipse.core.runtime.IAdaptable
- Bekannte direkte Unterklassen:
Openable
,SourceRefElement
- Siehe auch:
-
Feldübersicht
Modifizierer und TypFeldBeschreibungstatic final char
static final char
static final char
static final char
static final char
Before ')', '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 char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
protected static final JavaElement[]
protected static final Object
protected 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
ModifiziererKonstruktorBeschreibungprotected
JavaElement
(JavaElement parent) Constructs a handle for a java element with the given parent element. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected void
appendEscapedDelimiter
(StringBuffer buffer, char delimiter) void
close()
protected abstract void
This element is being closed.protected abstract Object
boolean
Returns true if this handle represents the same Java element as the given handle.protected void
escapeMementoName
(StringBuffer buffer, String mementoName) boolean
exists()
Returns whether this Java element exists in the model.findNode
(CompilationUnit ast) Returns theASTNode
that corresponds to thisJavaElement
ornull
if there is no corresponding node.protected abstract void
generateInfos
(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,null
otherwise.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 IJavaElement
getHandleFromMemento
(String token, MementoTokenizer memento, WorkingCopyOwner owner) getHandleFromMemento
(MementoTokenizer memento, WorkingCopyOwner owner) Returns a string representation of this element handle.protected void
getHandleMemento
(StringBuffer buff) protected abstract char
Returns thechar
that marks the start of this handles contribution to a memento.protected URL
Returns the Java model.Returns the Java project this element is contained in, ornull
if this element is not contained in any Java project (for instance, theIJavaModel
is not contained in any Java project).protected static URL
Returns the first openable parent.Return the first instance of IOpenable in the parent hierarchy of this element.Returns the element directly containing this element, ornull
if 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.IResource
Returns the innermost resource enclosing this element.org.eclipse.core.runtime.jobs.ISchedulingRule
Returns the scheduling rule associated with this Java element.protected IJavaElement
getSourceElementAt
(int position) Returns the element that is located at the given source position in this element.Returns the SourceMapper facility for this element, ornull
if this element does not have a SourceMapper.protected String
getURLContents
(URL baseLoc, String docUrlValue) boolean
int
hashCode()
Returns the hash code for this Java element.boolean
Returns true if this element is an ancestor of the given element, otherwise false.boolean
Returns whether this Java element is read-only.protected JavaModelStatus
newJavaModelException
(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 Object
openWhenClosed
(Object info, boolean forceAdd, org.eclipse.core.runtime.IProgressMonitor monitor) abstract org.eclipse.core.resources.IResource
resource()
protected void
setParent
(JavaElement parent) protected String
tabString
(int tab) Debugging purposestoString()
Debugging purposesprotected void
toString
(int tab, StringBuffer buffer) Debugging purposesprotected void
toStringAncestors
(StringBuffer buffer) Debugging purposesprotected void
toStringChildren
(int tab, StringBuffer buffer, Object info) Debugging purposestoStringInfo
(int tab, StringBuffer buffer) Debugging purposesprotected void
toStringInfo
(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) Debugging purposesprotected void
toStringName
(StringBuffer buffer) Debugging purposesDebugging purposestoStringWithAncestors
(boolean showResolvedInfo) Debugging purposesprotected void
validateAndCache
(URL baseLoc, FileNotFoundException e) Von Klasse geerbte Methoden org.eclipse.core.runtime.PlatformObject
getAdapter
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden org.eclipse.core.runtime.IAdaptable
getAdapter
Von 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:IJavaElement
Returns 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:
exists
in SchnittstelleIJavaElement
- Gibt zurück:
true
if this element exists in the Java model, andfalse
if this element does not exist- Siehe auch:
-
findNode
Returns theASTNode
that corresponds to thisJavaElement
ornull
if 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:IJavaElement
Returns this Java element or the first ancestor of this element that has the given type. Returnsnull
if no such element can be found. This is a handle-only method.- Angegeben von:
getAncestor
in 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
null
if 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:IJavaElement
Returns the name of this element. This is a handle-only method.- Angegeben von:
getElementName
in 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:IJavaElement
Returns 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:
getHandleIdentifier
in SchnittstelleIJavaElement
- Gibt zurück:
- the string handle identifier
- Siehe auch:
-
getHandleMemento
- Siehe auch:
-
getHandleMemento
-
getHandleMementoDelimiter
protected abstract char getHandleMementoDelimiter()Returns thechar
that marks the start of this handles contribution to a memento. -
getJavaModel
Beschreibung aus Schnittstelle kopiert:IJavaElement
Returns the Java model. This is a handle-only method.- Angegeben von:
getJavaModel
in SchnittstelleIJavaElement
- Gibt zurück:
- the Java model
- Siehe auch:
-
getJavaProject
Beschreibung aus Schnittstelle kopiert:IJavaElement
Returns the Java project this element is contained in, ornull
if this element is not contained in any Java project (for instance, theIJavaModel
is not contained in any Java project). This is a handle-only method.- Angegeben von:
getJavaProject
in SchnittstelleIJavaElement
- Gibt zurück:
- the containing Java project, or
null
if this element is not contained in a Java project - Siehe auch:
-
getOpenable
Beschreibung aus Schnittstelle kopiert:IJavaElement
Returns the first openable parent. If this element is openable, the element itself is returned. Returnsnull
if this element doesn't have an openable parent. This is a handle-only method.- Angegeben von:
getOpenable
in SchnittstelleIJavaElement
- Gibt zurück:
- the first openable parent or
null
if 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:IJavaElement
Returns the element directly containing this element, ornull
if this element has no parent. This is a handle-only method.- Angegeben von:
getParent
in SchnittstelleIJavaElement
- Gibt zurück:
- the parent element, or
null
if this element has no parent - Siehe auch:
-
setParent
-
getPrimaryElement
Beschreibung aus Schnittstelle kopiert:IJavaElement
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). The returned element may or may not exist.- Angegeben von:
getPrimaryElement
in 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:IJavaElement
Returns 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,null
is returned. This is a handle-only method.- Angegeben von:
getResource
in SchnittstelleIJavaElement
- Gibt zurück:
- the innermost resource enclosing this element,
null
if 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, ornull
if this element does not have a SourceMapper. -
getSchedulingRule
public org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()Beschreibung aus Schnittstelle kopiert:IJavaElement
Returns the scheduling rule associated with this Java element. This is a handle-only method.- Angegeben von:
getSchedulingRule
in 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:IJavaElement
Returns 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:
isReadOnly
in SchnittstelleIJavaElement
- Gibt zurück:
true
if 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:IJavaElement
Returns the Javadoc as HTML source if this element has attached Javadoc,
null
otherwise.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,
null
is returned.The HTML is extracted from the attached Javadoc and provided as is. No transformation or validation is done.
- Angegeben von:
getAttachedJavadoc
in SchnittstelleIJavaElement
- Parameter:
monitor
- the given progress monitor, can benull
- Gibt zurück:
- the extracted javadoc from the attached javadoc,
null
if 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
-