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
ConstructorsConstructorDescriptionAbstractCompositeOperation(String label) Creates a newAbstractCompositeOperationwith the given label. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IUndoableOperation operation) voidaddAll(List<ITransactionalOperation> operations) Adds the givenIUndoableOperations to this composite operation.voidaddContext(IUndoContext context) booleanbooleancanRedo()booleancanUndo()protected IStatusexecute(IProgressMonitor monitor, IAdaptable info) Returns the list ofITransactionalOperations which are combined in this composite operation.booleanReturnstrueif thisITransactionalOperationis actually changing model data (instead of only affecting the visualization).booleanisEmpty()Returnstrueif no operations are currently combined in this composite operation.booleanisNoOp()Returnstrueif thisITransactionalOperationhas no effect (in comparison to its initial state).redo(IProgressMonitor monitor, IAdaptable info) voidremove(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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
dispose, getContexts, getLabel, hasContext, removeContext
-
Constructor Details
-
AbstractCompositeOperation
Creates a newAbstractCompositeOperationwith the given label.- Parameters:
label- The label for thisAbstractCompositeOperation.
-
-
Method Details
-
add
- Specified by:
addin interfaceICompositeOperation
-
addAll
Adds the givenIUndoableOperations to this composite operation.- Parameters:
operations- TheIUndoableOperations which are added to this composite operation.
-
addContext
- Specified by:
addContextin interfaceIUndoableOperation- Overrides:
addContextin classAbstractOperation
-
canExecute
public boolean canExecute()- Specified by:
canExecutein interfaceIUndoableOperation- Overrides:
canExecutein classAbstractOperation
-
canRedo
public boolean canRedo()- Specified by:
canRedoin interfaceIUndoableOperation- Overrides:
canRedoin classAbstractOperation
-
canUndo
public boolean canUndo()- Specified by:
canUndoin interfaceIUndoableOperation- Overrides:
canUndoin classAbstractOperation
-
combine
-
execute
- Specified by:
executein interfaceIUndoableOperation- Specified by:
executein classAbstractOperation- Throws:
ExecutionException
-
getOperations
Returns the list ofITransactionalOperations which are combined in this composite operation.- Returns:
- The list of
ITransactionalOperations which are combined in this composite operation.
-
isContentRelevant
public boolean isContentRelevant()Description copied from interface:ITransactionalOperationReturnstrueif thisITransactionalOperationis actually changing model data (instead of only affecting the visualization). Otherwise returnsfalse. The content relevance of anITransactionalOperationcan 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:
isContentRelevantin interfaceITransactionalOperation- Returns:
trueif thisITransactionalOperationis actually changing model data, otherwisefalse.
-
isEmpty
public boolean isEmpty()Returnstrueif no operations are currently combined in this composite operation. Otherwise returnsfalse.- Returns:
trueif no operations are currently combined in this composite operation, otherwisefalse.
-
isNoOp
public boolean isNoOp()Description copied from interface:ITransactionalOperationReturnstrueif thisITransactionalOperationhas no effect (in comparison to its initial state). Otherwise returnsfalse.- Specified by:
isNoOpin interfaceITransactionalOperation- Returns:
trueif thisITransactionalOperationhas no effect, otherwisefalse.
-
redo
- Specified by:
redoin interfaceIUndoableOperation- Specified by:
redoin classAbstractOperation- Throws:
ExecutionException
-
remove
- Specified by:
removein interfaceICompositeOperation
-
undo
- Specified by:
undoin interfaceIUndoableOperation- Specified by:
undoin classAbstractOperation- Throws:
ExecutionException
-
unwrap
Simplifies this composite operation if possible and returns the simplified operation. When this composite operation does not contain any operations,nullis returned. When this composite operation contains exactly one operation, that one operation is returned. Otherwise, this composite operation is returned.- Parameters:
filterNoOps-trueif no-ops (seeITransactionalOperation.isNoOp()) should be removed from the list of operations, otherwisefalse.- Returns:
nullwhen no operations are contained, the one operation when only one operation is contained, this composite when multiple operations are contained.
-