Runtime

## org.eclipse.gmf.runtime.emf.commands.core.command
Class CompositeTransactionalCommand

    java.lang.Object
      org.eclipse.core.commands.operations.AbstractOperation
          org.eclipse.emf.workspace.AbstractEMFOperation
              org.eclipse.emf.workspace.CompositeEMFOperation
                  org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand

All Implemented Interfaces:
  ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult, ICompositeCommand, IUndoableOperation

public class CompositeTransactionalCommand
extends org.eclipse.emf.workspace.CompositeEMFOperation
implements ICompositeCommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

An undoable operation that is composed of child `IUndoableOperation`s that are expected to modify EMF model resources.

The operation provides a list of `IFile`s that are expected to be modified when the operation is executed, undone or redone. An `IOperationApprover` is registered with the `OperationHistoryFactory.getOperationHistory()` to validate the modification to these resources.

This class is meant to be instantiated by clients.

Constructor Summary
`CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label)` Initializes me with the editing domain in which I am making model changes and a label.
`CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label, java.util.List children)` Initializes me with the editing domain, a label, and child operations.
`CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label, java.util.List children, java.util.Map options)` Initializes me with the editing domain, a label, and child operations, and transaction options.
`CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label, java.util.Map options)` Initializes me with the editing domain, a label, and transaction options.

Method Summary
`protected IStatus` `aggregateStatuses(java.util.List statuses)` Overrides the superclass implementation to set the command result.
`boolean` `canExecute()` I can execute if I am not empty and all of my children can execute.
`boolean` `canRedo()` I can redo if I am not empty and all my children can all be redone.
`boolean` `canUndo()` I can undo if I am not empty and all my children can all be undone.
`ICommand` `compose(IUndoableOperation operation)` Returns a new command object that represents a composition of this command with the specified `command` parameter.
`java.util.List` `getAffectedFiles()` Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.
`CommandResult` `getCommandResult()` Retrieves the result of executing, undoing, or redoing this command, depending on which of these operations was last performed.
`protected java.util.List` `getReturnValues()` Returns a list containing all of the return values from `ICommand` children.
`void` `internalSetResult(CommandResult result)` Deprecated. internal API
`boolean` `isEmpty()` Answers whether or not this composite operation has children.
`ICommand` `reduce()` Returns the simplest form of this command that is equivalent.
`protected void` `setResult(CommandResult result)` Sets the command result.

Methods inherited from class org.eclipse.emf.workspace.CompositeEMFOperation
`add, assertNotExecuted, didCommit, dispose, doExecute, doRedo, doUndo, getChildren, isTransactionNestingEnabled, iterator, listIterator, listIterator, remove, setTransactionNestingEnabled, size`

Methods inherited from class org.eclipse.emf.workspace.AbstractEMFOperation
`didRedo, didUndo, execute, getChange, getEditingDomain, getOptions, redo, undo`

Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
`addContext, 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.gmf.runtime.common.core.command.ICompositeCommand
`add, iterator, listIterator, listIterator, remove, size`

Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
`addContext, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo`

Constructor Detail

### CompositeTransactionalCommand

    public CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                                         java.lang.String label)

  Initializes me with the editing domain in which I am making model changes and a label.

Parameters:
  `domain` - my editing domain
  `label` - my user-readable label

### CompositeTransactionalCommand

    public CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                                         java.lang.String label,
                                         java.util.Map options)

  Initializes me with the editing domain, a label, and transaction options.

Parameters:
  `domain` - my editing domain
  `label` - my user-readable label
  `options` - for the transaction in which I execute myself, or `null` for the default options

### CompositeTransactionalCommand

    public CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                                         java.lang.String label,
                                         java.util.List children)

  Initializes me with the editing domain, a label, and child operations.

Parameters:
  `domain` - my editing domain
  `label` - my user-readable label
  `children` - a list of operations to compose

### CompositeTransactionalCommand

    public CompositeTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                                         java.lang.String label,
                                         java.util.List children,
                                         java.util.Map options)

  Initializes me with the editing domain, a label, and child operations, and transaction options.

Parameters:
  `domain` - my editing domain
  `label` - my user-readable label
  `children` - a list of operations to compose
  `options` - for the transaction in which I execute myself, or `null` for the default options

Method Detail

### getAffectedFiles

    public java.util.List getAffectedFiles()

  Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.

  Specified by:
    `getAffectedFiles` in interface `ICommand`
  Returns:
    the list of `IFile`s that will be modified

### getCommandResult

    public CommandResult getCommandResult()

  Description copied from interface: `ICommand`
  Retrieves the result of executing, undoing, or redoing this command, depending on which of these operations was last performed. This value can be `null` if the operation has no meaningful result.

  The value of this result is undefined if the command has not yet been executed, undone or redone.

  Specified by:
    `getCommandResult` in interface `ICommand`
  Returns:
    The result of executing, undoing or redoing this command.

### setResult

    protected void setResult(CommandResult result)

  Sets the command result.

  Parameters:
    `result` - the new result for this command.

### getReturnValues

    protected java.util.List getReturnValues()

  Returns a list containing all of the return values from `ICommand` children.

### aggregateStatuses

    protected IStatus aggregateStatuses(java.util.List statuses)

  Overrides the superclass implementation to set the command result.

### compose

    public final ICommand compose(IUndoableOperation operation)

  Description copied from interface: `ICommand`
  Returns a new command object that represents a composition of this command with the specified `command` parameter.

  Specified by:
    `compose` in interface `ICommand`
  Parameters:
    `operation` - The operation that is to be composed with this command.
  Returns:
    A command that represents a composition of this command with the specified command.

### reduce

    public ICommand reduce()

  Returns the simplest form of this command that is equivalent. This is useful for removing unnecessary nesting of commands.

  If the composite has a single command, it returns the reduction of that single command. Otherwise, it returns itself.

  Specified by:
    `reduce` in interface `ICommand`
  Returns:
    the simplest form of this command that is equivalent

### isEmpty

    public final boolean isEmpty()

  Answers whether or not this composite operation has children.

  Specified by:
    `isEmpty` in interface `ICompositeCommand`
  Returns:
    `true` if the operation does not have children, `false` otherwise.

### canExecute

    public boolean canExecute()

  I can execute if I am not empty and all of my children can execute.

  Specified by:
    `canExecute` in interface `IUndoableOperation`

### canRedo

    public boolean canRedo()

  I can redo if I am not empty and all my children can all be redone.

  Specified by:
    `canRedo` in interface `IUndoableOperation`

### canUndo

    public boolean canUndo()

  I can undo if I am not empty and all my children can all be undone.

  Specified by:
    `canUndo` in interface `IUndoableOperation`

### internalSetResult

    public void internalSetResult(CommandResult result)

  Deprecated. internal API

  Internal method to set the command result.

  Specified by:
    `internalSetResult` in interface `org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult`
  Parameters:
    `result` - CommandResult to set

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.