// If the element created is a connection and if a gate has been tracked,
// then perform the connection of the first connection end.
if (selectedGate!=null && createdElement instanceof Connection){
Connection createdConnection = (Connection)createdElement;
createdConnection.connect(selectedGate, true);
createdConnection.gatePositionHasChanged(selectedGate);
_compoundEdit.addEdit(new GateConnectEdit(createdConnection, selectedGate, true));
}
// clear tracked gates and components
_currentTrackedGates.clear();