Search in sources :

Example 1 with DisconnectMetaNodeLinkCommand

use of org.knime.workbench.editor2.commands.DisconnectMetaNodeLinkCommand in project knime-core by knime.

the class DisconnectMetaNodeLinkAction method runOnNodes.

/**
 * {@inheritDoc}
 */
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
    List<NodeID> idList = new ArrayList<NodeID>();
    for (NodeContainerEditPart p : nodeParts) {
        Object model = p.getModel();
        if (model instanceof WorkflowManagerUI) {
            WorkflowManagerUI wm = (WorkflowManagerUI) model;
            MetaNodeTemplateInformation i = unwrapWFM(wm).getTemplateInformation();
            if (Role.Link.equals(i.getRole())) {
                idList.add(wm.getID());
            }
        }
    }
    NodeID[] ids = idList.toArray(new NodeID[idList.size()]);
    DisconnectMetaNodeLinkCommand disCmd = new DisconnectMetaNodeLinkCommand(getManager(), ids);
    execute(disCmd);
}
Also used : NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) NodeID(org.knime.core.node.workflow.NodeID) ArrayList(java.util.ArrayList) WorkflowManagerUI(org.knime.core.ui.node.workflow.WorkflowManagerUI) DisconnectMetaNodeLinkCommand(org.knime.workbench.editor2.commands.DisconnectMetaNodeLinkCommand) MetaNodeTemplateInformation(org.knime.core.node.workflow.MetaNodeTemplateInformation)

Aggregations

ArrayList (java.util.ArrayList)1 MetaNodeTemplateInformation (org.knime.core.node.workflow.MetaNodeTemplateInformation)1 NodeID (org.knime.core.node.workflow.NodeID)1 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)1 DisconnectMetaNodeLinkCommand (org.knime.workbench.editor2.commands.DisconnectMetaNodeLinkCommand)1 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)1