use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class HorizAlignCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
Map<NodeID, NodeUIInformation> oldPositions = m_alignMgr.getOldNodeCoordinates();
Map<ConnectionID, ConnectionUIInformation> oldBendpoints = m_alignMgr.getOldBendpoints();
// re-position nodes
for (Map.Entry<NodeID, NodeUIInformation> e : oldPositions.entrySet()) {
NodeContainer nc = m_wfm.getNodeContainer(e.getKey());
if (nc == null) {
continue;
}
nc.setUIInformation(e.getValue());
}
// re-create bendpoints
for (Map.Entry<ConnectionID, ConnectionUIInformation> e : oldBendpoints.entrySet()) {
ConnectionContainer cc = m_wfm.getConnection(e.getKey());
if (cc == null) {
continue;
}
cc.setUIInfo(e.getValue());
}
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class VerticAlignCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
Map<NodeID, NodeUIInformation> oldPositions = m_alignMgr.getOldNodeCoordinates();
Map<ConnectionID, ConnectionUIInformation> oldBendpoints = m_alignMgr.getOldBendpoints();
// re-position nodes
for (Map.Entry<NodeID, NodeUIInformation> e : oldPositions.entrySet()) {
NodeContainer nc = m_wfm.getNodeContainer(e.getKey());
if (nc == null) {
continue;
}
nc.setUIInformation(e.getValue());
}
// re-create bendpoints
for (Map.Entry<ConnectionID, ConnectionUIInformation> e : oldBendpoints.entrySet()) {
ConnectionContainer cc = m_wfm.getConnection(e.getKey());
if (cc == null) {
continue;
}
cc.setUIInfo(e.getValue());
}
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class NodeOutputView method workflowChanged.
/**
* {@inheritDoc}
*/
@Override
public void workflowChanged(final WorkflowEvent event) {
if (event.getType() == Type.NODE_REMOVED) {
// unregister from the node removed
Object oldValue = event.getOldValue();
if (oldValue instanceof NodeContainer) {
NodeContainer oldNode = (NodeContainer) oldValue;
if (oldNode.getID().equals(m_workflow.getID())) {
// our flow got removed (i.e. the editor or the workbench is closed)
disconnectFromWFM();
m_lastNode = null;
m_workflow = null;
m_parentWfm = null;
updateNCinfoInSWT(null);
return;
}
if (oldNode.getID().equals(m_lastNode)) {
oldNode.removeNodeStateChangeListener(this);
// pinned node is gone: unpin
m_pinButton.setChecked(false);
}
}
return;
}
if (!m_pinned || (m_pinned && !m_branchLocked)) {
return;
}
Type type = event.getType();
if (type == Type.CONNECTION_ADDED) {
ConnectionContainer cc = (ConnectionContainer) event.getNewValue();
if (cc.getSource().equals(m_lastNode)) {
if (m_workflow.getOutgoingConnectionsFor(m_lastNode).size() == 1) {
if (m_workflow.containsNodeContainer(cc.getDest())) {
// could be an outgoing metanode connection
// first connection: follow this new branch extension
updateNCinfoInSWT(cc.getDest());
}
}
}
} else if (type == Type.CONNECTION_REMOVED) {
ConnectionContainer cc = (ConnectionContainer) event.getOldValue();
if (cc.getDest().equals(m_lastNode)) {
if (m_workflow.containsNodeContainer(m_lastNode)) {
if (m_workflow.getOutgoingConnectionsFor(m_lastNode).size() == 0) {
updateNCinfoInSWT(cc.getSource());
}
} else {
updateNCinfoInSWT(cc.getSource());
}
}
} else {
return;
}
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class NewBendpointMoveCommand method undo.
/**
* {@inheritDoc}
*/
@Override
public void undo() {
ConnectionContainer connection = getConnection();
ConnectionUIInformation uiInfo = connection.getUIInfo();
Point oldLocation = m_oldLocation.getCopy();
Builder builder = ConnectionUIInformation.builder(uiInfo);
builder.removeBendpoint(m_index);
builder.addBendpoint(oldLocation.x, oldLocation.y, m_index);
// issue notification
connection.setUIInfo(builder.build());
}
use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.
the class ReplaceHelper method replaceNode.
/**
* Checks execution status of downstream nodes and pops up reset warning if enabled.
*
* @return if new node can be replaced
*/
public boolean replaceNode() {
boolean hasExecutedSuccessor = false;
for (ConnectionContainer connectionContainer : m_outgoingConnections) {
hasExecutedSuccessor = hasExecutedSuccessor || m_wfm.findNodeContainer(connectionContainer.getDest()).getNodeContainerState().isExecuted() || !m_wfm.canRemoveNode(m_oldNode.getID());
}
if (hasExecutedSuccessor) {
IPreferenceStore store = KNIMEUIPlugin.getDefault().getPreferenceStore();
if (!store.contains(PreferenceConstants.P_CONFIRM_RESET) || store.getBoolean(PreferenceConstants.P_CONFIRM_RESET)) {
MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(Display.getDefault().getActiveShell(), "Confirm reset...", "Do you really want to reset all downstream node(s) ?", "Do not ask again", false, null, null);
if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
return false;
}
if (dialog.getToggleState()) {
store.setValue(PreferenceConstants.P_CONFIRM_RESET, false);
KNIMEUIPlugin.getDefault().savePluginPreferences();
}
}
}
return true;
}
Aggregations