Class AbstractCompositeOperation
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.gef.mvc.fx.operations.AbstractCompositeOperation
- All Implemented Interfaces:
ICompositeOperation
,IUndoableOperation
,ITransactionalOperation
- Direct Known Subclasses:
ForwardUndoCompositeOperation
,ReverseUndoCompositeOperation
public abstract class AbstractCompositeOperation
extends AbstractOperation
implements ICompositeOperation, ITransactionalOperation
The
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 Summary
ConstructorDescriptionAbstractCompositeOperation
(String label) Creates a newAbstractCompositeOperation
with the given label. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(IUndoableOperation operation) void
addAll
(List<ITransactionalOperation> operations) Adds the givenIUndoableOperation
s to this composite operation.void
addContext
(IUndoContext context) boolean
boolean
canRedo()
boolean
canUndo()
protected IStatus
execute
(IProgressMonitor monitor, IAdaptable info) Returns the list ofITransactionalOperation
s which are combined in this composite operation.boolean
Returnstrue
if thisITransactionalOperation
is actually changing model data (instead of only affecting the visualization).boolean
isEmpty()
Returnstrue
if no operations are currently combined in this composite operation.boolean
isNoOp()
Returnstrue
if thisITransactionalOperation
has no effect (in comparison to its initial state).redo
(IProgressMonitor monitor, IAdaptable info) void
remove
(IUndoableOperation operation) undo
(IProgressMonitor monitor, IAdaptable info) unwrap
(boolean filterNoOps) Simplifies this composite operation if possible and returns the simplified operation.Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
dispose, getContexts, getLabel, hasContext, removeContext
-
Constructor Details
-
AbstractCompositeOperation
Creates a newAbstractCompositeOperation
with the given label.- Parameters:
label
- The label for thisAbstractCompositeOperation
.
-
-
Method Details
-
add
- Specified by:
add
in interfaceICompositeOperation
-
addAll
Adds the givenIUndoableOperation
s to this composite operation.- Parameters:
operations
- TheIUndoableOperation
s which are added to this composite operation.
-
addContext
- Specified by:
addContext
in interfaceIUndoableOperation
- Overrides:
addContext
in classAbstractOperation
-
canExecute
public boolean canExecute()- Specified by:
canExecute
in interfaceIUndoableOperation
- Overrides:
canExecute
in classAbstractOperation
-
canRedo
public boolean canRedo()- Specified by:
canRedo
in interfaceIUndoableOperation
- Overrides:
canRedo
in classAbstractOperation
-
canUndo
public boolean canUndo()- Specified by:
canUndo
in interfaceIUndoableOperation
- Overrides:
canUndo
in classAbstractOperation
-
combine
-
execute
- Specified by:
execute
in interfaceIUndoableOperation
- Specified by:
execute
in classAbstractOperation
- Throws:
ExecutionException
-
getOperations
Returns the list ofITransactionalOperation
s which are combined in this composite operation.- Returns:
- The list of
ITransactionalOperation
s which are combined in this composite operation.
-
isContentRelevant
public boolean isContentRelevant()Description copied from interface:ITransactionalOperation
Returnstrue
if thisITransactionalOperation
is actually changing model data (instead of only affecting the visualization). Otherwise returnsfalse
. The content relevance of anITransactionalOperation
can be checked to determine if the execution of the operation will affect the model, for example, to set an editor's dirty flag.- Specified by:
isContentRelevant
in interfaceITransactionalOperation
- Returns:
true
if thisITransactionalOperation
is actually changing model data, otherwisefalse
.
-
isEmpty
public boolean isEmpty()Returnstrue
if no operations are currently combined in this composite operation. Otherwise returnsfalse
.- Returns:
true
if no operations are currently combined in this composite operation, otherwisefalse
.
-
isNoOp
public boolean isNoOp()Description copied from interface:ITransactionalOperation
Returnstrue
if thisITransactionalOperation
has no effect (in comparison to its initial state). Otherwise returnsfalse
.- Specified by:
isNoOp
in interfaceITransactionalOperation
- Returns:
true
if thisITransactionalOperation
has no effect, otherwisefalse
.
-
redo
- Specified by:
redo
in interfaceIUndoableOperation
- Specified by:
redo
in classAbstractOperation
- Throws:
ExecutionException
-
remove
- Specified by:
remove
in interfaceICompositeOperation
-
undo
- Specified by:
undo
in interfaceIUndoableOperation
- Specified by:
undo
in classAbstractOperation
- Throws:
ExecutionException
-
unwrap
Simplifies this composite operation if possible and returns the simplified operation. When this composite operation does not contain any operations,null
is returned. When this composite operation contains exactly one operation, that one operation is returned. Otherwise, this composite operation is returned.- Parameters:
filterNoOps
-true
if no-ops (seeITransactionalOperation.isNoOp()
) should be removed from the list of operations, otherwisefalse
.- Returns:
null
when no operations are contained, the one operation when only one operation is contained, this composite when multiple operations are contained.
-