Class ClassFileWorkingCopy
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.aspectj.org.eclipse.jdt.internal.core.JavaElement
org.aspectj.org.eclipse.jdt.internal.core.Openable
org.aspectj.org.eclipse.jdt.internal.core.CompilationUnit
org.aspectj.org.eclipse.jdt.internal.core.ClassFileWorkingCopy
- All Implemented Interfaces:
IBufferChangedListener
,ICodeAssist
,ICompilationUnit
,IJavaElement
,IOpenable
,IParent
,ISourceManipulation
,ISourceReference
,ITypeRoot
,IWorkingCopy
,ICompilationUnit
,IDependent
,SuffixConstants
,org.eclipse.core.runtime.IAdaptable
A working copy on an
IClassFile
.-
Field Summary
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.CompilationUnit
name, owner
Fields inherited from class 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_STRINGS, parent
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.ICompilationUnit
ENABLE_BINDINGS_RECOVERY, ENABLE_STATEMENTS_RECOVERY, FORCE_PROBLEM_DETECTION, IGNORE_METHOD_BODIES, NO_AST
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.env.IDependent
JAR_FILE_ENTRY_SEPARATOR
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_MODULE, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
Fields inherited from interface 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commitWorkingCopy(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor)
Commits the contents of this working copy to its underlying resource.Note: a buffer with no unsaved changes can be closed by the Java Model since it has a finite number of buffers allowed open at one time.char[]
Answer the contents of the compilation unit.org.eclipse.core.runtime.IPath
getPath()
Returns the path to the innermost resource enclosing this element.getPrimaryElement(boolean checkOwner)
protected IBuffer
openBuffer(org.eclipse.core.runtime.IProgressMonitor pm, Object info)
Opens a buffer on the contents of this element, and returns the buffer, or returnsnull
if opening fails.org.eclipse.core.resources.IResource
resource(PackageFragmentRoot root)
protected void
toStringName(StringBuffer buffer)
Debugging purposesMethods inherited from class org.aspectj.org.eclipse.jdt.internal.core.CompilationUnit
applyTextEdit, becomeWorkingCopy, becomeWorkingCopy, buildStructure, canBeRemovedFromCache, canBufferBeRemovedFromCache, cloneCachingContents, close, closing, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeSelect, codeSelect, commit, copy, createElementInfo, createImport, createImport, createPackageDeclaration, createType, delete, destroy, discardWorkingCopy, equals, findElements, findPrimaryType, findSharedWorkingCopy, findWorkingCopy, getAllTypes, getCompilationUnit, getCorrespondingResource, getCustomOptions, getElementAt, getElementName, getElementType, getFileName, getHandleFromMemento, getHandleMementoDelimiter, getImport, getImportContainer, getImports, getMainTypeName, getModule, getModuleName, getNameRange, getOriginal, getOriginalElement, getOwner, getPackageDeclaration, getPackageDeclarations, getPackageName, getPerWorkingCopyInfo, getPrimary, getSharedWorkingCopy, getSource, getSourceRange, getType, getTypeRoot, getTypes, getUnderlyingResource, getWorkingCopy, getWorkingCopy, getWorkingCopy, getWorkingCopy, getWorkingCopy, hasBuffer, hasResourceChanged, ignoreOptionalProblems, isBasedOn, isConsistent, isPrimary, isSourceElement, isWorkingCopy, makeConsistent, makeConsistent, move, openAncestors, originalFromClone, reconcile, reconcile, reconcile, reconcile, reconcile, rename, restore, save, setOptions, toStringInfo, updateTimeStamp, validateCompilationUnit, validateExistence
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.Openable
bufferChanged, closeBuffer, codeComplete, codeSelect, exists, findRecommendedLineSeparator, generateInfos, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, hasUnsavedChanges, ignoreErrorStatus, isOpen, isStructureKnown, open, resource, resourceExists
Methods inherited from class 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, hashCode, isAncestorOf, isReadOnly, newDoesNotExistStatus, newJavaModelException, newNotPresentException, openWhenClosed, readableName, resolved, tabString, toDebugString, toString, toString, toStringAncestors, toStringChildren, toStringInfo, toStringWithAncestors, toStringWithAncestors, unresolved, validateAndCache
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.ICompilationUnit
getOptions
Methods inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit
getDestinationPath, getExternalAnnotationPath, module
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IJavaElement
exists, getAncestor, getAttachedJavadoc, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isReadOnly, isStructureKnown
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IOpenable
findRecommendedLineSeparator, hasUnsavedChanges, isOpen, open
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IParent
getChildren, hasChildren
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.ISourceReference
exists
-
Field Details
-
classFile
-
-
Constructor Details
-
ClassFileWorkingCopy
-
-
Method Details
-
commitWorkingCopy
public void commitWorkingCopy(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelExceptionDescription copied from interface:ICompilationUnit
Commits 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
force
parameter 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 aJavaModelException
is 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.
- Specified by:
commitWorkingCopy
in interfaceICompilationUnit
- Overrides:
commitWorkingCopy
in classCompilationUnit
- Parameters:
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- Throws:
JavaModelException
- if this working copy could not commit. Reasons include:- A
CoreException
occurred while updating an underlying resource - This element is not a working copy (INVALID_ELEMENT_TYPES)
- A update conflict (described above) (UPDATE_CONFLICT)
- A
- See Also:
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor)
-
-
getBuffer
Description copied from class:Openable
Note: a buffer with no unsaved changes can be closed by the Java Model since it has a finite number of buffers allowed open at one time. If this is the first time a request is being made for the buffer, an attempt is made to create and fill this element's buffer. If the buffer has been closed since it was first opened, the buffer is re-created.- Specified by:
getBuffer
in interfaceIOpenable
- Overrides:
getBuffer
in classOpenable
- Returns:
- the buffer opened for this element, or
null
if this element does not have a buffer - Throws:
JavaModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource.- See Also:
IOpenable
-
getContents
public char[] getContents()Description copied from interface:ICompilationUnit
Answer 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.- Specified by:
getContents
in interfaceICompilationUnit
- Overrides:
getContents
in classCompilationUnit
- See Also:
ICompilationUnit.getContents()
-
getPath
public org.eclipse.core.runtime.IPath getPath()Description copied from interface:IJavaElement
Returns 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.- Specified by:
getPath
in interfaceIJavaElement
- Overrides:
getPath
in classCompilationUnit
- Returns:
- the path to the innermost resource enclosing this element
- See Also:
IJavaElement.getPath()
-
getPrimaryElement
- Overrides:
getPrimaryElement
in classCompilationUnit
-
resource
- Overrides:
resource
in classCompilationUnit
-
openBuffer
protected IBuffer openBuffer(org.eclipse.core.runtime.IProgressMonitor pm, Object info) throws JavaModelExceptionDescription copied from class:Openable
Opens a buffer on the contents of this element, and returns the buffer, or returnsnull
if opening fails. By default, do nothing - subclasses that have buffers must override as required.- Overrides:
openBuffer
in classCompilationUnit
- Throws:
JavaModelException
- See Also:
Openable.openBuffer(IProgressMonitor, Object)
-
toStringName
Description copied from class:JavaElement
Debugging purposes- Overrides:
toStringName
in classJavaElement
-