Klasse CommitWorkingCopyOperation

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.CommitWorkingCopyOperation
Alle implementierten Schnittstellen:
org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.ICoreRunnable, org.eclipse.core.runtime.IProgressMonitor

public class CommitWorkingCopyOperation extends JavaModelOperation
Commits the contents of a working copy compilation unit to its original element and 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 the working copy was created, in which case there is an update conflict. This operation allows for two settings to resolve conflict set by the fForce flag:

  • force flag is false - in this case an JavaModelException is thrown
  • force flag is true - in this case the contents of the working copy are applied to the underlying resource even though the working copy was created before a subsequent change in the resource

The default conflict resolution setting is the force flag is false A JavaModelOperation exception is thrown either if the commit could not be performed or if the new content of the compilation unit violates some Java Model constraint (e.g. if the new package declaration doesn't match the name of the folder containing the compilation unit).

  • Konstruktordetails

    • CommitWorkingCopyOperation

      public CommitWorkingCopyOperation(ICompilationUnit element, boolean force)
      Constructs an operation to commit the contents of a working copy to its original compilation unit.
  • Methodendetails

    • executeOperation

      protected void executeOperation() throws JavaModelException
      Beschreibung aus Klasse kopiert: JavaModelOperation
      Performs the operation specific behavior. Subclasses must override.
      Angegeben von:
      executeOperation in Klasse JavaModelOperation
      Löst aus:
      JavaModelException - if setting the source of the original compilation unit fails
    • getCompilationUnit

      protected CompilationUnit getCompilationUnit()
      Returns the compilation unit this operation is working on.
    • getSchedulingRule

      protected org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()
      Setzt außer Kraft:
      getSchedulingRule in Klasse JavaModelOperation
    • verify

      public IJavaModelStatus verify()
      Possible failures:
      • INVALID_ELEMENT_TYPES - the compilation unit supplied to this operation is not a working copy
      • ELEMENT_NOT_PRESENT - the compilation unit the working copy is based on no longer exists.
      • UPDATE_CONFLICT - the original compilation unit has changed since the working copy was created and the operation specifies no force
      • READ_ONLY - the original compilation unit is in read-only mode
      Setzt außer Kraft:
      verify in Klasse JavaModelOperation
      Siehe auch: