public abstract class AbstractCompositeOperation extends org.eclipse.core.commands.operations.AbstractOperation implements org.eclipse.core.commands.operations.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(org.eclipse.core.commands.operations.IUndoableOperation operation) |
void |
addAll(java.util.List<ITransactionalOperation> operations)
Adds the given
IUndoableOperations to this composite operation. |
void |
addContext(org.eclipse.core.commands.operations.IUndoContext context) |
boolean |
canExecute() |
boolean |
canRedo() |
boolean |
canUndo() |
protected org.eclipse.core.runtime.IStatus |
combine(org.eclipse.core.runtime.IStatus s1,
org.eclipse.core.runtime.IStatus s2)
Return an
IStatus representing the merge of the given first and
second IStatuss. |
org.eclipse.core.runtime.IStatus |
execute(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info) |
java.util.List<ITransactionalOperation> |
getOperations()
Returns the list of
ITransactionalOperations 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). |
org.eclipse.core.runtime.IStatus |
redo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info) |
void |
remove(org.eclipse.core.commands.operations.IUndoableOperation operation) |
org.eclipse.core.runtime.IStatus |
undo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info) |
ITransactionalOperation |
unwrap(boolean filterNoOps)
Simplifies this composite operation if possible and returns the
simplified operation.
|
dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toStringpublic AbstractCompositeOperation(java.lang.String label)
AbstractCompositeOperation with the given label.label - The label for this AbstractCompositeOperation.public void add(org.eclipse.core.commands.operations.IUndoableOperation operation)
add in interface org.eclipse.core.commands.operations.ICompositeOperationpublic void addAll(java.util.List<ITransactionalOperation> operations)
IUndoableOperations to this composite operation.operations - The IUndoableOperations which are added to this
composite operation.public void addContext(org.eclipse.core.commands.operations.IUndoContext context)
addContext in interface org.eclipse.core.commands.operations.IUndoableOperationaddContext in class org.eclipse.core.commands.operations.AbstractOperationpublic boolean canExecute()
canExecute in interface org.eclipse.core.commands.operations.IUndoableOperationcanExecute in class org.eclipse.core.commands.operations.AbstractOperationpublic boolean canRedo()
canRedo in interface org.eclipse.core.commands.operations.IUndoableOperationcanRedo in class org.eclipse.core.commands.operations.AbstractOperationpublic boolean canUndo()
canUndo in interface org.eclipse.core.commands.operations.IUndoableOperationcanUndo in class org.eclipse.core.commands.operations.AbstractOperationprotected org.eclipse.core.runtime.IStatus combine(org.eclipse.core.runtime.IStatus s1,
org.eclipse.core.runtime.IStatus s2)
IStatus representing the merge of the given first and
second IStatuss.s1 - The first IStatus.s2 - The second IStatus.IStatus.public org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info)
throws org.eclipse.core.commands.ExecutionException
execute in interface org.eclipse.core.commands.operations.IUndoableOperationexecute in class org.eclipse.core.commands.operations.AbstractOperationorg.eclipse.core.commands.ExecutionExceptionpublic java.util.List<ITransactionalOperation> getOperations()
ITransactionalOperations which are combined
in this composite operation.ITransactionalOperations which are combined
in this composite operation.public boolean isContentRelevant()
ITransactionalOperationtrue if this ITransactionalOperation is
actually changing model data (instead of only affecting the
visualization). Otherwise returns false. The content
relevance 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 ITransactionalOperationtrue 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()
ITransactionalOperationtrue if this ITransactionalOperation has no
effect (in comparison to its initial state). Otherwise returns
false.isNoOp in interface ITransactionalOperationtrue if this ITransactionalOperation has no
effect, otherwise false.public org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info)
throws org.eclipse.core.commands.ExecutionException
redo in interface org.eclipse.core.commands.operations.IUndoableOperationredo in class org.eclipse.core.commands.operations.AbstractOperationorg.eclipse.core.commands.ExecutionExceptionpublic void remove(org.eclipse.core.commands.operations.IUndoableOperation operation)
remove in interface org.eclipse.core.commands.operations.ICompositeOperationpublic org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor monitor,
org.eclipse.core.runtime.IAdaptable info)
throws org.eclipse.core.commands.ExecutionException
undo in interface org.eclipse.core.commands.operations.IUndoableOperationundo in class org.eclipse.core.commands.operations.AbstractOperationorg.eclipse.core.commands.ExecutionExceptionpublic 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, 2016 itemis AG and others. All rights reserved.