public abstract class AbstractCompositeOperation extends AbstractOperation implements ICompositeOperation, ITransactionalOperation
AbstractCompositeOperation is an abstract implementation of the
ICompositeOperation interface. The individual operations are stored
in a List. They are executed/redone/undone in forward order.| Constructor and Description |
|---|
AbstractCompositeOperation(java.lang.String label)
Creates a new
AbstractCompositeOperation with the given label. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(IUndoableOperation operation) |
void |
addAll(java.util.List<ITransactionalOperation> operations)
Adds the given
IUndoableOperations to this composite operation. |
void |
addContext(IUndoContext context) |
boolean |
canExecute() |
boolean |
canRedo() |
boolean |
canUndo() |
protected IStatus |
combine(IStatus s1,
IStatus s2)
|
IStatus |
execute(IProgressMonitor monitor,
IAdaptable info) |
java.util.List<ITransactionalOperation> |
getOperations()
Returns the list of
ITransactionalOperations which are combined
in this composite operation. |
boolean |
isContentRelevant()
Returns
true if this ITransactionalOperation is
actually changing model data (instead of only affecting the
visualization). |
boolean |
isEmpty()
Returns
true if no operations are currently combined in this
composite operation. |
boolean |
isNoOp()
Returns
true if this ITransactionalOperation has no
effect (in comparison to its initial state). |
IStatus |
redo(IProgressMonitor monitor,
IAdaptable info) |
void |
remove(IUndoableOperation operation) |
IStatus |
undo(IProgressMonitor monitor,
IAdaptable info) |
ITransactionalOperation |
unwrap(boolean filterNoOps)
Simplifies this composite operation if possible and returns the
simplified operation.
|
dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdispose, getContexts, getLabel, hasContext, removeContextpublic AbstractCompositeOperation(java.lang.String label)
AbstractCompositeOperation with the given label.label - The label for this AbstractCompositeOperation.public void add(IUndoableOperation operation)
add in interface ICompositeOperationpublic void addAll(java.util.List<ITransactionalOperation> operations)
IUndoableOperations to this composite operation.operations - The IUndoableOperations which are added to this
composite operation.public void addContext(IUndoContext context)
addContext in interface IUndoableOperationaddContext in class AbstractOperationpublic boolean canExecute()
canExecute in interface IUndoableOperationcanExecute in class AbstractOperationpublic boolean canRedo()
canRedo in interface IUndoableOperationcanRedo in class AbstractOperationpublic boolean canUndo()
canUndo in interface IUndoableOperationcanUndo in class AbstractOperationpublic IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
execute in interface IUndoableOperationexecute in class AbstractOperationExecutionExceptionpublic java.util.List<ITransactionalOperation> getOperations()
ITransactionalOperations which are combined
in this composite operation.ITransactionalOperations which are combined
in this composite operation.public boolean isContentRelevant()
ITransactionalOperationtrue if this ITransactionalOperation is
actually changing model data (instead of only affecting the
visualization). Otherwise returns false. The content
relevancy of an ITransactionalOperation can be checked to
determine if the execution of the operation will affect the model, for
example, to set an editor's dirty flag.isContentRelevant in interface ITransactionalOperationtrue if this ITransactionalOperation is
actually changing model data, otherwise false.public boolean isEmpty()
true if no operations are currently combined in this
composite operation. Otherwise returns false.true if no operations are currently combined in this
composite operation, otherwise false.public boolean isNoOp()
ITransactionalOperationtrue if this ITransactionalOperation has no
effect (in comparison to its initial state). Otherwise returns
false.isNoOp in interface ITransactionalOperationtrue if this ITransactionalOperation has no
effect, otherwise false.public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
redo in interface IUndoableOperationredo in class AbstractOperationExecutionExceptionpublic void remove(IUndoableOperation operation)
remove in interface ICompositeOperationpublic IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
undo in interface IUndoableOperationundo in class AbstractOperationExecutionExceptionpublic ITransactionalOperation unwrap(boolean filterNoOps)
null is returned. When this composite operation
contains exactly one operation, that one operation is returned.
Otherwise, this composite operation is returned.filterNoOps - true if no-ops (see
ITransactionalOperation.isNoOp()) should be removed
from the list of operations, otherwise false.null when no operations are contained, the one
operation when only one operation is contained, this composite
when multiple operations are contained.Copyright (c) 2014 itemis AG and others. All rights reserved.