## org.eclipse.emf.transaction.impl
Class TransactionalCommandStackImpl

    java.lang.Object
      org.eclipse.emf.common.command.BasicCommandStack
          org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack
              org.eclipse.emf.transaction.impl.TransactionalCommandStackImpl

All Implemented Interfaces:
  org.eclipse.emf.common.command.CommandStack, InternalTransactionalCommandStack, TransactionalCommandStack

    public class TransactionalCommandStackImpl

extends AbstractTransactionalCommandStack

The default implementation of the transactional editing domain command stack.

Field Summary

Fields inherited from class org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack
`exceptionHandler`

Fields inherited from class org.eclipse.emf.common.command.BasicCommandStack
`commandList, listeners, mostRecentCommand, saveIndex, top`

Constructor Summary
`TransactionalCommandStackImpl()` Initializes me.

Method Summary
`boolean` `canRedo()` Extends the inherited implementation to consider the redoability of `ConditionalRedoCommand`s.
`EMFCommandTransaction` `createTransaction(org.eclipse.emf.common.command.Command command, Map<?,?> options)` Creates a read/write transaction in my editing domain for the purpose of executing the specified command.
`void` `dispose()` Disposes of my state and any additional resources that I may be retaining.
`protected void` `doExecute(org.eclipse.emf.common.command.Command command, Map<?,?> options)` Implemented by subclasses to perform the execution of the specified `command`.
`void` `executeTriggers(org.eclipse.emf.common.command.Command command, List<org.eclipse.emf.common.command.Command> triggers, Map<?,?> options)` Executes the specified list of trigger commands.
`protected void` `handleRollback(org.eclipse.emf.common.command.Command command, RollbackException rbe)` Extends the superclass implementation to first pop the failed command off of the stack, if it was already appended.
`void` `redo()` Extends the inherited implementation by invoking it within the context of a redo transaction (a read/write transaction with the `undo/redo options`).
`void` `undo()` Extends the inherited implementation by invoking it within the context of an undo transaction (a read/write transaction with the `undo/redo options`).

Methods inherited from class org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack
`basicExecute, execute, execute, getDomain, getExceptionHandler, getUndoRedoOptions, handleError, makeTriggerTransactionOptions, rollback, setEditingDomain, setExceptionHandler`

Methods inherited from class org.eclipse.emf.common.command.BasicCommandStack
`addCommandStackListener, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, isSaveNeeded, notifyListeners, removeCommandStackListener, saveIsDone`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.emf.common.command.CommandStack
`addCommandStackListener, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, removeCommandStackListener`

Constructor Detail

### TransactionalCommandStackImpl

    public TransactionalCommandStackImpl()

  Initializes me.

Method Detail

### doExecute

    protected void doExecute(org.eclipse.emf.common.command.Command command,
                             Map<?,?> options)
                      throws InterruptedException,
                             RollbackException

  Implemented by subclasses to perform the execution of the specified `command`. Invoked by the `AbstractTransactionalCommandStack.execute(Command, Map)` method.

  Specified by:
    `doExecute` in class `AbstractTransactionalCommandStack`
  Parameters:
    `command` - the command to execute
    `options` - the transaction options to apply to execution of the command
  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting to start the transaction
    `RollbackException` - if the execution of the command is rolled back
  Since:
    1.1

### handleRollback

    protected void handleRollback(org.eclipse.emf.common.command.Command command,
                                  RollbackException rbe)

  Extends the superclass implementation to first pop the failed command off of the stack, if it was already appended.

  Overrides:
    `handleRollback` in class `AbstractTransactionalCommandStack`
  Parameters:
    `command` - the command whose execution was rolled back (may be `null` if not known)
    `rbe` - the roll-back exception (may be `null` if no exception is to be thrown)
  Since:
    1.1

### undo

    public void undo()

  Extends the inherited implementation by invoking it within the context of an undo transaction (a read/write transaction with the `undo/redo options`).

  Specified by:
    `undo` in interface `org.eclipse.emf.common.command.CommandStack`
  Overrides:
    `undo` in class `org.eclipse.emf.common.command.BasicCommandStack`

### canRedo

    public boolean canRedo()

  Extends the inherited implementation to consider the redoability of `ConditionalRedoCommand`s.

  Specified by:
    `canRedo` in interface `org.eclipse.emf.common.command.CommandStack`
  Overrides:
    `canRedo` in class `org.eclipse.emf.common.command.BasicCommandStack`

### redo

    public void redo()

  Extends the inherited implementation by invoking it within the context of a redo transaction (a read/write transaction with the `undo/redo options`).

  Specified by:
    `redo` in interface `org.eclipse.emf.common.command.CommandStack`
  Overrides:
    `redo` in class `org.eclipse.emf.common.command.BasicCommandStack`

### createTransaction

    public EMFCommandTransaction createTransaction(org.eclipse.emf.common.command.Command command,
                                                   Map<?,?> options)
                                            throws InterruptedException

  Description copied from interface: `InternalTransactionalCommandStack`
  Creates a read/write transaction in my editing domain for the purpose of executing the specified command. The resulting transaction is expected to be started when it is returned (hence the possibility of interruption).

  Parameters:
    `command` - a command that I need to execute
    `options` - the options to apply to the resulting transaction
  Returns:
    the command transaction
  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting for the transaction to start
  See Also:
    `InternalTransactionalCommandStack.getDomain()`

### executeTriggers

    public void executeTriggers(org.eclipse.emf.common.command.Command command,
                                List<org.eclipse.emf.common.command.Command> triggers,
                                Map<?,?> options)
                         throws InterruptedException,
                                RollbackException

  Description copied from interface: `InternalTransactionalCommandStack`
  Executes the specified list of trigger commands. All of the commands are executed within a single child transaction of the transaction that executed the triggering `command`; they must not be "piggy-backed" on the currently active transaction.

  Parameters:
    `command` - the command whose execution triggered additional commands (from pre-commit listeners)
    `triggers` - a list of zero or more `Command`s to execute. If there are none, then no transaction needs to be started
    `options` - the options to apply to the child transaction
  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting for the trigger transaction to start
    `RollbackException` - if the trigger transaction rolls back on commit
  See Also:
    `ResourceSetListener.transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)`, `InternalTransactionalCommandStack.createTransaction(Command, Map)`

### dispose

    public void dispose()

  Description copied from interface: `InternalTransactionalCommandStack`
  Disposes of my state and any additional resources that I may be retaining. I am only disposed when my `editing domain` is disposed.

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.