{
if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
{
// get connection to handle
IConnection[] connections = ( IConnection[] ) event.data;
IConnection targetConnection = ( IConnection ) event.item.getData();
if ( event.detail == DND.DROP_MOVE )
{
boolean fromTop = connectionManager.indexOf( connections[0] ) < connectionManager
.indexOf( targetConnection );
for ( int i = 0; i < connections.length; i++ )
{
connectionManager.removeConnection( connections[i] );
}
for ( int i = 0; i < connections.length; i++ )
{
int index = connectionManager.indexOf( targetConnection );
if ( fromTop )
{
index++;
connectionManager.addConnection( index + i, connections[i] );
}
else
{
connectionManager.addConnection( index, connections[i] );
}
}
}
else if ( event.detail == DND.DROP_COPY )
{
for ( int i = 0; i < connections.length; i++ )
{
IConnection newConnection = ( IConnection ) connections[i].clone();
int index = connectionManager.indexOf( targetConnection );
connectionManager.addConnection( index + i + 1, newConnection );
}
}
}