Klasse CompilationUnit
- Alle implementierten Schnittstellen:
IBufferChangedListener,ICodeAssist,ICompilationUnit,IJavaElement,IOpenable,IParent,ISourceManipulation,ISourceReference,ITypeRoot,IWorkingCopy,ICompilationUnit,IDependent,SuffixConstants,org.eclipse.core.runtime.IAdaptable
- Bekannte direkte Unterklassen:
AssistCompilationUnit,ClassFileWorkingCopy
- Siehe auch:
-
Feldübersicht
FelderVon Klasse geerbte Felder org.aspectj.org.eclipse.jdt.internal.core.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_STRINGSVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.ICompilationUnit
ENABLE_BINDINGS_RECOVERY, ENABLE_STATEMENTS_RECOVERY, FORCE_PROBLEM_DETECTION, IGNORE_METHOD_BODIES, NO_ASTVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.env.IDependent
JAR_FILE_ENTRY_SEPARATORVon 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_PARAMETERVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.util.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_JAVA -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCompilationUnit(PackageFragment parent, String name, WorkingCopyOwner owner) Constructs a handle to a compilation unit with the given name in the specified package for the specified owner -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungorg.eclipse.text.edits.UndoEditapplyTextEdit(org.eclipse.text.edits.TextEdit edit, org.eclipse.core.runtime.IProgressMonitor monitor) Applies a text edit to the compilation unit's buffer.voidbecomeWorkingCopy(IProblemRequestor problemRequestor, org.eclipse.core.runtime.IProgressMonitor monitor) Changes this compilation unit handle into a working copy.voidbecomeWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor) Changes this compilation unit handle into a working copy.protected booleanbuildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map newElements, org.eclipse.core.resources.IResource underlyingResource) Builds this element's structure and properties in the given info object, based on this element's current contents (reuse buffer contents if this element has an open buffer, or resource contents if this element does not have an open buffer).booleanbooleancanBufferBeRemovedFromCache(IBuffer buffer) voidclose()Closes this element and its buffer (if any).protected voidThis element is being closed.voidcodeComplete(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 workingCopyOwner) 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 workingCopyOwner, 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, 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) Veraltet.- use codeComplete(int, ICompletionRequestor)voidcodeComplete(int offset, ICompletionRequestor requestor) Veraltet.voidcodeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner workingCopyOwner) Veraltet.codeSelect(int offset, int length) Returns the Java elements corresponding to the given selected text in this compilation unit.codeSelect(int offset, int length, WorkingCopyOwner workingCopyOwner) Returns the Java elements corresponding to the given selected text in this compilation unit.voidcommit(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Veraltet.voidcommitWorkingCopy(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Commits the contents of this working copy to its underlying resource.voidcopy(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Copies this element to the given container.protected ObjectReturns a new element info for this element.createImport(String importName, IJavaElement sibling, int flags, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns an import declaration in this compilation unit with the given name.createImport(String importName, IJavaElement sibling, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns an non-static import declaration in this compilation unit with the given name.createPackageDeclaration(String pkg, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a package declaration in this compilation unit with the given package name.createType(String content, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Creates and returns a type in this compilation unit with the given contents.voiddelete(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Deletes this element, forcing if specified and necessary.voiddestroy()Veraltet.voidChanges this compilation unit in working copy mode back to its original mode.booleanReturns true if this handle represents the same Java element as the given handle.findElements(IJavaElement element) Finds the elements in this compilation unit that correspond to the given element.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.findSharedWorkingCopy(IBufferFactory factory) Veraltet.findWorkingCopy(WorkingCopyOwner workingCopyOwner) Finds the working copy for this compilation unit, given aWorkingCopyOwner.IType[]Returns all types declared in this compilation unit in the order in which they appear in the source.char[]Answer the contents of the compilation unit.org.eclipse.core.resources.IResourceA compilation unit has a corresponding resource unless it is contained in a jar.Returns the table of the current custom options for this ICompilationUnit.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.Returns the name of this element.intReturns this element's kind encoded as an integer.char[]Answer the file name which defines the type.getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) protected charReturns thecharthat marks the start of this handles contribution to a memento.Returns the first import declaration in this compilation unit with the given name.Returns the import container for this compilation unit.Returns the import declarations in this compilation unit in the order in which they appear in the source.char[]Answer the name of the top level public type.Returns the module description contained in this type root or null if there is no module in this type root.char[]Returns the name of the module to which this compilation unit is associated.Returns the name range associated with this element.getOriginal(IJavaElement workingCopyElement) Veraltet.Veraltet.getOwner()Returnsnullif thisICompilationUnitis the primary working copy, or thisICompilationUnitis not a working copy, otherwise theWorkingCopyOwnerReturns the first package declaration in this compilation unit with the given package name (there normally is at most one package declaration).Returns the package declarations in this compilation unit in the order in which they appear in the source.char[][]Answer the name of the package according to the directory structure or null if package consistency checks should be ignored.org.eclipse.core.runtime.IPathgetPath()Returns the path to the innermost resource enclosing this element.Returns the primary compilation unit (whose owner is the primary owner) this working copy was created from, or this compilation unit if this a primary compilation unit.getPrimaryElement(boolean checkOwner) getSharedWorkingCopy(org.eclipse.core.runtime.IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) Veraltet.Returns the source code associated with this element.Returns the source range associated with this element.Returns the top-level type declared in this compilation unit with the given simple type name.IType[]getTypes()Returns the top-level types declared in this compilation unit in the order in which they appear in the source.org.eclipse.core.resources.IResourceReturns the smallest underlying resource that contains this element, ornullif this element is not contained in a resource.Veraltet.getWorkingCopy(WorkingCopyOwner workingCopyOwner, IProblemRequestor problemRequestor, org.eclipse.core.runtime.IProgressMonitor monitor) Veraltet.getWorkingCopy(WorkingCopyOwner workingCopyOwner, 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.getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor) Returns a new working copy of this compilation unit if it is a primary compilation unit, or this compilation unit if it is already a non-primary working copy.getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor, IBufferFactory factory, IProblemRequestor problemRequestor) Veraltet.protected booleanReturns true if this element may have an associated source buffer, otherwise false.inthashCode()Returns the hash code for this Java element.booleanReturns whether the resource of this working copy has changed since the inception of this working copy.booleanAnswer if optional problems should be ignored for this compilation unit.booleanisBasedOn(org.eclipse.core.resources.IResource resource) Veraltet.booleanSubclasses must override as required.booleanprotected booleanReturns true if this represents a source element.booleanReturns whether this element is a working copy.makeConsistent(int astLevel, boolean resolveBindings, int reconcileFlags, HashMap problems, org.eclipse.core.runtime.IProgressMonitor monitor) 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.voidmove(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) Moves this element to the given container.protected voidopenAncestors(HashMap newElements, org.eclipse.core.runtime.IProgressMonitor monitor) protected IBufferopenBuffer(org.eclipse.core.runtime.IProgressMonitor pm, Object info) Opens a buffer on the contents of this element, and returns the buffer, or returnsnullif opening fails.org.eclipse.core.resources.IMarker[]Veraltet.voidreconcile(boolean forceProblemDetection, org.eclipse.core.runtime.IProgressMonitor monitor) Reconciles the contents of this working copy.reconcile(int astLevel, boolean forceProblemDetection, boolean enableStatementsRecovery, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) Reconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.reconcile(int astLevel, boolean forceProblemDetection, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) Reconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.reconcile(int astLevel, int reconcileFlags, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) Reconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.voidRenames this element to the given name.org.eclipse.core.resources.IResourceresource(PackageFragmentRoot root) voidrestore()Restores the contents of this working copy to the current contents of this working copy's original element.voidsave(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.voidsetOptions(Map<String, String> newOptions) Sets the ICompilationUnit custom options.protected voidtoStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) Debugging purposesprotected voidupdateTimeStamp(CompilationUnit original) protected org.eclipse.core.runtime.IStatusvalidateCompilationUnit(org.eclipse.core.resources.IResource resource) protected org.eclipse.core.runtime.IStatusvalidateExistence(org.eclipse.core.resources.IResource underlyingResource) Von Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.Openable
bufferChanged, closeBuffer, codeComplete, codeSelect, exists, findRecommendedLineSeparator, generateInfos, getBuffer, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, hasUnsavedChanges, ignoreErrorStatus, isOpen, isStructureKnown, open, resource, resourceExistsVon Klasse geerbte Methoden org.aspectj.org.eclipse.jdt.internal.core.JavaElement
appendEscapedDelimiter, escapeMementoName, findNode, getAncestor, getAttachedJavadoc, getChildren, getChildrenOfType, getClassFile, getElementInfo, getElementInfo, getHandleFromMemento, getHandleIdentifier, getHandleMemento, getHandleMemento, getJavadocBaseLocation, getJavaModel, getJavaProject, getLibraryJavadocLocation, getOpenableParent, getParent, getPrimaryElement, getSchedulingRule, getSourceElementAt, getSourceMapper, getURLContents, hasChildren, isAncestorOf, isReadOnly, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, setParent, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringName, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCacheVon 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.ICompilationUnit
getOptionsVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit
getDestinationPath, getExternalAnnotationPath, moduleVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.IJavaElement
exists, getAncestor, getAttachedJavadoc, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isReadOnly, isStructureKnownVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.IOpenable
findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isOpen, openVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.IParent
getChildren, hasChildrenVon Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.ISourceReference
exists
-
Felddetails
-
name
-
owner
-
-
Konstruktordetails
-
CompilationUnit
Constructs a handle to a compilation unit with the given name in the specified package for the specified owner
-
-
Methodendetails
-
applyTextEdit
public org.eclipse.text.edits.UndoEdit applyTextEdit(org.eclipse.text.edits.TextEdit edit, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitApplies a text edit to the compilation unit's buffer.Note that the edit is simply applied to the compilation unit's buffer. In particular the undo edit is not grouped with previous undo edits if the buffer doesn't implement
IBuffer.ITextEditCapability. If it does, the exact semantics for grouping undo edit depends on howIBuffer.ITextEditCapability.applyTextEdit(TextEdit, IProgressMonitor)is implemented.- Angegeben von:
applyTextEditin SchnittstelleICompilationUnit- Parameter:
edit- the edit to applymonitor- the progress monitor to use ornullif no progress should be reported- Gibt zurück:
- the undo edit
- Löst aus:
JavaModelException- if this edit can not be applied to the compilation unit's buffer. Reasons include:- This compilation unit does not exist (
IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST). - The provided edit can not be applied as there is a problem with the text edit locations (
IJavaModelStatusConstants.BAD_TEXT_EDIT_LOCATION).
- This compilation unit does not exist (
-
becomeWorkingCopy
public void becomeWorkingCopy(IProblemRequestor problemRequestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitChanges this compilation unit handle into a working copy. A newIBufferis created using this compilation unit handle's owner. Uses the primary owner if none was specified when this compilation unit handle was created.When switching to working copy mode, problems are reported to given
IProblemRequestor. Note that once in working copy mode, the givenIProblemRequestoris ignored. Only the originalIProblemRequestoris used to report subsequent problems.Once in working copy mode, changes to this compilation unit or its children are done in memory. Only the new buffer is affected. Using
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor)will bring the underlying resource in sync with this compilation unit.If this compilation unit was already in working copy mode, an internal counter is incremented and no other action is taken on this compilation unit. To bring this compilation unit back into the original mode (where it reflects the underlying resource),
ICompilationUnit.discardWorkingCopy()must be call as many times asICompilationUnit.becomeWorkingCopy(IProblemRequestor, IProgressMonitor).- Angegeben von:
becomeWorkingCopyin SchnittstelleICompilationUnit- Parameter:
problemRequestor- a requestor which will get notified of problems detected during reconciling as they are discovered. The requestor can be set tonullindicating that the client is not interested in problems.monitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reported- Löst aus:
JavaModelException- if this compilation unit could not become a working copy.- Siehe auch:
-
becomeWorkingCopy
public void becomeWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitChanges this compilation unit handle into a working copy. A newIBufferis created using this compilation unit handle's owner. Uses the primary owner if none was specified when this compilation unit handle was created.When switching to working copy mode, problems are reported to the
problem requestorof theworking copy owner.Once in working copy mode, changes to this compilation unit or its children are done in memory. Only the new buffer is affected. Using
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor)will bring the underlying resource in sync with this compilation unit.If this compilation unit was already in working copy mode, an internal counter is incremented and no other action is taken on this compilation unit. To bring this compilation unit back into the original mode (where it reflects the underlying resource),
ICompilationUnit.discardWorkingCopy()must be call as many times asICompilationUnit.becomeWorkingCopy(IProblemRequestor, IProgressMonitor).- Angegeben von:
becomeWorkingCopyin SchnittstelleICompilationUnit- Parameter:
monitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reported- Löst aus:
JavaModelException- if this compilation unit could not become a working copy.- Siehe auch:
-
buildStructure
protected boolean buildStructure(OpenableElementInfo info, org.eclipse.core.runtime.IProgressMonitor pm, Map newElements, org.eclipse.core.resources.IResource underlyingResource) throws JavaModelException Beschreibung aus Klasse kopiert:OpenableBuilds this element's structure and properties in the given info object, based on this element's current contents (reuse buffer contents if this element has an open buffer, or resource contents if this element does not have an open buffer). Children are placed in the given newElements table (note, this element has already been placed in the newElements table). Returns true if successful, or false if an error is encountered while determining the structure of this element.- Angegeben von:
buildStructurein KlasseOpenable- Löst aus:
JavaModelException
-
cloneCachingContents
-
canBeRemovedFromCache
public boolean canBeRemovedFromCache()- Setzt außer Kraft:
canBeRemovedFromCachein KlasseOpenable
-
canBufferBeRemovedFromCache
- Setzt außer Kraft:
canBufferBeRemovedFromCachein KlasseOpenable
-
close
Beschreibung aus Schnittstelle kopiert:IOpenableCloses this element and its buffer (if any). Closing an element which is not open has no effect.Note: Although
IOpenable.close()is exposed in the API, clients are not expected to open and close elements - the Java model does this automatically as elements are accessed.- Angegeben von:
closein SchnittstelleIOpenable- Setzt außer Kraft:
closein KlasseJavaElement- Löst aus:
JavaModelException- if an error occurs closing this element- Siehe auch:
-
closing
Beschreibung aus Klasse kopiert:OpenableThis element is being closed. Do any necessary cleanup. -
codeComplete
Veraltet.Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestor- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
- Siehe auch:
-
codeComplete
public void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner workingCopyOwner) throws JavaModelException Veraltet.Beschreibung aus Schnittstelle kopiert: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.
- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestorworkingCopyOwner- the owner of working copies that take precedence over their original compilation units- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
- Siehe auch:
-
codeComplete
Veraltet.- use codeComplete(int, ICompletionRequestor)Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestor- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
- Siehe auch:
-
codeComplete
Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestor- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
-
codeComplete
public void codeComplete(int offset, CompletionRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert: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.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 Ungültige Eingabe: "<"= System.currentTimeMillis(); } ... };- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestormonitor- the progress monitor used to report progress- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
-
codeComplete
public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner workingCopyOwner) throws JavaModelException Beschreibung aus Schnittstelle kopiert: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.
- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestorworkingCopyOwner- the owner of working copies that take precedence over their original compilation units- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
-
codeComplete
public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert: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 Ungültige Eingabe: "<"= System.currentTimeMillis(); } ... };- Angegeben von:
codeCompletein SchnittstelleICodeAssist- Parameter:
offset- the given offset positionrequestor- the given completion requestorworkingCopyOwner- the owner of working copies that take precedence over their original compilation unitsmonitor- the progress monitor used to report progress- Löst aus:
JavaModelException- if code assist could not be performed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- The position specified is Ungültige Eingabe: "<" -1 or is greater than this compilation unit's source length (INDEX_OUT_OF_BOUNDS)
-
codeSelect
Beschreibung aus Schnittstelle kopiert: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.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.- Angegeben von:
codeSelectin SchnittstelleICodeAssist- Parameter:
offset- the given offset positionlength- the number of selected characters- Gibt zurück:
- the Java elements corresponding to the given selected text
- Löst aus:
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)
- Siehe auch:
-
codeSelect
public IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner workingCopyOwner) throws JavaModelException Beschreibung aus Schnittstelle kopiert: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.
- Angegeben von:
codeSelectin SchnittstelleICodeAssist- Parameter:
offset- the given offset positionlength- the number of selected charactersworkingCopyOwner- the owner of working copies that take precedence over their original compilation units- Gibt zurück:
- the Java elements corresponding to the given selected text
- Löst aus:
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)
- Siehe auch:
-
commit
public void commit(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyCommits the contents of this working copy to its original element and underlying resource, bringing the Java model up-to-date with the current contents of the working copy.It is possible that the contents of the original resource have changed since this working copy was created, in which case there is an update conflict. The value of the
forceparameter affects the resolution of such a conflict:-
true- in this case the contents of this working copy are applied to the underlying resource even though this working copy was created before a subsequent change in the resource -
false- in this case aJavaModelExceptionis thrown
Since 2.1, 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.
- Angegeben von:
commitin SchnittstelleIWorkingCopy- Parameter:
force- a flag to handle the cases when the contents of the original resource have changed since this working copy was createdmonitor- the given progress monitor- Löst aus:
JavaModelException- if this working copy could not commit. Reasons include:- A
CoreExceptionoccurred while updating an underlying resource - This element is not a working copy (INVALID_ELEMENT_TYPES)
- A update conflict (described above) (UPDATE_CONFLICT)
- A
- Siehe auch:
-
-
commitWorkingCopy
public void commitWorkingCopy(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitCommits the contents of this working copy to its underlying resource.It is possible that the contents of the original resource have changed since this working copy was created, in which case there is an update conflict. The value of the
forceparameter affects the resolution of such a conflict:-
true- in this case the contents of this working copy are applied to the underlying resource even though this working copy was created before a subsequent change in the resource -
false- in this case aJavaModelExceptionis thrown
Since 2.1, 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.
- Angegeben von:
commitWorkingCopyin SchnittstelleICompilationUnit- Parameter:
force- a flag to handle the cases when the contents of the original resource have changed since this working copy was createdmonitor- the given progress monitor- Löst aus:
JavaModelException- if this working copy could not commit. Reasons include:- A
CoreExceptionoccurred while updating an underlying resource - This element is not a working copy (INVALID_ELEMENT_TYPES)
- A update conflict (described above) (UPDATE_CONFLICT)
- A
- Siehe auch:
-
-
copy
public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ISourceManipulationCopies this element to the given container.- Angegeben von:
copyin SchnittstelleISourceManipulation- Parameter:
container- the containersibling- the sibling element before which the copy should be inserted, ornullif the copy should be inserted as the last child of the containerrename- the new name for the element, ornullif the copy retains the name of this elementforce-trueif any existing child in the container with the target name should be replaced, andfalseto throw an exception in the event of a name collisionmonitor- a progress monitor- Löst aus:
JavaModelException- if this element could not be copied. Reasons include:- This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The container is of an incompatible type (INVALID_DESTINATION)
- The sibling is not a child of the given container (INVALID_SIBLING)
- The new name is invalid (INVALID_NAME)
- A child in the container already exists with the same name (NAME_COLLISION)
and
replacehas been specified asfalse - The container or this element is read-only (READ_ONLY)
- Siehe auch:
-
createElementInfo
Returns a new element info for this element.- Setzt außer Kraft:
createElementInfoin KlasseOpenable
-
createImport
public IImportDeclaration createImport(String importName, IJavaElement sibling, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitCreates and returns an non-static import declaration in this compilation unit with the given name. This method is equivalent tocreateImport(name, Flags.AccDefault, sibling, monitor).- Angegeben von:
createImportin SchnittstelleICompilationUnit- Parameter:
importName- the name of the import declaration to add as defined by JLS2 7.5. (For example:"java.io.File"or"java.awt.*")sibling- the existing element which the import declaration will be inserted immediately before (ifnull, then this import will be inserted as the last import declaration.monitor- the progress monitor to notify- Gibt zurück:
- the newly inserted import declaration (or the previously existing one in case attempting to create a duplicate)
- Löst aus:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist or the specified sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
- The name is not a valid import name (INVALID_NAME)
- Siehe auch:
-
createImport
public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitCreates and returns an import declaration in this compilation unit with the given name.Optionally, the new element can be positioned before the specified sibling. If no sibling is specified, the element will be inserted as the last import declaration in this compilation unit.
If the compilation unit already includes the specified import declaration, the import is not generated (it does not generate duplicates). Note that it is valid to specify both a single-type import and an on-demand import for the same package, for example
"java.io.File"and"java.io.*", in which case both are preserved since the semantics of this are not the same as just importing"java.io.*". Importing"java.lang.*", or the package in which the compilation unit is defined, are not treated as special cases. If they are specified, they are included in the result.Note: This API element is only needed for dealing with Java code that uses new language features of J2SE 5.0.
- Angegeben von:
createImportin SchnittstelleICompilationUnit- Parameter:
importName- the name of the import declaration to add as defined by JLS2 7.5. (For example:"java.io.File"or"java.awt.*")sibling- the existing element which the import declaration will be inserted immediately before (ifnull, then this import will be inserted as the last import declaration.flags-Flags.AccStaticfor static imports, orFlags.AccDefaultfor regular imports; other modifier flags are ignoredmonitor- the progress monitor to notify- Gibt zurück:
- the newly inserted import declaration (or the previously existing one in case attempting to create a duplicate)
- Löst aus:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist or the specified sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
- The name is not a valid import name (INVALID_NAME)
- Seit:
- 3.0
- Siehe auch:
-
createPackageDeclaration
public IPackageDeclaration createPackageDeclaration(String pkg, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitCreates and returns a package declaration in this compilation unit with the given package name.If the compilation unit already includes the specified package declaration, it is not generated (it does not generate duplicates).
- Angegeben von:
createPackageDeclarationin SchnittstelleICompilationUnit- Parameter:
pkg- the name of the package declaration to add as defined by JLS2 7.4. (For example,"java.lang")monitor- the progress monitor to notify- Gibt zurück:
- the newly inserted package declaration (or the previously existing one in case attempting to create a duplicate)
- Löst aus:
JavaModelException- if the element could not be created. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The name is not a valid package name (INVALID_NAME)
- Siehe auch:
-
createType
public IType createType(String content, IJavaElement sibling, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitCreates and returns a type in this compilation unit with the given contents. If this compilation unit does not exist, one will be created with an appropriate package declaration.Optionally, the new type can be positioned before the specified sibling. If
siblingisnull, the type will be appended to the end of this compilation unit.It is possible that a type with the same name already exists in this compilation unit. The value of the
forceparameter affects the resolution of such a conflict:-
true- in this case the type is created with the new contents -
false- in this case aJavaModelExceptionis thrown
- Angegeben von:
createTypein SchnittstelleICompilationUnit- Parameter:
content- the source contents of the type declaration to add.sibling- the existing element which the type will be inserted immediately before (ifnull, then this type will be inserted as the last type declaration.force- abooleanflag indicating how to deal with duplicatesmonitor- the progress monitor to notify- Gibt zurück:
- the newly inserted type
- Löst aus:
JavaModelException- if the element could not be created. Reasons include:- The specified sibling element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
- The contents could not be recognized as a type declaration (INVALID_CONTENTS)
- There was a naming collision with an existing type (NAME_COLLISION)
- Siehe auch:
-
-
delete
public void delete(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ISourceManipulationDeletes this element, forcing if specified and necessary.- Angegeben von:
deletein SchnittstelleISourceManipulation- Parameter:
force- a flag controlling whether underlying resources that are not in sync with the local file system will be tolerated (same as the force flag in IResource operations).monitor- a progress monitor- Löst aus:
JavaModelException- if this element could not be deleted. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource (CORE_EXCEPTION) - This element is read-only (READ_ONLY)
- Siehe auch:
-
destroy
public void destroy()Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyDestroys this working copy, closing its buffer and discarding its structure. Subsequent attempts to access non-handle information for this working copy will result inIJavaModelExceptions. Has no effect if this element is not a working copy.If this working copy is shared, it is destroyed only when the number of calls to
destroy()is the same as the number of calls togetSharedWorkingCopy(IProgressMonitor, IBufferFactory).When it is destroyed, a REMOVED IJavaElementDelta is reported on this working copy.
- Angegeben von:
destroyin SchnittstelleIWorkingCopy- Siehe auch:
-
discardWorkingCopy
Beschreibung aus Schnittstelle kopiert:ICompilationUnitChanges this compilation unit in working copy mode back to its original mode.This has no effect if this compilation unit was not in working copy mode.
If
ICompilationUnit.becomeWorkingCopy(IProgressMonitor)method was called several times on this compilation unit,ICompilationUnit.discardWorkingCopy()must be called as many times before it switches back to the original mode. Same as for methodICompilationUnit.getWorkingCopy(IProgressMonitor).- Angegeben von:
discardWorkingCopyin SchnittstelleICompilationUnit- Löst aus:
JavaModelException- if this working copy could not return in its original mode.- Siehe auch:
-
equals
Returns true if this handle represents the same Java element as the given handle.- Setzt außer Kraft:
equalsin KlasseJavaElement- Siehe auch:
-
hashCode
public int hashCode()Beschreibung aus Klasse kopiert:JavaElementReturns 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.- Setzt außer Kraft:
hashCodein KlasseJavaElement
-
findElements
Beschreibung aus Schnittstelle kopiert:ICompilationUnitFinds the elements in this compilation unit that correspond to the given element. An element A corresponds to an element B if:- A has the same element name as B.
- If A is a method, A must have the same number of arguments as B and the simple names of the argument types must be equals.
- The parent of A corresponds to the parent of B recursively up to their respective compilation units.
- A exists.
nullfor the following cases:- if no such java elements can be found or if the given element is not included in this compilation unit
- the element is a lambda expression, i.e. calling
IType.isLambda()returns true - the element is an
ILocalVariable
- Angegeben von:
findElementsin SchnittstelleICompilationUnit- Angegeben von:
findElementsin SchnittstelleIWorkingCopy- Parameter:
element- the given element- Gibt zurück:
- the found elements in this compilation unit that correspond to the given element
- Siehe auch:
-
findPrimaryType
Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
findPrimaryTypein SchnittstelleITypeRoot- Angegeben von:
findPrimaryTypein SchnittstelleIWorkingCopy- Gibt zurück:
- the found primary type of this Java type root, or
nullif no such a type exists - Siehe auch:
-
findWorkingCopy
Beschreibung aus Schnittstelle kopiert:ICompilationUnitFinds the working copy for this compilation unit, given aWorkingCopyOwner. If no working copy has been created for this compilation unit associated with this working copy owner, returnsnull.Users of this method must not destroy the resulting working copy.
- Angegeben von:
findWorkingCopyin SchnittstelleICompilationUnit- Parameter:
workingCopyOwner- the givenWorkingCopyOwner- Gibt zurück:
- the found working copy for this compilation unit,
nullif none - Siehe auch:
-
getAllTypes
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns all types declared in this compilation unit in the order in which they appear in the source. This includes all top-level types and nested member types. It does NOT include local types (types defined in methods).- Angegeben von:
getAllTypesin SchnittstelleICompilationUnit- Gibt zurück:
- the array of top-level and member types defined in a compilation unit, in declaration order.
- Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getCompilationUnit
- Setzt außer Kraft:
getCompilationUnitin KlasseJavaElement- Siehe auch:
-
getContents
public char[] getContents()Beschreibung aus Schnittstelle kopiert:ICompilationUnitAnswer the contents of the compilation unit. In normal use, the contents are requested twice. Once during the initial lite parsing step, then again for the more detailed parsing step. Implementors must never return null - return an empty char[] instead, CharOperation.NO_CHAR being the candidate of choice.- Angegeben von:
getContentsin SchnittstelleICompilationUnit- Siehe auch:
-
getCorrespondingResource
A compilation unit has a corresponding resource unless it is contained in a jar.- Angegeben von:
getCorrespondingResourcein SchnittstelleIJavaElement- Setzt außer Kraft:
getCorrespondingResourcein KlasseOpenable- Gibt zurück:
- the corresponding resource, or
nullif none - Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getElementAt
Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
getElementAtin SchnittstelleITypeRoot- Parameter:
position- a source position inside the Java type root- Gibt zurück:
- the innermost Java element enclosing a given source position or
nullif none (excluding the Java type root). - Löst aus:
JavaModelException- if the Java type root does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getElementName
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the name of this element. This is a handle-only method.- Angegeben von:
getElementNamein SchnittstelleIJavaElement- Setzt außer Kraft:
getElementNamein KlasseJavaElement- Gibt zurück:
- the element name
- Siehe auch:
-
getElementType
public int getElementType()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns this element's kind encoded as an integer. This is a handle-only method.- Angegeben von:
getElementTypein SchnittstelleIJavaElement- Gibt zurück:
- the kind of element; one of the constants declared in
IJavaElement - Siehe auch:
-
getFileName
public char[] getFileName()Beschreibung aus Schnittstelle kopiert:IDependentAnswer the file name which defines the type. The path part (optional) must be separated from the actual file proper name by a separator suitable for the type (java.io.File.separator for example), e.g. "c:\\source\\com\\p\\X.java" or "/com/p/Y.java". The path to the zip or jar file (optional) must be separated from the actual path part by JAR_FILE_ENTRY_SEPARATOR, e.g. "c:\\lib\\some.jar|/com/p/X.class" or "/lib/some.zip|/com/q/Y.class". The proper file name includes the suffix extension (e.g. ".java") e.g. "c:/org/eclipse/jdt/internal/compileri/env/IDependent.java" Return null if no file defines the type.- Angegeben von:
getFileNamein SchnittstelleIDependent- Siehe auch:
-
getHandleFromMemento
public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner workingCopyOwner) - Angegeben von:
getHandleFromMementoin KlasseJavaElement
-
getHandleMementoDelimiter
protected char getHandleMementoDelimiter()Beschreibung aus Klasse kopiert:JavaElementReturns thecharthat marks the start of this handles contribution to a memento.- Angegeben von:
getHandleMementoDelimiterin KlasseJavaElement- Siehe auch:
-
getImport
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the first import declaration in this compilation unit with the given name. This is a handle-only method. The import declaration may or may not exist. This is a convenience method - imports can also be accessed from a compilation unit's import container.- Angegeben von:
getImportin SchnittstelleICompilationUnit- Parameter:
importName- the name of the import to find as defined by JLS2 7.5. (For example:"java.io.File"or"java.awt.*")- Gibt zurück:
- a handle onto the corresponding import declaration. The import declaration may or may not exist.
- Siehe auch:
-
getImportContainer
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the import container for this compilation unit. This is a handle-only method. The import container may or may not exist. The import container can used to access the imports.- Angegeben von:
getImportContainerin SchnittstelleICompilationUnit- Gibt zurück:
- a handle onto the corresponding import container. The import contain may or may not exist.
- Siehe auch:
-
getImports
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the import declarations in this compilation unit in the order in which they appear in the source. This is a convenience method - import declarations can also be accessed from a compilation unit's import container.- Angegeben von:
getImportsin SchnittstelleICompilationUnit- Gibt zurück:
- the import declarations in this compilation unit
- Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getTypeRoot
- Siehe auch:
-
getMainTypeName
public char[] getMainTypeName()Beschreibung aus Schnittstelle kopiert:ICompilationUnitAnswer the name of the top level public type. For example, {Hashtable}.- Angegeben von:
getMainTypeNamein SchnittstelleICompilationUnit- Siehe auch:
-
getOriginal
Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReturns the original element the specified working copy element was created from, ornullif this is not a working copy element. This is a handle only method, the returned element may or may not exist.- Angegeben von:
getOriginalin SchnittstelleIWorkingCopy- Parameter:
workingCopyElement- the specified working copy element- Gibt zurück:
- the original element the specified working copy element was created from,
or
nullif this is not a working copy element - Siehe auch:
-
getOriginalElement
Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReturns the original element this working copy was created from, ornullif this is not a working copy.- Angegeben von:
getOriginalElementin SchnittstelleIWorkingCopy- Gibt zurück:
- the original element this working copy was created from,
or
nullif this is not a working copy - Siehe auch:
-
getOwner
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturnsnullif thisICompilationUnitis the primary working copy, or thisICompilationUnitis not a working copy, otherwise theWorkingCopyOwner- Angegeben von:
getOwnerin SchnittstelleICompilationUnit- Gibt zurück:
nullif thisICompilationUnitis the primary working copy, or thisICompilationUnitis not a working copy, otherwise theWorkingCopyOwner
-
getPackageDeclaration
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the first package declaration in this compilation unit with the given package name (there normally is at most one package declaration). This is a handle-only method. The package declaration may or may not exist.- Angegeben von:
getPackageDeclarationin SchnittstelleICompilationUnit- Parameter:
pkg- the name of the package declaration as defined by JLS2 7.4. (For example,"java.lang")- Gibt zurück:
- the first package declaration in this compilation unit with the given package name
- Siehe auch:
-
getPackageDeclarations
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the package declarations in this compilation unit in the order in which they appear in the source. There normally is at most one package declaration.- Angegeben von:
getPackageDeclarationsin SchnittstelleICompilationUnit- Gibt zurück:
- an array of package declaration (normally of size one)
- Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getPackageName
public char[][] getPackageName()Beschreibung aus Schnittstelle kopiert:ICompilationUnitAnswer the name of the package according to the directory structure or null if package consistency checks should be ignored. For example, {java, lang}.- Angegeben von:
getPackageNamein SchnittstelleICompilationUnit- Siehe auch:
-
getPath
public org.eclipse.core.runtime.IPath getPath()Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the path to the innermost resource enclosing this element. If this element is not included in an external library, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external library, the path returned is the absolute path to the archive or to the folder in the file system. This is a handle-only method.- Angegeben von:
getPathin SchnittstelleIJavaElement- Gibt zurück:
- the path to the innermost resource enclosing this element
- Siehe auch:
-
getPerWorkingCopyInfo
-
getPrimary
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the primary compilation unit (whose owner is the primary owner) this working copy was created from, or this compilation unit if this a primary compilation unit.Note that the returned primary compilation unit can be in working copy mode.
- Angegeben von:
getPrimaryin SchnittstelleICompilationUnit- Gibt zurück:
- the primary compilation unit this working copy was created from, or this compilation unit if it is primary
-
getPrimaryElement
- Setzt außer Kraft:
getPrimaryElementin KlasseJavaElement
-
resource
-
getSource
Beschreibung aus Schnittstelle kopiert:ISourceReferenceReturns the source code associated with this element. This extracts the substring from the source buffer containing this source element. This corresponds to the source range that would be returned bygetSourceRange.For class files, this returns the source of the entire compilation unit associated with the class file (if there is one).
- Angegeben von:
getSourcein SchnittstelleISourceReference- Gibt zurück:
- the source code, or
nullif this element has no associated source code - Löst aus:
JavaModelException- if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getSourceRange
Beschreibung aus Schnittstelle kopiert:ISourceReferenceReturns the source range associated with this element.For 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
nullis returned, or a source range with a -1 offset and a 0 length.SourceRange.isAvailable(ISourceRange)can be used to detect that case.- Angegeben von:
getSourceRangein SchnittstelleISourceReference- Gibt zurück:
- the source range, or either
nullor [-1, 0] if this element has no associated source code - Löst aus:
JavaModelException- if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getType
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the top-level type declared in this compilation unit with the given simple type name. The type name has to be a valid compilation unit name. This is a handle-only method. The type may or may not exist.- Angegeben von:
getTypein SchnittstelleICompilationUnit- Parameter:
typeName- the simple name of the requested type in the compilation unit- Gibt zurück:
- a handle onto the corresponding type. The type may or may not exist.
- Siehe auch:
-
getTypes
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the top-level types declared in this compilation unit in the order in which they appear in the source.- Angegeben von:
getTypesin SchnittstelleICompilationUnit- Gibt zurück:
- the top-level types declared in this compilation unit
- Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its corresponding resource- Siehe auch:
-
getUnderlyingResource
Beschreibung aus Schnittstelle kopiert:IJavaElementReturns the smallest underlying resource that contains this element, ornullif this element is not contained in a resource.- Angegeben von:
getUnderlyingResourcein SchnittstelleIJavaElement- Setzt außer Kraft:
getUnderlyingResourcein KlasseOpenable- Gibt zurück:
- the underlying resource, or
nullif none - Löst aus:
JavaModelException- if this element does not exist or if an exception occurs while accessing its underlying resource- Siehe auch:
-
getWorkingCopy
Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReturns a new working copy of this element if this element is not a working copy, or this element if this element is already a working copy.Note: if intending to share a working copy amongst several clients, then
#getSharedWorkingCopyshould be used instead.When the working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.
Since 2.1, 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.
- Angegeben von:
getWorkingCopyin SchnittstelleIWorkingCopy- Gibt zurück:
- a new working copy of this element if this element is not a working copy, or this element if this element is already a working copy
- Löst aus:
JavaModelException- if the contents of this element can not be determined.- Siehe auch:
-
getWorkingCopy
public ICompilationUnit getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns a new working copy of this compilation unit if it is a primary compilation unit, or this compilation unit if it is already a non-primary working copy.Note: if intending to share a working copy amongst several clients, then
ICompilationUnit.getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)should be used instead.When the working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.
Once done with the working copy, users of this method must discard it using
ICompilationUnit.discardWorkingCopy().Since 2.1, 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.
- Angegeben von:
getWorkingCopyin SchnittstelleICompilationUnit- Parameter:
monitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reported- Gibt zurück:
- a new working copy of this element if this element is not a working copy, or this element if this element is already a working copy
- Löst aus:
JavaModelException- if the contents of this element can not be determined.- Siehe auch:
-
getWorkingCopy
public ICompilationUnit getWorkingCopy(WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert: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(java.lang.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)).- Angegeben von:
getWorkingCopyin SchnittstelleITypeRoot- Parameter:
workingCopyOwner- 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- Gibt zurück:
- 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
- Löst aus:
JavaModelException- if the contents of this element can not be determined.- Siehe auch:
- The first call to
-
getWorkingCopy
public IJavaElement getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor monitor, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReturns a new working copy of this element using the given factory to create the buffer, or this element if this element is already a working copy. Note that this factory will be used for the life time of this working copy, that is if the working copy is closed then reopened, this factory will be reused. The buffer will be automatically initialized with the original's compilation unit content upon creation.Note: if intending to share a working copy amongst several clients, then
#getSharedWorkingCopyshould be used instead.When the working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.
Since 2.1, 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.
- Angegeben von:
getWorkingCopyin SchnittstelleIWorkingCopy- Parameter:
monitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reportedfactory- the factory that creates a buffer that is used to get the content of the working copy ornullif the internal factory should be usedproblemRequestor- a requestor which will get notified of problems detected during reconciling as they are discovered. The requestor can be set tonullindicating that the client is not interested in problems.- Gibt zurück:
- a new working copy of this element using the given factory to create the buffer, or this element if this element is already a working copy
- Löst aus:
JavaModelException- if the contents of this element can not be determined.- Siehe auch:
-
getWorkingCopy
public ICompilationUnit getWorkingCopy(WorkingCopyOwner workingCopyOwner, IProblemRequestor problemRequestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Veraltet.Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns a shared working copy on this compilation unit using the given working copy owner to create the buffer, or this compilation unit if it is already a non-primary working copy. This API can only answer an already existing working copy if it is based on the same original compilation unit AND was using the same working copy owner (that is, as defined byObject.equals(java.lang.Object)).The life time of a shared working copy is as follows:
- The first call to
ICompilationUnit.getWorkingCopy(WorkingCopyOwner, IProblemRequestor, 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 this 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 compilation unit content upon creation.
When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.
Since 2.1, 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.
- Angegeben von:
getWorkingCopyin SchnittstelleICompilationUnit- Parameter:
workingCopyOwner- the working copy owner that creates a buffer that is used to get the content of the working copyproblemRequestor- a requestor which will get notified of problems detected during reconciling as they are discovered. The requestor can be set tonullindicating that the client is not interested in problems.monitor- a progress monitor used to report progress while opening this compilation unit ornullif no progress should be reported- Gibt zurück:
- a new working copy of this element using the given factory to create the buffer, or this element if this element is already a working copy
- Löst aus:
JavaModelException- if the contents of this element can not be determined.- Siehe auch:
- The first call to
-
hasBuffer
protected boolean hasBuffer()Beschreibung aus Klasse kopiert:OpenableReturns true if this element may have an associated source buffer, otherwise false. Subclasses must override as required. -
hasResourceChanged
public boolean hasResourceChanged()Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns whether the resource of this working copy has changed since the inception of this working copy. Returnsfalseif this compilation unit is not in working copy mode.- Angegeben von:
hasResourceChangedin SchnittstelleICompilationUnit- Gibt zurück:
- whether the resource has changed
-
ignoreOptionalProblems
public boolean ignoreOptionalProblems()Beschreibung aus Schnittstelle kopiert:ICompilationUnitAnswer if optional problems should be ignored for this compilation unit. Implementors should returnfalseif there is no preference.- Angegeben von:
ignoreOptionalProblemsin SchnittstelleICompilationUnit
-
isBasedOn
public boolean isBasedOn(org.eclipse.core.resources.IResource resource) Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReturns whether this working copy's original element's content has not changed since the inception of this working copy.- Angegeben von:
isBasedOnin SchnittstelleIWorkingCopy- Parameter:
resource- this working copy's resource- Gibt zurück:
- true if this working copy's original element's content has not changed since the inception of this working copy, false otherwise
- Siehe auch:
-
isConsistent
public boolean isConsistent()Beschreibung aus Klasse kopiert:OpenableSubclasses must override as required.- Angegeben von:
isConsistentin SchnittstelleIOpenable- Setzt außer Kraft:
isConsistentin KlasseOpenable- Gibt zurück:
- true if the element is consistent with its underlying resource or buffer, false otherwise.
- Siehe auch:
-
isPrimary
public boolean isPrimary() -
isSourceElement
protected boolean isSourceElement()Beschreibung aus Klasse kopiert:OpenableReturns true if this represents a source element. Openable source elements have an associated buffer created when they are opened.- Setzt außer Kraft:
isSourceElementin KlasseOpenable- Siehe auch:
-
validateCompilationUnit
protected org.eclipse.core.runtime.IStatus validateCompilationUnit(org.eclipse.core.resources.IResource resource) -
isWorkingCopy
public boolean isWorkingCopy()Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns whether this element is a working copy.- Angegeben von:
isWorkingCopyin SchnittstelleICompilationUnit- Angegeben von:
isWorkingCopyin SchnittstelleIWorkingCopy- Gibt zurück:
- true if this element is a working copy, false otherwise
-
makeConsistent
public void makeConsistent(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:IOpenableMakes this element consistent with its underlying resource or buffer by updating the element's structure and properties as necessary.Note: Using this functionality on a working copy will interfere with any subsequent reconciling operation. Indeed, the next
ICompilationUnit.reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)orICompilationUnit.reconcile(int, boolean, boolean, WorkingCopyOwner, IProgressMonitor)operation will not account for changes which occurred before an explicit use ofIOpenable.makeConsistent(IProgressMonitor)- Angegeben von:
makeConsistentin SchnittstelleIOpenable- Setzt außer Kraft:
makeConsistentin KlasseOpenable- Parameter:
monitor- the given progress monitor- Löst aus:
JavaModelException- if the element is unable to access the contents of its underlying resource. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Siehe auch:
-
makeConsistent
public CompilationUnit makeConsistent(int astLevel, boolean resolveBindings, int reconcileFlags, HashMap problems, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException - Löst aus:
JavaModelException
-
move
public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ISourceManipulationMoves this element to the given container.- Angegeben von:
movein SchnittstelleISourceManipulation- Parameter:
container- the containersibling- the sibling element before which the element should be inserted, ornullif the element should be inserted as the last child of the containerrename- the new name for the element, ornullif the element retains its nameforce-trueif any existing child in the container with the target name should be replaced, andfalseto throw an exception in the event of a name collisionmonitor- a progress monitor- Löst aus:
JavaModelException- if this element could not be moved. Reasons include:- This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The container is of an incompatible type (INVALID_DESTINATION)
- The sibling is not a child of the given container (INVALID_SIBLING)
- The new name is invalid (INVALID_NAME)
- A child in the container already exists with the same name (NAME_COLLISION)
and
replacehas been specified asfalse - The container or this element is read-only (READ_ONLY)
- Siehe auch:
-
openBuffer
protected IBuffer openBuffer(org.eclipse.core.runtime.IProgressMonitor pm, Object info) throws JavaModelException Beschreibung aus Klasse kopiert:OpenableOpens a buffer on the contents of this element, and returns the buffer, or returnsnullif opening fails. By default, do nothing - subclasses that have buffers must override as required.- Setzt außer Kraft:
openBufferin KlasseOpenable- Löst aus:
JavaModelException- Siehe auch:
-
openAncestors
protected void openAncestors(HashMap newElements, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException - Setzt außer Kraft:
openAncestorsin KlasseOpenable- Löst aus:
JavaModelException
-
originalFromClone
-
reconcile
Veraltet.Beschreibung aus Schnittstelle kopiert:IWorkingCopyReconciles the contents of this working copy. It performs the reconciliation by locally caching the contents of the working copy, updating the contents, then creating a delta over the cached contents and the new contents, and finally firing this delta.If the working copy hasn't changed, then no problem will be detected, this is equivalent to
IWorkingCopy#reconcile(false, null).Compilation problems found in the new contents are notified through the
IProblemRequestorinterface which was passed at creation, and no longer as transient markers. Therefore this API will returnnull.Note: Since 3.0 added/removed/changed inner types generate change deltas.
- Angegeben von:
reconcilein SchnittstelleIWorkingCopy- Gibt zurück:
null- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Siehe auch:
-
reconcile
public void reconcile(boolean forceProblemDetection, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:IWorkingCopyReconciles the contents of this working copy. It performs the reconciliation by locally caching the contents of the working copy, updating the contents, then creating a delta over the cached contents and the new contents, and finally firing this delta.The boolean argument allows to force problem detection even if the working copy is already consistent.
Compilation problems found in the new contents are notified through the
IProblemRequestorinterface which was passed at creation, and no longer as transient markers. Therefore this API answers nothing.Note: Since 3.0 added/removed/changed inner types generate change deltas.
- Angegeben von:
reconcilein SchnittstelleIWorkingCopy- Parameter:
forceProblemDetection- boolean indicating whether problem should be recomputed even if the source hasn't changed.monitor- a progress monitor- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Siehe auch:
-
reconcile
public CompilationUnit reconcile(int astLevel, boolean forceProblemDetection, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitReconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.It performs the reconciliation by locally caching the contents of the working copy, updating the contents, then creating a delta over the cached contents and the new contents, and finally firing this delta.
The boolean argument allows to force problem detection even if the working copy is already consistent.
This functionality allows to specify a working copy owner which is used during problem detection. All references contained in the working copy are resolved against other units; for which corresponding owned working copies are going to take precedence over their original compilation units. If
nullis passed in, then the primary working copy owner is used.Compilation problems found in the new contents are notified through the
IProblemRequestorinterface which was passed at creation, and no longer as transient markers.Note: Since 3.0, added/removed/changed inner types generate change deltas.
If requested, a DOM AST representing the compilation unit is returned. Its bindings are computed only if the problem requestor is active. This method returns
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
This method doesn't perform statements recovery. To recover statements with syntax errors,
ICompilationUnit.reconcile(int, boolean, boolean, WorkingCopyOwner, IProgressMonitor)must be use.- Angegeben von:
reconcilein SchnittstelleICompilationUnit- Parameter:
astLevel- eitherICompilationUnit.NO_ASTif no AST is wanted, or the AST API level of the AST if one is wantedforceProblemDetection- boolean indicating whether problem should be recomputed even if the source hasn't changedworkingCopyOwner- the owner of working copies that take precedence over the original compilation units, ornullif the primary working copy owner should be usedmonitor- a progress monitor- Gibt zurück:
- the compilation unit AST or
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Seit:
- 3.0
- Siehe auch:
-
reconcile
public CompilationUnit reconcile(int astLevel, boolean forceProblemDetection, boolean enableStatementsRecovery, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitReconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.It performs the reconciliation by locally caching the contents of the working copy, updating the contents, then creating a delta over the cached contents and the new contents, and finally firing this delta.
The boolean argument allows to force problem detection even if the working copy is already consistent.
This functionality allows to specify a working copy owner which is used during problem detection. All references contained in the working copy are resolved against other units; for which corresponding owned working copies are going to take precedence over their original compilation units. If
nullis passed in, then the primary working copy owner is used.Compilation problems found in the new contents are notified through the
IProblemRequestorinterface which was passed at creation, and no longer as transient markers.Note: Since 3.0, added/removed/changed inner types generate change deltas.
If requested, a DOM AST representing the compilation unit is returned. Its bindings are computed only if the problem requestor is active. This method returns
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
If statements recovery is enabled then this method tries to rebuild statements with syntax error. Otherwise statements with syntax error won't be present in the returning DOM AST.
- Angegeben von:
reconcilein SchnittstelleICompilationUnit- Parameter:
astLevel- eitherICompilationUnit.NO_ASTif no AST is wanted, or the AST API level of the AST if one is wantedforceProblemDetection- boolean indicating whether problem should be recomputed even if the source hasn't changedenableStatementsRecovery- iftruestatements recovery is enabled.workingCopyOwner- the owner of working copies that take precedence over the original compilation units, ornullif the primary working copy owner should be usedmonitor- a progress monitor- Gibt zurück:
- the compilation unit AST or
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Seit:
- 3.0
- Siehe auch:
-
reconcile
public CompilationUnit reconcile(int astLevel, int reconcileFlags, WorkingCopyOwner workingCopyOwner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ICompilationUnitReconciles the contents of this working copy, sends out a Java delta notification indicating the nature of the change of the working copy since the last time it was either reconciled or made consistent (IOpenable.makeConsistent(IProgressMonitor)), and returns a compilation unit AST if requested.If the problem detection is forced by passing the
ICompilationUnit.FORCE_PROBLEM_DETECTIONbit in the given reconcile flag, problem detection is run even if the working copy is already consistent.It performs the reconciliation by locally caching the contents of the working copy, updating the contents, then creating a delta over the cached contents and the new contents, and finally firing this delta.
This functionality allows to specify a working copy owner which is used during problem detection. All references contained in the working copy are resolved against other units; for which corresponding owned working copies are going to take precedence over their original compilation units. If
nullis passed in, then the primary working copy owner is used.Compilation problems found in the new contents are notified through the
IProblemRequestorinterface which was passed at creation, and no longer as transient markers.Note: Since 3.0, added/removed/changed inner types generate change deltas.
If requested, a DOM AST representing the compilation unit is returned. Its bindings are computed only if the problem requestor is active. This method returns
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
If statements recovery is enabled by passing the
ICompilationUnit.ENABLE_STATEMENTS_RECOVERYbit in the given reconcile flag then this method tries to rebuild statements with syntax error. Otherwise statements with syntax error won't be present in the returning DOM AST.If bindings recovery is enabled by passing the
ICompilationUnit.ENABLE_BINDINGS_RECOVERYbit in the given reconcile flag then this method tries to resolve bindings even if the type resolution contains errors.The given reconcile flags is a bit-mask of the different constants (
ICompilationUnit.ENABLE_BINDINGS_RECOVERY,ICompilationUnit.ENABLE_STATEMENTS_RECOVERY,ICompilationUnit.FORCE_PROBLEM_DETECTION). Unspecified values are left for future use.- Angegeben von:
reconcilein SchnittstelleICompilationUnit- Parameter:
astLevel- eitherICompilationUnit.NO_ASTif no AST is wanted, or the AST API level of the AST if one is wantedreconcileFlags- the given reconcile flagsworkingCopyOwner- the owner of working copies that take precedence over the original compilation units, ornullif the primary working copy owner should be usedmonitor- a progress monitor- Gibt zurück:
- the compilation unit AST or
nullif one of the following conditions is true:- the creation of the DOM AST is not requested
- the requested level of AST API is not supported
- the working copy was already consistent and problem detection is not forced
- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- Siehe auch:
-
rename
public void rename(String newName, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Beschreibung aus Schnittstelle kopiert:ISourceManipulationRenames this element to the given name.- Angegeben von:
renamein SchnittstelleISourceManipulation- Parameter:
newName- the new name for the elementforce-trueif any existing element with the target name should be replaced, andfalseto throw an exception in the event of a name collisionmonitor- a progress monitor- Löst aus:
JavaModelException- if this element could not be renamed. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreExceptionoccurred while updating an underlying resource - The new name is invalid (INVALID_NAME)
- A child in the container already exists with the same name (NAME_COLLISION)
and
replacehas been specified asfalse - This element is read-only (READ_ONLY)
- Siehe auch:
-
restore
Beschreibung aus Schnittstelle kopiert:ICompilationUnitRestores the contents of this working copy to the current contents of this working copy's original element. Has no effect if this element is not a working copy.Note: This is the inverse of committing the content of the working copy to the original element with
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor).- Angegeben von:
restorein SchnittstelleICompilationUnit- Angegeben von:
restorein SchnittstelleIWorkingCopy- Löst aus:
JavaModelException- if the contents of the original element cannot be accessed. Reasons include:- The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
-
save
public void save(org.eclipse.core.runtime.IProgressMonitor pm, boolean force) throws JavaModelException Beschreibung aus Schnittstelle kopiert:IOpenableSaves any changes in this element's buffer to its underlying resource via a workspace resource operation. This has no effect if the element has no underlying buffer, or if there are no unsaved changed in the buffer.The
forceparameter controls how this method deals with cases where the workbench is not completely in sync with the local file system. Iffalseis specified, this method will only attempt to overwrite a corresponding file in the local file system provided it is in sync with the workbench. This option ensures there is no unintended data loss; it is the recommended setting. However, iftrueis specified, an attempt will be made to write a corresponding file in the local file system, overwriting any existing one if need be. In either case, if this method succeeds, the resource will be marked as being local (even if it wasn't before).As a result of this operation, the element is consistent with its underlying resource or buffer.
- Angegeben von:
savein SchnittstelleIOpenable- Setzt außer Kraft:
savein KlasseOpenable- Parameter:
pm- the given progress monitorforce- it controls how this method deals with cases where the workbench is not completely in sync with the local file system- Löst aus:
JavaModelException- if an error occurs accessing the contents of its underlying resource. Reasons include:- This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- This Java element is read-only (READ_ONLY)
- Siehe auch:
-
toStringInfo
Debugging purposes- Setzt außer Kraft:
toStringInfoin KlasseJavaElement- Parameter:
showResolvedInfo- TODO
-
updateTimeStamp
- Löst aus:
JavaModelException
-
validateExistence
protected org.eclipse.core.runtime.IStatus validateExistence(org.eclipse.core.resources.IResource underlyingResource) - Angegeben von:
validateExistencein KlasseOpenable
-
getNameRange
Beschreibung aus Schnittstelle kopiert:ISourceReferenceReturns the name range associated with this element.If the element is an
IMember, it returns the source range of this member's simple name, ornullif this member does not have a name (for example, an initializer), or if this member does not have associated source code (for example, a binary type).If this element is an
IImportDeclaration, the source range of this import declaration's name, ornullif this import declaration does not have associated source code (for example, a binary type).
The source range for the name includes the trailing '*' if the call toIImportDeclaration.isOnDemand()returns true.If this element is an
IPackageDeclaration, the source range of this package declaration's name, ornullif this package declaration does not have associated source code (for example, a binary type).If this element is an
IAnnotation, the source range of this annotation's name, ornullif this annotation does not have associated source code (for example, in a binary type).If this element is an
ITypeParameter, the source range of this type parameter's name, ornullif this type parameter does not have associated source code (for example, in a binary type).If this element is an
ITypeRootorIImportContainer, it returns null.- Angegeben von:
getNameRangein SchnittstelleISourceReference- Gibt zurück:
- the name range associated with this element, or
nullif not available
-
getModule
Beschreibung aus Schnittstelle kopiert: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.- Angegeben von:
getModulein SchnittstelleITypeRoot- Gibt zurück:
- the module description contained in the type root or null.
- Löst aus:
JavaModelException
-
getModuleName
public char[] getModuleName()Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the name of the module to which this compilation unit is associated. A return value ofnullsignals the unnamed module.- Angegeben von:
getModuleNamein SchnittstelleICompilationUnit- Gibt zurück:
- module name or
nullfor the unnamed module.
-
setOptions
Beschreibung aus Schnittstelle kopiert:ICompilationUnitSets the ICompilationUnit custom options. All and only the options explicitly included in the given table are remembered; all previous option settings are forgotten, including ones not explicitly mentioned.For a complete description of the configurable options, see
JavaCore#getDefaultOptions.- Angegeben von:
setOptionsin SchnittstelleICompilationUnit- Parameter:
newOptions- the new custom options for this compilation unit- Siehe auch:
-
getCustomOptions
Beschreibung aus Schnittstelle kopiert:ICompilationUnitReturns the table of the current custom options for this ICompilationUnit. If there is nosetOptionscalled for the ICompliationUnit, then return an empty table.- Angegeben von:
getCustomOptionsin SchnittstelleICompilationUnit- Gibt zurück:
- the table of the current custom options for this ICompilationUnit
-