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
IUndoableOperation s 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
ITransactionalOperation s 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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dispose, getContexts, getLabel, hasContext, removeContext
public AbstractCompositeOperation(java.lang.String label)
AbstractCompositeOperation
with the given label.label
- The label for this AbstractCompositeOperation
.public void add(IUndoableOperation operation)
add
in interface ICompositeOperation
public void addAll(java.util.List<ITransactionalOperation> operations)
IUndoableOperation
s to this composite operation.operations
- The IUndoableOperation
s which are added to this
composite operation.public void addContext(IUndoContext context)
addContext
in interface IUndoableOperation
addContext
in class AbstractOperation
public boolean canExecute()
canExecute
in interface IUndoableOperation
canExecute
in class AbstractOperation
public boolean canRedo()
canRedo
in interface IUndoableOperation
canRedo
in class AbstractOperation
public boolean canUndo()
canUndo
in interface IUndoableOperation
canUndo
in class AbstractOperation
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
execute
in interface IUndoableOperation
execute
in class AbstractOperation
ExecutionException
public java.util.List<ITransactionalOperation> getOperations()
ITransactionalOperation
s which are combined
in this composite operation.ITransactionalOperation
s which are combined
in this composite operation.public boolean isContentRelevant()
ITransactionalOperation
true
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 ITransactionalOperation
true
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()
ITransactionalOperation
true
if this ITransactionalOperation
has no
effect (in comparison to its initial state). Otherwise returns
false
.isNoOp
in interface ITransactionalOperation
true
if this ITransactionalOperation
has no
effect, otherwise false
.public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
redo
in interface IUndoableOperation
redo
in class AbstractOperation
ExecutionException
public void remove(IUndoableOperation operation)
remove
in interface ICompositeOperation
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
undo
in interface IUndoableOperation
undo
in class AbstractOperation
ExecutionException
public 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.