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
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 anJavaModelExceptionis 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).
-
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, TRUEFields inherited from interface org.eclipse.core.runtime.IProgressMonitor
UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionCommitWorkingCopyOperation(ICompilationUnit element, boolean force) Constructs an operation to commit the contents of a working copy to its original compilation unit. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the operation specific behavior.protected CompilationUnitReturns the compilation unit this operation is working on.protected org.eclipse.core.runtime.jobs.ISchedulingRuleverify()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, getLatestASTLevel, 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, workedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.runtime.IProgressMonitor
clearBlocked, setBlocked, slice
-
Constructor Details
-
CommitWorkingCopyOperation
Constructs an operation to commit the contents of a working copy to its original compilation unit.
-
-
Method Details
-
executeOperation
Description copied from class:JavaModelOperationPerforms the operation specific behavior. Subclasses must override.- Specified by:
executeOperationin classJavaModelOperation- Throws:
JavaModelException- if setting the source of the original compilation unit fails
-
getCompilationUnit
Returns the compilation unit this operation is working on. -
getSchedulingRule
protected org.eclipse.core.runtime.jobs.ISchedulingRule getSchedulingRule()- Overrides:
getSchedulingRulein classJavaModelOperation
-
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
- Overrides:
verifyin classJavaModelOperation- See Also:
-