List connections = gate.getConnections();
for(int j=0; j< connections.size(); j++){
Connection connection = (Connection)connections.get(j);
if (connection.isConnected(gate)){
ce.addEdit(new GateDisconnectEdit(connection, gate, connection.getFirstEndGate()!=null && connection.getFirstEndGate().equals(gate)));
connection.disconnect(gate);
}
}
}
}
if (ss.element instanceof Connection){
Connection gc = (Connection)ss.element;
if (gc.getFirstEndGate() != null){
ce.addEdit(new GateDisconnectEdit(gc, gc.getFirstEndGate(), true));
gc.disconnect(gc.getFirstEndGate());
}
if (gc.getLastEndGate() != null){
ce.addEdit(new GateDisconnectEdit(gc, gc.getLastEndGate(), false));
gc.disconnect(gc.getLastEndGate());
}
}
deleteShape(ss.element);
}