Search in sources :

Example 1 with DisconnectSubNodeLinkCommand

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

the class DisconnectSubNodeLinkAction 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 (Wrapper.wraps(model, SubNodeContainer.class)) {
            SubNodeContainer snc = Wrapper.unwrap((UI) model, SubNodeContainer.class);
            MetaNodeTemplateInformation i = snc.getTemplateInformation();
            if (Role.Link.equals(i.getRole())) {
                idList.add(snc.getID());
            }
        }
    }
    NodeID[] ids = idList.toArray(new NodeID[idList.size()]);
    DisconnectSubNodeLinkCommand disCmd = new DisconnectSubNodeLinkCommand(getManager(), ids);
    execute(disCmd);
}
Also used : SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) NodeID(org.knime.core.node.workflow.NodeID) ArrayList(java.util.ArrayList) DisconnectSubNodeLinkCommand(org.knime.workbench.editor2.commands.DisconnectSubNodeLinkCommand) 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 SubNodeContainer (org.knime.core.node.workflow.SubNodeContainer)1 DisconnectSubNodeLinkCommand (org.knime.workbench.editor2.commands.DisconnectSubNodeLinkCommand)1 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)1