org.eclipse.gef.mvc.fx.operations

## Class AbstractCompositeOperation

- java.lang.Object
- - org.eclipse.core.commands.operations.AbstractOperation
  - - org.eclipse.gef.mvc.fx.operations.AbstractCompositeOperation

All Implemented Interfaces:
  org.eclipse.core.commands.operations.ICompositeOperation, org.eclipse.core.commands.operations.IUndoableOperation, ITransactionalOperation

Direct Known Subclasses:
  ForwardUndoCompositeOperation, ReverseUndoCompositeOperation

    public abstract class AbstractCompositeOperation
    extends org.eclipse.core.commands.operations.AbstractOperation
    implements org.eclipse.core.commands.operations.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

Constructors
Constructor and Description
`AbstractCompositeOperation(java.lang.String label)` Creates a new `AbstractCompositeOperation` with the given label.

### Method Summary

All Methods Instance Methods Concrete Methods
`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.

### 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 new `AbstractCompositeOperation` with the given label.

Parameters:
  `label` - The label for this `AbstractCompositeOperation`.

### Method Detail

#### add

    public void add(org.eclipse.core.commands.operations.IUndoableOperation operation)

Specified by:
  `add` in interface `org.eclipse.core.commands.operations.ICompositeOperation`

#### addAll

    public void addAll(java.util.List<ITransactionalOperation> operations)

Adds the given `IUndoableOperation`s to this composite operation.

Parameters:
  `operations` - The `IUndoableOperation`s which are added to this composite operation.

#### addContext

    public void addContext(org.eclipse.core.commands.operations.IUndoContext context)

Specified by:
  `addContext` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Overrides:
  `addContext` in class `org.eclipse.core.commands.operations.AbstractOperation`

#### canExecute

    public boolean canExecute()

Specified by:
  `canExecute` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Overrides:
  `canExecute` in class `org.eclipse.core.commands.operations.AbstractOperation`

#### canRedo

    public boolean canRedo()

Specified by:
  `canRedo` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Overrides:
  `canRedo` in class `org.eclipse.core.commands.operations.AbstractOperation`

#### canUndo

    public boolean canUndo()

Specified by:
  `canUndo` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Overrides:
  `canUndo` in class `org.eclipse.core.commands.operations.AbstractOperation`

#### combine

    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.

Parameters:
  `s1` - The first `IStatus`.
  `s2` - The second `IStatus`.
Returns:
  The merge of the first and second `IStatus`.

#### execute

    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

Specified by:
  `execute` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Specified by:
  `execute` in class `org.eclipse.core.commands.operations.AbstractOperation`
Throws:
  `org.eclipse.core.commands.ExecutionException`

#### getOperations

    public java.util.List<ITransactionalOperation> getOperations()

Returns the list of `ITransactionalOperation`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`
Returns `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.

Specified by:
  `isContentRelevant` in interface `ITransactionalOperation`
Returns:
  `true` if this `ITransactionalOperation` is actually changing model data, otherwise `false`.

#### isEmpty

    public boolean isEmpty()

Returns `true` if no operations are currently combined in this composite operation. Otherwise returns `false`.

Returns:
  `true` if no operations are currently combined in this composite operation, otherwise `false`.

#### isNoOp

    public boolean isNoOp()

Description copied from interface: `ITransactionalOperation`
Returns `true` if this `ITransactionalOperation` has no effect (in comparison to its initial state). Otherwise returns `false`.

Specified by:
  `isNoOp` in interface `ITransactionalOperation`
Returns:
  `true` if this `ITransactionalOperation` has no effect, otherwise `false`.

#### redo

    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

Specified by:
  `redo` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Specified by:
  `redo` in class `org.eclipse.core.commands.operations.AbstractOperation`
Throws:
  `org.eclipse.core.commands.ExecutionException`

#### remove

    public void remove(org.eclipse.core.commands.operations.IUndoableOperation operation)

Specified by:
  `remove` in interface `org.eclipse.core.commands.operations.ICompositeOperation`

#### undo

    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

Specified by:
  `undo` in interface `org.eclipse.core.commands.operations.IUndoableOperation`
Specified by:
  `undo` in class `org.eclipse.core.commands.operations.AbstractOperation`
Throws:
  `org.eclipse.core.commands.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, `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 (see `ITransactionalOperation.isNoOp()`) should be removed from the list of operations, otherwise `false`.
Returns:
  `null` when no operations are contained, the one operation when only one operation is contained, this composite when multiple operations are contained.