org.eclipse.graphiti.ui.internal.command

## Class CreateConnectionCommand

- java.lang.Object
- - org.eclipse.gef.commands.Command
  - - org.eclipse.graphiti.ui.internal.command.AbstractCommand
    - - org.eclipse.graphiti.ui.internal.command.CreateConnectionCommand

All Implemented Interfaces:
  IConfigurationProviderHolder

    public class CreateConnectionCommand
    extends AbstractCommand

### Constructor Summary

Constructors
Constructor and Description
`CreateConnectionCommand(IConfigurationProvider configurationProvider, PictogramElement pe, java.util.List<IFeature> features)` Instantiate a command that can create a connection between two anchors.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `canExecute()`
`boolean` `canStartConnection()`
`boolean` `canUndo()`
`void` `connectionStarted()`
`void` `deactivate()`
`void` `execute()`
`IFeatureAndContext[]` `getFeaturesAndContexts()`
`PictogramElement` `getSourceObject()`
`void` `redo()`
`void` `setLocation(org.eclipse.draw2d.geometry.Point location)` sets the location for the command when connection is dropped into nowhere
`void` `setTarget(PictogramElement pe)` Set the target endpoint for the connection.
`void` `undo()`

### Methods inherited from class org.eclipse.graphiti.ui.internal.command.AbstractCommand

`getConfigurationProvider`

### Methods inherited from class org.eclipse.gef.commands.Command

`canRedo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CreateConnectionCommand

    public CreateConnectionCommand(IConfigurationProvider configurationProvider,
                                   PictogramElement pe,
                                   java.util.List<IFeature> features)

Instantiate a command that can create a connection between two anchors.

Parameters:
  `source` - the source endpoint (a non-null Shape instance)
  `lineStyle` - the desired line style. See Connection#setLineStyle(int) for details
Throws:
  `java.lang.IllegalArgumentException` - if source is null
See Also:
  `Connection#setLineStyle(int)`

### Method Detail

#### canExecute

    public boolean canExecute()

Overrides:
  `canExecute` in class `org.eclipse.gef.commands.Command`

#### execute

    public void execute()

Overrides:
  `execute` in class `org.eclipse.gef.commands.Command`

#### canStartConnection

    public boolean canStartConnection()

#### redo

    public void redo()

Overrides:
  `redo` in class `org.eclipse.gef.commands.Command`

#### setTarget

    public void setTarget(PictogramElement pe)

Set the target endpoint for the connection.

Parameters:
  `target` - that target endpoint (a non-null Shape instance)
Throws:
  `java.lang.IllegalArgumentException` - if target is null

#### canUndo

    public boolean canUndo()

Overrides:
  `canUndo` in class `org.eclipse.gef.commands.Command`

#### undo

    public void undo()

Overrides:
  `undo` in class `org.eclipse.gef.commands.Command`

#### getSourceObject

    public PictogramElement getSourceObject()

#### setLocation

    public void setLocation(org.eclipse.draw2d.geometry.Point location)

sets the location for the command when connection is dropped into nowhere

Parameters:
  `location` -

#### getFeaturesAndContexts

    public IFeatureAndContext[] getFeaturesAndContexts()

#### connectionStarted

    public void connectionStarted()

#### deactivate

    public void deactivate()