Runtime

## org.eclipse.gmf.runtime.diagram.ui.commands
Class DeferredLayoutCommand

    java.lang.Object
      org.eclipse.core.commands.operations.AbstractOperation
          org.eclipse.emf.workspace.AbstractEMFOperation
              org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
                  org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand

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

public class DeferredLayoutCommand
extends AbstractTransactionalCommand

This command is used to arrange editparts on a diagram, when only the view adapters are available at the time of creating the command. It is necessary to have the editparts when creating a layout command so this command defers the creation of the layout command until execution time at which point it can get the editparts from the editpart registry using the view adapters.

Field Summary
`protected IGraphicalEditPart` `containerEP` the diagram editpart used to get the editpart registry
`protected java.lang.String` `layoutType` the type of layout to be performed
`protected java.util.List` `viewAdapters` the IAdaptables from which an View can be retrieved

Constructor Summary
`DeferredLayoutCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.util.List viewAdapters, IGraphicalEditPart containerEP)` Constructor for `DeferredLayoutCommand`.
`DeferredLayoutCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.util.List viewAdapters, IGraphicalEditPart containerEP, java.lang.String commandLayoutType)` Constructor for `DeferredLayoutCommand`.

Method Summary
`protected void` `cleanup()` Subclasses may implement this method to dispose of objects that were required for execution, but are no longer require to undo or redo this operation.
`protected CommandResult` `doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Executes a layout command with all the editparts for the view adapters.
`java.util.List` `getAffectedFiles()` Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.
`protected IGraphicalEditPart` `getContainerEP()` gets the container edit part
`protected IFigure` `getContainerFigure()` gets the container edit part's figure
`protected java.util.List` `getViewAdapters()` gets a list of `IAdaptable` that can adapt to `View`

Methods inherited from class org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
`aggregateStatuses, compose, didRedo, didUndo, doExecute, doRedo, doUndo, getCommandResult, getWorkspaceFiles, getWorkspaceFiles, internalSetResult, reduce, setResult`

Methods inherited from class org.eclipse.emf.workspace.AbstractEMFOperation
`canRedo, canUndo, didCommit, dispose, execute, getChange, getEditingDomain, getOptions, redo, undo`

Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
`addContext, canExecute, 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
`addContext, canExecute, canRedo, canUndo, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo`

Field Detail

### layoutType

    protected java.lang.String layoutType

  the type of layout to be performed

### viewAdapters

    protected java.util.List viewAdapters

  the IAdaptables from which an View can be retrieved

### containerEP

    protected IGraphicalEditPart containerEP

  the diagram editpart used to get the editpart registry

Constructor Detail

### DeferredLayoutCommand

    public DeferredLayoutCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                                 java.util.List viewAdapters,
                                 IGraphicalEditPart containerEP)

  Constructor for `DeferredLayoutCommand`.

Parameters:
  `editingDomain` - the editing domain through which model changes are made
  `viewAdapters` - the IAdaptables from which an IView can be retrieved
  `containerEP` - the container editpart used to get the editpart registry

### DeferredLayoutCommand

    public DeferredLayoutCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                                 java.util.List viewAdapters,
                                 IGraphicalEditPart containerEP,
                                 java.lang.String commandLayoutType)

  Constructor for `DeferredLayoutCommand`.

Parameters:
  `editingDomain` - the editing domain through which model changes are made
  `viewAdapters` - the IAdaptables from which an IView can be retrieved
  `containerEP` - the container editpart used to get the editpart registry
  `commandLayoutType` - the type of layout to be performed

Method Detail

### getAffectedFiles

    public java.util.List getAffectedFiles()

  Description copied from class: `AbstractTransactionalCommand`
  Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.

  Specified by:
    `getAffectedFiles` in interface `ICommand`
  Overrides:
    `getAffectedFiles` in class `AbstractTransactionalCommand`

### doExecuteWithResult

    protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor,
                                                IAdaptable info)
                                         throws ExecutionException

  Executes a layout command with all the editparts for the view adapters.

  Specified by:
    `doExecuteWithResult` in class `AbstractTransactionalCommand`
  Parameters:
    `progressMonitor` - the progress monitor provided by the operation history
    `info` - the adaptable provided by the operation history
  Returns:
    the result of the execution
  Throws:
    `ExecutionException` - if, for some reason, I fail to complete the operation

### cleanup

    protected void cleanup()

  Description copied from class: `AbstractTransactionalCommand`
  Subclasses may implement this method to dispose of objects that were required for execution, but are no longer require to undo or redo this operation.

  This method is invoked at the end of `AbstractTransactionalCommand.doExecute(IProgressMonitor, IAdaptable)`.

  Overrides:
    `cleanup` in class `AbstractTransactionalCommand`

### getContainerFigure

    protected IFigure getContainerFigure()

  gets the container edit part's figure

  Returns:
    the container figure

### getContainerEP

    protected IGraphicalEditPart getContainerEP()

  gets the container edit part

  Returns:
    the container edit part

### getViewAdapters

    protected java.util.List getViewAdapters()

  gets a list of `IAdaptable` that can adapt to `View`

  Returns:
    view adapters

Runtime

Guidelines for using Eclipse APIs.

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