Search in sources :

Example 16 with ConnectionContainer

use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.

the class DeleteCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute() {
    WorkflowManager hostWFM = getHostWFM();
    // removed.
    if (m_nodeIDs.length > 0 || m_annotations.length > 0) {
        WorkflowCopyContent.Builder content = WorkflowCopyContent.builder();
        content.setNodeIDs(m_nodeIDs);
        content.setAnnotation(m_annotations);
        m_undoPersitor = hostWFM.copy(true, content.build());
    }
    for (WorkflowAnnotation anno : m_annotations) {
        hostWFM.removeAnnotation(anno);
    }
    for (NodeID id : m_nodeIDs) {
        hostWFM.removeNode(id);
    }
    for (ConnectionContainer cc : m_connections) {
        hostWFM.removeConnection(cc);
    }
}
Also used : WorkflowCopyContent(org.knime.core.node.workflow.WorkflowCopyContent) ConnectionContainer(org.knime.core.node.workflow.ConnectionContainer) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) NodeID(org.knime.core.node.workflow.NodeID) WorkflowAnnotation(org.knime.core.node.workflow.WorkflowAnnotation)

Example 17 with ConnectionContainer

use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.

the class NewBendpointDeleteCommand method redo.

/**
 * {@inheritDoc}
 */
@Override
public void redo() {
    ConnectionContainer connection = getConnectionContainer();
    ConnectionUIInformation uiInfo = getUIInfo(connection);
    uiInfo = ConnectionUIInformation.builder(uiInfo).removeBendpoint(m_index).build();
    // issue notification
    connection.setUIInfo(uiInfo);
}
Also used : ConnectionContainer(org.knime.core.node.workflow.ConnectionContainer) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation)

Example 18 with ConnectionContainer

use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.

the class NewBendpointDeleteCommand method undo.

/**
 * {@inheritDoc}
 */
@Override
public void undo() {
    ConnectionContainer connection = getConnectionContainer();
    ConnectionUIInformation uiInfo = getUIInfo(connection);
    uiInfo = ConnectionUIInformation.builder(uiInfo).addBendpoint(m_point[0], m_point[1], m_index).build();
    // issue notification
    connection.setUIInfo(uiInfo);
}
Also used : ConnectionContainer(org.knime.core.node.workflow.ConnectionContainer) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation)

Example 19 with ConnectionContainer

use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.

the class NewBendpointCreateCommand method undo.

/**
 * {@inheritDoc}
 */
@Override
public void undo() {
    ConnectionContainer connection = getConnectionContainer();
    ConnectionUIInformation uiInfo = getUIInfo(connection);
    uiInfo = ConnectionUIInformation.builder(uiInfo).removeBendpoint(m_index).build();
    // we need this to fire some update event up
    connection.setUIInfo(uiInfo);
}
Also used : ConnectionContainer(org.knime.core.node.workflow.ConnectionContainer) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation)

Example 20 with ConnectionContainer

use of org.knime.core.node.workflow.ConnectionContainer in project knime-core by knime.

the class NewBendpointCreateCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute() {
    ConnectionContainer connection = getConnectionContainer();
    ConnectionUIInformation uiInfo = getUIInfo(connection);
    Point location = m_location.getCopy();
    WorkflowEditor.adaptZoom(m_zoomManager, location, true);
    ConnectionUIInformation.Builder uiInfoBuilder = ConnectionUIInformation.builder(uiInfo).addBendpoint(location.x, location.y, m_index);
    // we need this to fire some update event up
    connection.setUIInfo(uiInfoBuilder.build());
}
Also used : ConnectionContainer(org.knime.core.node.workflow.ConnectionContainer) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ConnectionContainer (org.knime.core.node.workflow.ConnectionContainer)28 ConnectionUIInformation (org.knime.core.node.workflow.ConnectionUIInformation)14 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)9 NodeID (org.knime.core.node.workflow.NodeID)8 Point (org.eclipse.draw2d.geometry.Point)6 NodeContainer (org.knime.core.node.workflow.NodeContainer)6 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)5 ConnectionID (org.knime.core.node.workflow.ConnectionID)4 Map (java.util.Map)3 Builder (org.knime.core.node.workflow.ConnectionUIInformation.Builder)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 MessageDialogWithToggle (org.eclipse.jface.dialogs.MessageDialogWithToggle)2 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)2 WorkflowAnnotation (org.knime.core.node.workflow.WorkflowAnnotation)2 WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)2 List (java.util.List)1 Set (java.util.Set)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 EditPartViewer (org.eclipse.gef.EditPartViewer)1