Class ModularClassFile
- All Implemented Interfaces:
IBufferChangedListener, IClassFile, ICodeAssist, IJavaElement, IModularClassFile, IOpenable, IParent, ISourceReference, ITypeRoot, SuffixConstants, org.eclipse.core.runtime.IAdaptable
-
Field Summary
Fields inherited from class AbstractClassFile
nameFields inherited from class JavaElement
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_STRINGSModifier and TypeFieldDescriptionstatic final charstatic final charstatic final charstatic final charstatic final charBefore ')','&'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 Objectstatic final String[]Fields inherited from interface 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_PARAMETERModifier and TypeFieldDescriptionstatic final intConstant representing an annotation.static final intConstant representing a class file.static final intConstant representing a Java compilation unit.static final intConstant representing a field.static final intConstant representing all import declarations within a compilation unit.static final intConstant representing an import declaration within a compilation unit.static final intConstant representing a stand-alone instance or class initializer.static final intConstant representing a Java model (workspace level object).static final intConstant represents a module descriptor.static final intConstant representing a Java project.static final intConstant representing a local variable declaration.static final intConstant representing a method or constructor.static final intConstant representing a package declaration within a compilation unit.static final intConstant representing a package fragment.static final intConstant representing a package fragment root.static final intConstant representing a type (a class or interface).static final intConstant representing a type parameter declaration.Fields inherited from interface SuffixConstants
EXTENSION_aj, EXTENSION_AJ, EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, EXTENSION_jmod, EXTENSION_JMOD, SUFFIX_aj, SUFFIX_AJ, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_aj, SUFFIX_STRING_AJ, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVAModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final char[]static final char[]static final char[]static final char[]static final char[]static final char[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbuildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map<IJavaElement, IElementInfo> newElements, org.eclipse.core.resources.IResource underlyingResource) Creates the single child element for this class file adding the resulting new handle (of typeIBinaryModule) and info object to the newElements table.voidcodeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) Performs code completion at the given offset position in this compilation unit, reporting results to the given completion requestor.codeSelect(int offset, int length, WorkingCopyOwner owner) Returns the Java elements corresponding to the given selected text in this compilation unit.protected voidescapeMementoName(StringBuilder buffer, String mementoName) booleanexists()Returns whether this Java element exists in the model.Finds the primary type of this Java type root (that is, the type with the same name as the compilation unit, or the type of a class file), ornullif no such a type exists.Returns theIBinaryModulespecific for this IClassFile, based on its underlying resource, ornullif unable to create the diet class file.getElementAt(int position) Returns the smallest element within this Java type root that includes the given source position (that is, a method, field, etc.), ornullif there is no element other than the Java type root itself at the given position, or if the given position is not within the source range of the source of this Java type root.getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) protected charReturns thecharthat marks the start of this handles contribution to a memento.Returns the module description contained in this type root or null if there is no module in this type root.getType()Deprecated.getWorkingCopy(WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) Returns a shared working copy on this compilation unit or class file using the given working copy owner to create the buffer.booleanisClass()Returns whether this type represents a class.booleanReturns whether this type represents an interface.protected IBufferopenBuffer(org.eclipse.core.runtime.IProgressMonitor pm, IElementInfo info) Opens and returns buffer on the source code associated with this class file.Methods inherited from class AbstractClassFile
becomeWorkingCopy, calculateHashCode, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeSelect, createElementInfo, equals, findElement, getBuffer, getBytes, getClassFileContent, getCorrespondingResource, getElementAtConsideringSibling, getElementName, getElementType, getNameRange, getPath, getPathIdentifier, getSource, getSourceRange, getTypeRoot, getWorkingCopy, hasBuffer, isReadOnly, resource, validateExistenceModifier and TypeMethodDescriptionbecomeWorkingCopy(IProblemRequestor problemRequestor, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) Changes this class file handle into a working copy.protected intvoidcodeComplete(int offset, CompletionRequestor requestor) Performs code completion at the given offset position in this compilation unit, reporting results to the given completion requestor.voidcodeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner) Performs code completion at the given offset position in this compilation unit, reporting results to the given completion requestor.voidcodeComplete(int offset, CompletionRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) Performs code completion at the given offset position in this compilation unit, reporting results to the given completion requestor.voidcodeComplete(int offset, ICodeCompletionRequestor requestor) Deprecated.- should use codeComplete(int, ICompletionRequestor) insteadvoidcodeComplete(int offset, ICompletionRequestor requestor) Deprecated.voidcodeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner) Deprecated.codeSelect(int offset, int length) Returns the Java elements corresponding to the given selected text in this compilation unit.protected org.aspectj.org.eclipse.jdt.internal.core.ClassFileInfoReturns a new element info for this element.booleanReturns true if this handle represents the same Java element as the given handle.protected IJavaElementfindElement(IJavaElement elt, int position, SourceMapper mapper) Finds the deepestIJavaElementin the hierarchy ofelt's children (includingeltitself) which has a source range that enclosespositionaccording tomapper.Note: a buffer with no unsaved changes can be closed by the Java Model since it has a finite number of buffers allowed open at one time.byte[]getBytes()Returns the bytes contained in this class file.protected byte[]getClassFileContent(JarPackageFragmentRoot root, String className) org.eclipse.core.resources.IResourceA class file has a corresponding resource unless it is contained in a jar.getElementAtConsideringSibling(int position) Returns the name of this element.intReturns this element's kind encoded as an integer.Returns the name range associated with this element.org.eclipse.core.runtime.IPathgetPath()Returns the path to the innermost resource enclosing this element.Provide a way for clients (like debugger) to determine if two non-equalAbstractClassFileobjects point to the same physical storage.Returns the source code associated with this element.Returns the source range associated with this element.getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor, IBufferFactory factory) Deprecated.protected booleanReturns true if this element may have an associated source buffer, otherwise false.booleanReturns true - class files are always read only.org.eclipse.core.resources.IResourceresource(PackageFragmentRoot root) protected org.eclipse.core.runtime.IStatusvalidateExistence(org.eclipse.core.resources.IResource underlyingResource) Methods inherited from class Openable
bufferChanged, canBeRemovedFromCache, canBufferBeRemovedFromCache, closeBuffer, closing, codeComplete, codeSelect, findRecommendedLineSeparator, generateInfos, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, getUnderlyingResource, hasUnsavedChanges, ignoreErrorStatus, isConsistent, isOpen, isSourceElement, isStructureKnown, makeConsistent, open, openAncestors, resource, resourceExists, saveModifier and TypeMethodDescriptionvoidbufferChanged(BufferChangedEvent event) The buffer associated with this element has changed.booleanbooleancanBufferBeRemovedFromCache(IBuffer buffer) protected voidClose the buffer associated with this element, if any.protected voidThis element is being closed.protected voidcodeComplete(ICompilationUnit cu, ICompilationUnit unitToSkip, int position, CompletionRequestor requestor, WorkingCopyOwner owner, ITypeRoot typeRoot, org.eclipse.core.runtime.IProgressMonitor monitor) protected IJavaElement[]codeSelect(ICompilationUnit cu, int offset, int length, WorkingCopyOwner owner) Finds and returns the recommended line separator for this element.protected voidgenerateInfos(IElementInfo info, Map<IJavaElement, IElementInfo> newElements, org.eclipse.core.runtime.IProgressMonitor monitor) Generates the element infos for this element, its ancestors (if they are not opened) and its children (if it is an Openable).Deprecated.protected BufferManagerReturns the buffer manager for this element.Returns the first openable parent.Find enclosing package fragment root if anyorg.eclipse.core.resources.IResourceReturns the innermost resource enclosing this element.org.eclipse.core.resources.IResourceReturns the smallest underlying resource that contains this element, ornullif this element is not contained in a resource.booleanReturnstrueif this element is open and: its buffer has unsaved changes, or one of its descendants has unsaved changes, or a working copy has been created on one of this element's children and has not yet destroyedprotected booleanignoreErrorStatus(org.eclipse.core.runtime.IStatus status) booleanSubclasses must override as required.booleanisOpen()Returns whether this openable is open.protected booleanReturns true if this represents a source element.booleanReturns whether the structure of this element is known.voidmakeConsistent(org.eclipse.core.runtime.IProgressMonitor monitor) Makes this element consistent with its underlying resource or buffer by updating the element's structure and properties as necessary.voidopen(org.eclipse.core.runtime.IProgressMonitor pm) Opens this element and all parent elements that are not already open.protected voidopenAncestors(Map<IJavaElement, IElementInfo> newElements, org.eclipse.core.runtime.IProgressMonitor monitor) org.eclipse.core.resources.IResourceresource()protected booleanresourceExists(org.eclipse.core.resources.IResource underlyingResource) Returns whether the corresponding resource or associated file existsvoidsave(org.eclipse.core.runtime.IProgressMonitor pm, boolean force) Saves any changes in this element's buffer to its underlying resource via a workspace resource operation.Methods inherited from class JavaElement
appendEscapedDelimiter, close, findNode, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getClassFile, getCompilationUnit, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenableParent, getParent, getPrimaryElement, getPrimaryElement, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hasChildren, hashCode, isAncestorOf, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resetHashCode, resolved, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringInfo, toStringName, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheModifier and TypeMethodDescriptionprotected voidappendEscapedDelimiter(StringBuilder buffer, char delimiter) voidclose()findNode(CompilationUnit ast) Returns theASTNodethat corresponds to thisJavaElementornullif there is no corresponding node.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.getHandleFromMemento(MementoTokenizer memento, WorkingCopyOwner owner) Returns a string representation of this element handle.protected voidprotected 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 URLReturn 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.getPrimaryElement(boolean checkOwner) 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) booleanfinal inthashCode()Returns the hash code for this Java element.booleanReturns true if this element is an ancestor of the given element, otherwise false.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 IElementInfoopenWhenClosed(IElementInfo info, boolean forceAdd, org.eclipse.core.runtime.IProgressMonitor monitor) protected voidshould not be needed but some implementations do have mutable member "occurrenceCount"protected StringtabString(int tab) Debugging purposestoString()Debugging purposesprotected voidtoString(int tab, StringBuilder buffer) Debugging purposesprotected voidtoStringAncestors(StringBuilder buffer) Debugging purposesprotected voidtoStringChildren(int tab, StringBuilder buffer, Object info) Debugging purposestoStringInfo(int tab, StringBuilder buffer) Debugging purposesprotected voidtoStringInfo(int tab, StringBuilder buffer, Object info, boolean showResolvedInfo) Debugging purposesprotected voidtoStringName(StringBuilder buffer) Debugging purposesDebugging purposestoStringWithAncestors(boolean showResolvedInfo) Debugging purposesprotected voidvalidateAndCache(URL baseLoc, FileNotFoundException e) Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapterMethods inherited from interface IParent
getChildren, hasChildrenModifier and TypeMethodDescriptionReturns the immediate children of this element.booleanReturns whether this element has one or more immediate children.
-
Constructor Details
-
ModularClassFile
-
-
Method Details
-
buildStructure
protected boolean buildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map<IJavaElement, IElementInfo> newElements, org.eclipse.core.resources.IResource underlyingResource) throws JavaModelException Creates the single child element for this class file adding the resulting new handle (of typeIBinaryModule) and info object to the newElements table. Returns true if successful, or false if an error is encountered parsing the class file.- Specified by:
buildStructurein classOpenable- Throws:
JavaModelException- See Also:
-
codeComplete
public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ICodeAssistPerforms code completion at the given offset position in this compilation unit, reporting results to the given completion requestor. Theoffsetis the 0-based index of the character, after which code assist is desired. Anoffsetof -1 indicates to code assist at the beginning of this compilation unit. It considers types in the working copies with the given owner first. In other words, the owner's working copies will take precedence over their original compilation units in the workspace.Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
If
IProgressMonitoris notnullthen some proposals which can be very long to compute are proposed. To avoid that the code assist operation take too much time aIProgressMonitorwhich automatically cancel the code assist operation when a specified amount of time is reached could be used.new IProgressMonitor() { private final static int TIMEOUT = 500; //ms private long endTime; public void beginTask(String name, int totalWork) { fEndTime= System.currentTimeMillis() + TIMEOUT; } public boolean isCanceled() { return endTime <= System.currentTimeMillis(); } ... };- Specified by:
codeCompletein interfaceICodeAssist- Specified by:
codeCompletein classAbstractClassFile- Parameters:
offset- the given offset positionrequestor- the given completion requestorowner- the owner of working copies that take precedence over their original compilation unitsmonitor- the progress monitor used to report progress- Throws:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is < -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
-
codeSelect
public IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner) throws JavaModelException Description copied from interface:ICodeAssistReturns the Java elements corresponding to the given selected text in this compilation unit. Theoffsetis the 0-based index of the first selected character. Thelengthis the number of selected characters. It considers types in the working copies with the given owner first. In other words, the owner's working copies will take precedence over their original compilation units in the workspace.Note that if the
lengthis 0 and theoffsetis inside an identifier or the index just after an identifier then this identifier is considered as the selection.Note that if a working copy is empty, it will be as if the original compilation unit had been deleted.
- Specified by:
codeSelectin interfaceICodeAssist- Specified by:
codeSelectin classAbstractClassFile- Parameters:
offset- the given offset positionlength- the number of selected charactersowner- the owner of working copies that take precedence over their original compilation units- Returns:
- the Java elements corresponding to the given selected text
- Throws:
JavaModelException- if code resolve could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The range specified is not within this element's source range (INDEX_OUT_OF_BOUNDS)
-
findPrimaryType
Description copied from interface:ITypeRootFinds the primary type of this Java type root (that is, the type with the same name as the compilation unit, or the type of a class file), ornullif no such a type exists.- Specified by:
findPrimaryTypein interfaceITypeRoot- Returns:
- the found primary type of this Java type root, or
nullif no such a type exists
-
isClass
Description copied from interface:IClassFileReturns whether this type represents a class. This is not guaranteed to be instantaneous, as it may require parsing the underlying file.- Specified by:
isClassin interfaceIClassFile- Returns:
trueif the class file represents a class.- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource
-
isInterface
Description copied from interface:IClassFileReturns whether this type represents an interface. This is not guaranteed to be instantaneous, as it may require parsing the underlying file.- Specified by:
isInterfacein interfaceIClassFile- Returns:
trueif the class file represents an interface.- Throws:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource
-
getType
Deprecated.should only be used asIOrdinaryClassFile.getType().Description copied from interface:IClassFileReturns the type contained in this class file. This is a handle-only method. The type may or may not exist.- Specified by:
getTypein interfaceIClassFile- Returns:
- never returns.
- Throws:
UnsupportedOperationException- always.- See Also:
-
getBinaryModuleInfo
Returns theIBinaryModulespecific for this IClassFile, based on its underlying resource, ornullif unable to create the diet class file. There are two cases to consider:- a class file corresponding to an IFile resource
- a class file corresponding to a zip entry in a JAR
- Throws:
JavaModelException- when the IFile resource or JAR is not available or when this class file is not present in the JAR
-
getElementAt
Description copied from interface:ITypeRootReturns the smallest element within this Java type root that includes the given source position (that is, a method, field, etc.), ornullif there is no element other than the Java type root itself at the given position, or if the given position is not within the source range of the source of this Java type root.- Specified by:
getElementAtin interfaceITypeRoot- Parameters:
position- a source position inside the Java type root- Returns:
- the innermost Java element enclosing a given source position or
nullif none (excluding the Java type root). - Throws:
JavaModelException- if the Java type root does not exist or if an exception occurs while accessing its corresponding resource- See Also:
-
getHandleFromMemento
public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) - Specified by:
getHandleFromMementoin classJavaElement
-
getHandleMementoDelimiter
protected char getHandleMementoDelimiter()Description copied from class:JavaElementReturns thecharthat marks the start of this handles contribution to a memento.- Specified by:
getHandleMementoDelimiterin classJavaElement- See Also:
-
escapeMementoName
- Overrides:
escapeMementoNamein classJavaElement
-
getWorkingCopy
public ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Description copied from interface:ITypeRootReturns a shared working copy on this compilation unit or class file using the given working copy owner to create the buffer. If this is already a working copy of the given owner, the element itself is returned. This API can only answer an already existing working copy if it is based on the same original Java type root AND was using the same working copy owner (that is, as defined byObject.equals(Object)).The life time of a shared working copy is as follows:
- The first call to
ITypeRoot.getWorkingCopy(WorkingCopyOwner, IProgressMonitor)creates a new working copy for this element - Subsequent calls increment an internal counter.
- A call to
ICompilationUnit.discardWorkingCopy()decrements the internal counter. - When this counter is 0, the working copy is discarded.
Note that the working copy owner will be used for the life time of the shared working copy, that is if the working copy is closed then reopened, this owner will be used. The buffer will be automatically initialized with the original's Java type root content upon creation.
When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.
A working copy can be created on a not-yet existing compilation unit. In particular, such a working copy can then be committed in order to create the corresponding compilation unit.
Note that possible problems of this working copy are reported using this method only if the given working copy owner returns a problem requestor for this working copy (see
WorkingCopyOwner.getProblemRequestor(ICompilationUnit)).- Specified by:
getWorkingCopyin interfaceITypeRoot- Parameters:
owner- the working copy owner that creates a buffer that is used to get the content of the working copymonitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reported- Returns:
- a new working copy of this Java type root using the given owner to create the buffer, or this Java type root if it is already a working copy
- Throws:
JavaModelException- if the contents of this element can not be determined.
- The first call to
-
openBuffer
protected IBuffer openBuffer(org.eclipse.core.runtime.IProgressMonitor pm, IElementInfo info) throws JavaModelException Opens and returns buffer on the source code associated with this class file. Maps the source code to the children elements of this class file. If no source code is associated with this class file,nullis returned.- Overrides:
openBufferin classOpenable- Throws:
JavaModelException- See Also:
-
getModule
Description copied from interface:ITypeRootReturns the module description contained in this type root or null if there is no module in this type root.Only subtype
IModularClassFilepromises to return non-null.- Specified by:
getModulein interfaceIModularClassFile- Specified by:
getModulein interfaceITypeRoot- Returns:
- the module description contained in the type root or null.
- Throws:
JavaModelException
-
exists
public boolean exists()Description copied from interface: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).- Specified by:
existsin interfaceIJavaElement- Specified by:
existsin interfaceISourceReference- Overrides:
existsin classOpenable- Returns:
trueif this element exists in the Java model, andfalseif this element does not exist- See Also:
-
IOrdinaryClassFile.getType().