public class ClassFileWorkingCopy extends CompilationUnit
IClassFile.| Modifier and Type | Field and Description |
|---|---|
AbstractClassFile |
classFile |
name, ownerJEM_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, parentENABLE_BINDINGS_RECOVERY, ENABLE_STATEMENTS_RECOVERY, FORCE_PROBLEM_DETECTION, IGNORE_METHOD_BODIES, NO_ASTANNOTATION, 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_PARAMETERJAR_FILE_ENTRY_SEPARATOREXTENSION_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 and Description |
|---|
ClassFileWorkingCopy(AbstractClassFile classFile,
WorkingCopyOwner owner) |
| Modifier and Type | Method and Description |
|---|---|
void |
commitWorkingCopy(boolean force,
IProgressMonitor monitor)
Commits the contents of this working copy to its underlying resource.
|
IBuffer |
getBuffer()
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[] |
getContents()
Answer the contents of the compilation unit.
|
IPath |
getPath()
Returns the path to the innermost resource enclosing this element.
|
IJavaElement |
getPrimaryElement(boolean checkOwner) |
protected IBuffer |
openBuffer(IProgressMonitor pm,
java.lang.Object info)
Opens a buffer on the contents of this element, and returns
the buffer, or returns
null if opening fails. |
IResource |
resource(PackageFragmentRoot root) |
protected void |
toStringName(java.lang.StringBuffer buffer)
Debugging purposes
|
applyTextEdit, becomeWorkingCopy, becomeWorkingCopy, buildStructure, canBeRemovedFromCache, canBufferBeRemovedFromCache, cloneCachingContents, close, closing, 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, 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, toStringInfo, updateTimeStamp, validateCompilationUnit, validateExistencebufferChanged, closeBuffer, codeComplete, codeSelect, exists, findRecommendedLineSeparator, generateInfos, getBufferFactory, getBufferManager, getOpenable, getPackageFragmentRoot, getResource, hasUnsavedChanges, ignoreErrorStatus, isOpen, isStructureKnown, open, resource, resourceExistsappendEscapedDelimiter, 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, validateAndCacheclone, finalize, getClass, notify, notifyAll, wait, wait, waitexists, getAncestor, getAttachedJavadoc, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPrimaryElement, getResource, getSchedulingRule, isReadOnly, isStructureKnowngetChildren, hasChildrenfindRecommendedLineSeparator, hasUnsavedChanges, isOpen, openexistsgetDestinationPath, modulepublic AbstractClassFile classFile
public ClassFileWorkingCopy(AbstractClassFile classFile, WorkingCopyOwner owner)
public void commitWorkingCopy(boolean force,
IProgressMonitor monitor)
throws JavaModelException
ICompilationUnitIt 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 resourcefalse - in this case a JavaModelException is thrownSince 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.
commitWorkingCopy in class CompilationUnitforce - a flag to handle the cases when the contents of the original resource have changed
since this working copy was createdmonitor - the given progress monitorJavaModelException - if this working copy could not commit. Reasons include:
org.eclipse.core.runtime.CoreException occurred while updating an underlying resource
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor)public IBuffer getBuffer() throws JavaModelException
OpenablegetBuffer in interface IOpenablegetBuffer in class Openablenull
if this element does not have a bufferJavaModelException - if this element does not exist or if an
exception occurs while accessing its corresponding resource.IOpenablepublic char[] getContents()
ICompilationUnitgetContents in interface ICompilationUnitgetContents in class CompilationUnitICompilationUnit.getContents()public IPath getPath()
IJavaElementgetPath in interface IJavaElementgetPath in class CompilationUnitIJavaElement.getPath()public IJavaElement getPrimaryElement(boolean checkOwner)
getPrimaryElement in class CompilationUnitpublic IResource resource(PackageFragmentRoot root)
resource in class CompilationUnitprotected IBuffer openBuffer(IProgressMonitor pm, java.lang.Object info) throws JavaModelException
Openablenull if opening fails.
By default, do nothing - subclasses that have buffers
must override as required.openBuffer in class CompilationUnitJavaModelExceptionOpenable.openBuffer(IProgressMonitor, Object)protected void toStringName(java.lang.StringBuffer buffer)
JavaElementtoStringName in class JavaElement