Class CommitWorkingCopyOperation

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.CommitWorkingCopyOperation
All Implemented Interfaces:
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).