Klasse ClassFileWorkingCopy

Alle implementierten Schnittstellen:
IBufferChangedListener, ICodeAssist, ICompilationUnit, IJavaElement, IOpenable, IParent, ISourceManipulation, ISourceReference, ITypeRoot, IWorkingCopy, ICompilationUnit, IDependent, SuffixConstants, org.eclipse.core.runtime.IAdaptable

public class ClassFileWorkingCopy extends CompilationUnit
A working copy on an IClassFile.
  • Felddetails

  • Konstruktordetails

  • Methodendetails

    • commitWorkingCopy

      public void commitWorkingCopy(boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
      Beschreibung aus Schnittstelle kopiert: 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 a JavaModelException 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.

      Angegeben von:
      commitWorkingCopy in Schnittstelle ICompilationUnit
      Setzt außer Kraft:
      commitWorkingCopy in Klasse CompilationUnit
      Parameter:
      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
      Löst aus:
      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)
      Siehe auch:
    • getBuffer

      public IBuffer getBuffer() throws JavaModelException
      Beschreibung aus Klasse kopiert: 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.
      Angegeben von:
      getBuffer in Schnittstelle IOpenable
      Setzt außer Kraft:
      getBuffer in Klasse Openable
      Gibt zurück:
      the buffer opened for this element, or null if this element does not have a buffer
      Löst aus:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource.
      Siehe auch:
    • getContents

      public char[] getContents()
      Beschreibung aus Schnittstelle kopiert: 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.
      Angegeben von:
      getContents in Schnittstelle ICompilationUnit
      Setzt außer Kraft:
      getContents in Klasse CompilationUnit
      Siehe auch:
      • Ungültige Referenz
        org.eclipse.jdt.internal.compiler.env.ICompilationUnit#getContents()
    • getPath

      public org.eclipse.core.runtime.IPath getPath()
      Beschreibung aus Schnittstelle kopiert: 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.
      Angegeben von:
      getPath in Schnittstelle IJavaElement
      Setzt außer Kraft:
      getPath in Klasse CompilationUnit
      Gibt zurück:
      the path to the innermost resource enclosing this element
      Siehe auch:
    • getPrimaryElement

      public JavaElement getPrimaryElement(boolean checkOwner)
      Setzt außer Kraft:
      getPrimaryElement in Klasse CompilationUnit
    • resource

      public org.eclipse.core.resources.IResource resource(PackageFragmentRoot root)
      Setzt außer Kraft:
      resource in Klasse CompilationUnit
    • openBuffer

      protected IBuffer openBuffer(org.eclipse.core.runtime.IProgressMonitor pm, Object info) throws JavaModelException
      Beschreibung aus Klasse kopiert: 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.
      Setzt außer Kraft:
      openBuffer in Klasse CompilationUnit
      Löst aus:
      JavaModelException
      Siehe auch:
    • toStringName

      protected void toStringName(StringBuilder buffer)
      Beschreibung aus Klasse kopiert: JavaElement
      Debugging purposes
      Setzt außer Kraft:
      toStringName in Klasse JavaElement