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
IUndoableOperation s 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 IStatus s. |
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
ITransactionalOperation s 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, toString
public 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.ICompositeOperation
public void addAll(java.util.List<ITransactionalOperation> operations)
IUndoableOperation
s to this composite operation.operations
- The IUndoableOperation
s 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.IUndoableOperation
addContext
in class org.eclipse.core.commands.operations.AbstractOperation
public boolean canExecute()
canExecute
in interface org.eclipse.core.commands.operations.IUndoableOperation
canExecute
in class org.eclipse.core.commands.operations.AbstractOperation
public boolean canRedo()
canRedo
in interface org.eclipse.core.commands.operations.IUndoableOperation
canRedo
in class org.eclipse.core.commands.operations.AbstractOperation
public boolean canUndo()
canUndo
in interface org.eclipse.core.commands.operations.IUndoableOperation
canUndo
in class org.eclipse.core.commands.operations.AbstractOperation
protected 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 IStatus
s.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.IUndoableOperation
execute
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.ExecutionException
public java.util.List<ITransactionalOperation> getOperations()
ITransactionalOperation
s which are combined
in this composite operation.ITransactionalOperation
s which are combined
in this composite operation.public boolean isContentRelevant()
ITransactionalOperation
true
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 ITransactionalOperation
true
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()
ITransactionalOperation
true
if this ITransactionalOperation
has no
effect (in comparison to its initial state). Otherwise returns
false
.isNoOp
in interface ITransactionalOperation
true
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.IUndoableOperation
redo
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.ExecutionException
public void remove(org.eclipse.core.commands.operations.IUndoableOperation operation)
remove
in interface org.eclipse.core.commands.operations.ICompositeOperation
public 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.IUndoableOperation
undo
in class org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.core.commands.ExecutionException
public 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.