public class CommitWorkingCopyOperation extends JavaModelOperation
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:
false - in this case an JavaModelException
is throwntrue - 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
resourceThe 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).
JavaModelOperation.IPostActionactions, 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 and Description |
|---|
CommitWorkingCopyOperation(ICompilationUnit element,
boolean force)
Constructs an operation to commit the contents of a working copy
to its original compilation unit.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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, workedpublic CommitWorkingCopyOperation(ICompilationUnit element, boolean force)
protected void executeOperation()
throws JavaModelException
JavaModelOperationexecuteOperation in class JavaModelOperationJavaModelException - if setting the source
of the original compilation unit failsprotected CompilationUnit getCompilationUnit()
protected ISchedulingRule getSchedulingRule()
getSchedulingRule in class JavaModelOperationpublic IJavaModelStatus verify()
verify in class JavaModelOperationIJavaModelStatus