Runtime

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

    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.DeferredCreateConnectionViewCommand

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

public class DeferredCreateConnectionViewCommand
extends AbstractTransactionalCommand

This command is used to create a connection view between two editparts, when only the view adapters are available at the time of creating the command. The editparts are required to get the correct create connection command, so this command defers getting the create connection command until execution time at which point it can get the editparts from the editpart registry and the view adapters.

Field Summary
`protected EObject` `element` the element for the connection's semantic element
`protected PreferencesHint` `preferencesHint` The hint used to find the appropriate preference store from which general diagramming preference values for properties of shapes, connections, and diagrams can be retrieved.
`protected java.lang.String` `semanticHint` the connection's semantic hint
`protected IAdaptable` `sourceViewAdapter` the source adapter from which a View can be retrieved
`protected IAdaptable` `targetViewAdapter` the target adapter from which a View can be retrieved
`protected EditPartViewer` `viewer` the graphical viewer used to get the editpart registry

Constructor Summary
`DeferredCreateConnectionViewCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, EObject element, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer, PreferencesHint preferencesHint)` Constructor for `DeferredCreateConnectionViewCommand`.
`DeferredCreateConnectionViewCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.lang.String semanticHint, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter, EditPartViewer viewer, PreferencesHint preferencesHint)` Constructor for `DeferredCreateConnectionViewCommand`.

Method Summary
`protected CommandResult` `doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Finds the source and target editparts by extracting the views from the view adapaters and searching in the editpart viewer.
`java.util.List` `getAffectedFiles()` Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.

Methods inherited from class org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
`aggregateStatuses, cleanup, 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

### element

    protected EObject element

  the element for the connection's semantic element

### semanticHint

    protected java.lang.String semanticHint

  the connection's semantic hint

### sourceViewAdapter

    protected IAdaptable sourceViewAdapter

  the source adapter from which a View can be retrieved

### targetViewAdapter

    protected IAdaptable targetViewAdapter

  the target adapter from which a View can be retrieved

### viewer

    protected EditPartViewer viewer

  the graphical viewer used to get the editpart registry

### preferencesHint

    protected PreferencesHint preferencesHint

  The hint used to find the appropriate preference store from which general diagramming preference values for properties of shapes, connections, and diagrams can be retrieved. This hint is mapped to a preference store in the `DiagramPreferencesRegistry`.

Constructor Detail

### DeferredCreateConnectionViewCommand

    public DeferredCreateConnectionViewCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                                               EObject element,
                                               IAdaptable sourceViewAdapter,
                                               IAdaptable targetViewAdapter,
                                               EditPartViewer viewer,
                                               PreferencesHint preferencesHint)

  Constructor for `DeferredCreateConnectionViewCommand`.

Parameters:
  `editingDomain` - the editing domain through which model changes are made
  `element` - the connection's semantic element
  `sourceViewAdapter` - adapter from which the source view can be retrieved
  `targetViewAdapter` - adapter from which the target view can be retrieved
  `viewer` - the viewer used to get the editpart registry

### DeferredCreateConnectionViewCommand

    public DeferredCreateConnectionViewCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                                               java.lang.String semanticHint,
                                               IAdaptable sourceViewAdapter,
                                               IAdaptable targetViewAdapter,
                                               EditPartViewer viewer,
                                               PreferencesHint preferencesHint)

  Constructor for `DeferredCreateConnectionViewCommand`. Passing in the semanticHint allows for the creation of a connection view without a semantic element.

Parameters:
  `editingDomain` - the editing domain through which model changes are made
  `semanticHint` - the connection's semantic hint
  `sourceViewAdapter` - adapter from which the source view can be retrieved
  `targetViewAdapter` - adapter from which the target view can be retrieved
  `viewer` - the viewer used to get the editpart registry

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

  Finds the source and target editparts by extracting the views from the view adapaters and searching in the editpart viewer. Creates a connection view between the source and target.

  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

Runtime

Guidelines for using Eclipse APIs.

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