org.aspectj.org.eclipse.jdt.internal.core
Class ClassFileWorkingCopy

java.lang.Object
  extended by PlatformObject
      extended by org.aspectj.org.eclipse.jdt.internal.core.JavaElement
          extended by org.aspectj.org.eclipse.jdt.internal.core.Openable
              extended by org.aspectj.org.eclipse.jdt.internal.core.CompilationUnit
                  extended by org.aspectj.org.eclipse.jdt.internal.core.ClassFileWorkingCopy
All Implemented Interfaces:
IBufferChangedListener, ICodeAssist, IJavaElement, IOpenable, IParent, ISourceManipulation, ISourceReference, ITypeRoot, IWorkingCopy, ICompilationUnit, IDependent, SuffixConstants

public class ClassFileWorkingCopy
extends CompilationUnit

A working copy on an IClassFile.


Field Summary
 ClassFile classFile
           
 
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_ESCAPE, JEM_FIELD, JEM_IMPORTDECLARATION, JEM_INITIALIZER, JEM_JAVAPROJECT, JEM_LOCALVARIABLE, JEM_METHOD, JEM_PACKAGEDECLARATION, JEM_PACKAGEFRAGMENT, JEM_PACKAGEFRAGMENTROOT, JEM_TYPE, JEM_TYPE_PARAMETER, NO_ELEMENTS, NO_INFO, 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.core.IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, 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.env.IDependent
JAR_FILE_ENTRY_SEPARATOR
 
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, 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
ClassFileWorkingCopy(ClassFile classFile, WorkingCopyOwner owner)
           
 
Method Summary
 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
 
Methods 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, 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, getNameRange, getOriginal, getOriginalElement, getOwner, getPackageDeclaration, getPackageDeclarations, getPackageName, getPerWorkingCopyInfo, getPrimary, getSharedWorkingCopy, getSource, getSourceRange, getType, getTypeRoot, getTypes, getUnderlyingResource, getWorkingCopy, getWorkingCopy, getWorkingCopy, getWorkingCopy, getWorkingCopy, hasBuffer, hasResourceChanged, isBasedOn, isConsistent, isPrimary, isSourceElement, isWorkingCopy, makeConsistent, makeConsistent, move, openAncestors, originalFromClone, reconcile, reconcile, reconcile, reconcile, reconcile, rename, restore, save, 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, isOpen, isStructureKnown, open, resource, resourceExists
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaElement
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
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.IParent
getChildren, hasChildren
 
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.ISourceReference
exists
 

Field Detail

classFile

public ClassFile classFile
Constructor Detail

ClassFileWorkingCopy

public ClassFileWorkingCopy(ClassFile classFile,
                            WorkingCopyOwner owner)
Method Detail

commitWorkingCopy

public void commitWorkingCopy(boolean force,
                              IProgressMonitor monitor)
                       throws JavaModelException
Description 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:

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.

Overrides:
commitWorkingCopy in class CompilationUnit
Parameters:
force - a flag to handle the cases when the contents of the original resource have changed since this working copy was created
monitor - the given progress monitor
Throws:
JavaModelException - if this working copy could not commit. Reasons include:
  • A org.eclipse.core.runtime.CoreException occurred while updating an underlying resource
  • This element is not a working copy (INVALID_ELEMENT_TYPES)
  • A update conflict (described above) (UPDATE_CONFLICT)
See Also:
ICompilationUnit.commitWorkingCopy(boolean, IProgressMonitor)

getBuffer

public IBuffer getBuffer()
                  throws JavaModelException
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 interface IOpenable
Overrides:
getBuffer in class Openable
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 interface ICompilationUnit
Overrides:
getContents in class CompilationUnit
See Also:
ICompilationUnit.getContents()

getPath

public 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 interface IJavaElement
Overrides:
getPath in class CompilationUnit
Returns:
the path to the innermost resource enclosing this element
See Also:
IJavaElement.getPath()

getPrimaryElement

public IJavaElement getPrimaryElement(boolean checkOwner)
Overrides:
getPrimaryElement in class CompilationUnit

resource

public IResource resource(PackageFragmentRoot root)
Overrides:
resource in class CompilationUnit

openBuffer

protected IBuffer openBuffer(IProgressMonitor pm,
                             java.lang.Object info)
                      throws JavaModelException
Description copied from class: Openable
Opens a buffer on the contents of this element, and returns the buffer, or returns null if opening fails. By default, do nothing - subclasses that have buffers must override as required.

Overrides:
openBuffer in class CompilationUnit
Throws:
JavaModelException
See Also:
Openable.openBuffer(IProgressMonitor, Object)

toStringName

protected void toStringName(java.lang.StringBuffer buffer)
Description copied from class: JavaElement
Debugging purposes

Overrides:
toStringName in class JavaElement