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

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.aspectj.org.eclipse.jdt.internal.core.CommitWorkingCopyOperation

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:

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).


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction
 
Field Summary
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
actions, actionsEnd, actionsStart, APPEND, attributes, elementsToProcess, force, HAS_MODIFIED_RESOURCE_ATTR, isNested, KEEP_EXISTING, NO_ELEMENTS, OPERATION_STACKS, parentElements, POST_ACTION_VERBOSE, progressMonitor, REMOVEALL_APPEND, resultElements, TRUE
 
Constructor Summary
CommitWorkingCopyOperation(ICompilationUnit element, boolean force)
          Constructs an operation to commit the contents of a working copy to its original compilation unit.
 
Method Summary
protected  void executeOperation()
          Performs the operation specific behavior.
protected  CompilationUnit getCompilationUnit()
          Returns the compilation unit this operation is working on.
protected  ISchedulingRule getSchedulingRule()
           
 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.
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
addAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, checkCanceled, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, getNestedFolders, getParentElement, getParentElements, getResultElements, getSubProgressMonitor, hasModifiedResource, internalWorked, isCanceled, isReadOnly, isTopLevelOperation, moveResources, newJavaElementDelta, popOperation, postAction, prefixesOneOf, pushOperation, removeAllPostAction, removeReconcileDelta, run, runOperation, runPostActions, setAttribute, setCanceled, setNested, setTaskName, subTask, worked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommitWorkingCopyOperation

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

Method Detail

executeOperation

protected void executeOperation()
                         throws JavaModelException
Description copied from class: JavaModelOperation
Performs the operation specific behavior. Subclasses must override.

Specified by:
executeOperation in class JavaModelOperation
Throws:
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 ISchedulingRule getSchedulingRule()
Overrides:
getSchedulingRule in class JavaModelOperation

verify

public IJavaModelStatus verify()
Possible failures:

Overrides:
verify in class JavaModelOperation
See Also:
IJavaModelStatus