public abstract class AbstractCompositeOperation extends AbstractOperation implements ICompositeOperation
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<IUndoableOperation> 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<IUndoableOperation> |
getOperations()
Returns the list of operations which are combined in this composite
operation.
|
boolean |
isEmpty()
Returns
true if no operations are currently combined in this
composite operation. |
IStatus |
redo(IProgressMonitor monitor,
IAdaptable info) |
void |
remove(IUndoableOperation operation) |
IStatus |
undo(IProgressMonitor monitor,
IAdaptable info) |
IUndoableOperation |
unwrap()
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<IUndoableOperation> 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<IUndoableOperation> getOperations()
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 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 IUndoableOperation unwrap()
null
is returned. When this composite operation
contains exactly one operation, that one operation is returned.
Otherwise, this composite operation is returned.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.