// Increment the update level to aggregate any disconnection edits.
undoableEditSupport.beginUpdate();
// Get the emitter and collector argument state from before the disconnection.
StateEdit collectorArgumentState = new StateEdit(collectorArgumentStateEditable);
// Now actually perform the disconnection
disconnect(connection);
// Notify undo managers of the disconnection.
undoableEditSupport.postEdit(new UndoableDisconnectGemsEdit(TableTop.this, connection, collectorArgumentState));
// If the destination input is an unused code gem input, update its model, and post an edit for its state change.
Gem destGem = connection.getDestination().getGem();
if (destGem instanceof CodeGem) {
CodeGemEditor destCodeGemEditor = getCodeGemEditor((CodeGem)destGem);
if (destCodeGemEditor.isUnusedArg(connection.getDestination()) ||
destGem.isBroken() && ((CodeGem)destGem).getCodeResultType() != null) { // check for incompatible connection.
StateEdit stateEdit = new StateEdit(destCodeGemEditor, GemCutter.getResourceString("UndoText_DisconnectGems"));
destCodeGemEditor.doSyntaxSmarts();
updateForConnectivity(destCodeGemEditor);
stateEdit.end();
undoableEditSupport.postEdit(stateEdit);
}
}
// Update code gem editors for connectivity.