## org.eclipse.emf.transaction.util
Class TriggerCommand

    java.lang.Object
      org.eclipse.emf.common.command.AbstractCommand
          org.eclipse.emf.common.command.CompoundCommand
              org.eclipse.emf.transaction.util.ConditionalRedoCommand.Compound
                  org.eclipse.emf.transaction.util.TriggerCommand

All Implemented Interfaces:
  org.eclipse.emf.common.command.Command, ConditionalRedoCommand

    public class TriggerCommand

extends ConditionalRedoCommand.Compound

A specialized compound command that combines a "triggering" command with commands contributed by `ResourceSetListener`s as triggers. It takes care of the distinction between the triggering command and the others when executing, undoing, and redoing.

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
`org.eclipse.emf.common.command.AbstractCommand.NonDirtying`

Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.util.ConditionalRedoCommand
`ConditionalRedoCommand.Compound`

Field Summary

Fields inherited from class org.eclipse.emf.common.command.CompoundCommand
`commandList, LAST_COMMAND_ALL, MERGE_COMMAND_ALL, resultIndex`

Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
`description, isExecutable, isPrepared, label`

Constructor Summary
`TriggerCommand(org.eclipse.emf.common.command.Command triggeringCommand, List<? extends org.eclipse.emf.common.command.Command> triggers)` Initializes me with a list of commands triggered by the execution of some command on the command stack.
`TriggerCommand(List<? extends org.eclipse.emf.common.command.Command> triggers)` Initializes me with a list of commands triggered not by the execution of a command but by direct manipulation of the model during a read/write transaction.

Method Summary
`void` `dispose()` Extends the inherited implementation by disposing my triggering command, also (if any).
`void` `execute()` Executes all of my trigger commands, then prepends the original triggering command (if any) so that it will be undone/redone with the others.
`org.eclipse.emf.common.command.Command` `getTriggeringCommand()` Retrieves the command that triggered the trigger commands.
`List<org.eclipse.emf.common.command.Command>` `getTriggers()` Retrieves my trigger commands (not including the triggering command, if any).
`protected boolean` `prepare()`

Methods inherited from class org.eclipse.emf.transaction.util.ConditionalRedoCommand.Compound
`canRedo, chain`

Methods inherited from class org.eclipse.emf.common.command.CompoundCommand
`append, appendAndExecute, appendIfCanExecute, canUndo, getAffectedObjects, getCommandList, getDescription, getLabel, getMergedAffectedObjectsCollection, getMergedResultCollection, getResult, getResultIndex, isEmpty, redo, toString, undo, unwrap`

Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
`canExecute, setDescription, setLabel`

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

Methods inherited from interface org.eclipse.emf.common.command.Command
`canExecute, canUndo, getAffectedObjects, getDescription, getLabel, getResult, redo, undo`

Constructor Detail

### TriggerCommand

    public TriggerCommand(List<? extends org.eclipse.emf.common.command.Command> triggers)

  Initializes me with a list of commands triggered not by the execution of a command but by direct manipulation of the model during a read/write transaction. It is assumed, then, that the trigger command will not actually be used with a command stack where its label and description would matter for undo/redo menus.

  Parameters:
    `triggers` - the trigger commands that I encapsulate

### TriggerCommand

    public TriggerCommand(org.eclipse.emf.common.command.Command triggeringCommand,
                          List<? extends org.eclipse.emf.common.command.Command> triggers)

  Initializes me with a list of commands triggered by the execution of some command on the command stack. My label and description are the same as the triggering command's

  Parameters:
    `triggeringCommand` - the command that triggered further commands
    `triggers` - the trigger commands that I encapsulate

Method Detail

### getTriggeringCommand

    public final org.eclipse.emf.common.command.Command getTriggeringCommand()

  Retrieves the command that triggered the trigger commands.

  Returns:
    the triggering command, or `null` if the triggers were not instigated by the execution of a command

### getTriggers

    public final List<org.eclipse.emf.common.command.Command> getTriggers()

  Retrieves my trigger commands (not including the triggering command, if any).

  Returns:
    my triggers, as a list of `Command`s. Will not be empty

### prepare

    protected boolean prepare()

  Overrides:
    `prepare` in class `org.eclipse.emf.common.command.CompoundCommand`

### execute

    public void execute()

  Executes all of my trigger commands, then prepends the original triggering command (if any) so that it will be undone/redone with the others.

  Specified by:
    `execute` in interface `org.eclipse.emf.common.command.Command`
  Overrides:
    `execute` in class `org.eclipse.emf.common.command.CompoundCommand`

### dispose

    public void dispose()

  Extends the inherited implementation by disposing my triggering command, also (if any).

  Specified by:
    `dispose` in interface `org.eclipse.emf.common.command.Command`
  Overrides:
    `dispose` in class `org.eclipse.emf.common.command.CompoundCommand`

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