Search in sources :

Example 1 with SetParallelizationCommand

use of org.talend.designer.core.ui.editor.cmd.SetParallelizationCommand in project tdi-studio-se by Talend.

the class SetParallelizationAction method run.

@Override
public void run() {
    List editparts = getSelectedObjects();
    if (editparts.size() == 1) {
        Object o = editparts.get(0);
        if (o instanceof NodePart) {
            NodePart part = (NodePart) o;
            Node node = (Node) part.getModel();
            getCommandStack().execute(new SetParallelizationCommand(node));
        } else if (o instanceof SubjobContainerPart) {
            boolean hasStartNode = false;
            List<NodeContainerPart> childNodes = ((SubjobContainerPart) o).getChildren();
            for (NodeContainerPart childNode : childNodes) {
                NodeContainerPart part = (NodeContainerPart) childNode;
                NodeContainer node = (NodeContainer) part.getModel();
                if (node.getNode().isStart()) {
                    hasStartNode = true;
                    getCommandStack().execute(new SetParallelizationCommand(node.getNode()));
                }
            }
            if (!hasStartNode) {
                for (NodeContainerPart childNode : childNodes) {
                    NodeContainerPart part = (NodeContainerPart) childNode;
                    NodeContainer node = (NodeContainer) part.getModel();
                    if (node.getNode().isSubProcessStart()) {
                        getCommandStack().execute(new SetParallelizationCommand(node.getNode()));
                    }
                }
            }
        }
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) SetParallelizationCommand(org.talend.designer.core.ui.editor.cmd.SetParallelizationCommand) Node(org.talend.designer.core.ui.editor.nodes.Node) List(java.util.List) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)

Aggregations

List (java.util.List)1 SetParallelizationCommand (org.talend.designer.core.ui.editor.cmd.SetParallelizationCommand)1 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)1 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)1 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)1