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
TheAbstractCompositeOperationis an abstract implementation of theICompositeOperationinterface. The individual operations are stored in aList. They are executed/redone/undone in forward order.
-
-
Constructor Summary
Constructors Constructor Description AbstractCompositeOperation(java.lang.String label)Creates a newAbstractCompositeOperationwith the given label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IUndoableOperation operation)voidaddAll(java.util.List<ITransactionalOperation> operations)Adds the givenIUndoableOperations to this composite operation.voidaddContext(IUndoContext context)booleancanExecute()booleancanRedo()booleancanUndo()protected IStatuscombine(IStatus s1, IStatus s2)IStatusexecute(IProgressMonitor monitor, IAdaptable info)java.util.List<ITransactionalOperation>getOperations()Returns the list ofITransactionalOperations which are combined in this composite operation.booleanisContentRelevant()Returnstrueif 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).IStatusredo(IProgressMonitor monitor, IAdaptable info)voidremove(IUndoableOperation operation)IStatusundo(IProgressMonitor monitor, IAdaptable info)ITransactionalOperationunwrap(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 Detail
-
AbstractCompositeOperation
public AbstractCompositeOperation(java.lang.String label)
Creates a newAbstractCompositeOperationwith the given label.- Parameters:
label- The label for thisAbstractCompositeOperation.
-
-
Method Detail
-
add
public void add(IUndoableOperation operation)
- Specified by:
addin interfaceICompositeOperation
-
addAll
public void addAll(java.util.List<ITransactionalOperation> operations)
Adds the givenIUndoableOperations to this composite operation.- Parameters:
operations- TheIUndoableOperations which are added to this composite operation.
-
addContext
public void addContext(IUndoContext context)
- 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
-
execute
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
- Specified by:
executein interfaceIUndoableOperation- Specified by:
executein classAbstractOperation- Throws:
ExecutionException
-
getOperations
public java.util.List<ITransactionalOperation> 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
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
- Specified by:
redoin interfaceIUndoableOperation- Specified by:
redoin classAbstractOperation- Throws:
ExecutionException
-
remove
public void remove(IUndoableOperation operation)
- Specified by:
removein interfaceICompositeOperation
-
undo
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
- Specified by:
undoin interfaceIUndoableOperation- Specified by:
undoin classAbstractOperation- Throws:
ExecutionException
-
unwrap
public ITransactionalOperation unwrap(boolean filterNoOps)
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.
-
-