Search in sources :

Example 6 with SubjobContainerPart

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

the class DesignerColorsPreferencePage method changeMRGroupColor.

private void changeMRGroupColor(ProcessPart processPart) {
    for (Object o : processPart.getChildren()) {
        if (o instanceof SubjobContainerPart) {
            for (Object child : ((SubjobContainerPart) o).getChildren()) {
                if (child instanceof JobletContainerPart) {
                    JobletContainer jCon = (JobletContainer) ((JobletContainerPart) child).getModel();
                    jCon.setPropertyValue(JobletContainer.UPDATE_JOBLET_DISPLAY, DesignerColorUtils.getPreferenceMRGroupRGB(DesignerColorUtils.MRGROUP_COLOR_NAME, DesignerColorUtils.MR_COLOR));
                    jCon.setPropertyValue(JobletContainer.UPDATE_JOBLET_DISPLAY, DesignerColorUtils.getPreferenceMRGroupRGB(DesignerColorUtils.JOBLET_COLOR_NAME, DesignerColorUtils.JOBLET_COLOR));
                }
            }
        }
    }
}
Also used : JobletContainer(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer) JobletContainerPart(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainerPart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)

Example 7 with SubjobContainerPart

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

the class AbstractMultiPageTalendEditor method selectNode.

/**
     * DOC bqian Comment method "selectNode".
     * 
     * @param node
     */
@SuppressWarnings("unchecked")
public void selectNode(Node node) {
    GraphicalViewer viewer = designerEditor.getViewer();
    Object object = viewer.getRootEditPart().getChildren().get(0);
    if (object instanceof ProcessPart) {
        // ProcessPart < SubjobContainerPart < NodeContainerPart < NodePart
        for (EditPart editPart : (List<EditPart>) ((ProcessPart) object).getChildren()) {
            if (editPart instanceof SubjobContainerPart) {
                SubjobContainerPart subjobPart = (SubjobContainerPart) editPart;
                for (EditPart part : (List<EditPart>) subjobPart.getChildren()) {
                    if (part instanceof NodeContainerPart) {
                        EditPart nodePart = (EditPart) part.getChildren().get(0);
                        if (nodePart instanceof NodePart) {
                            if (((NodePart) nodePart).getModel().equals(node)) {
                                viewer.select(nodePart);
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : GraphicalViewer(org.eclipse.gef.GraphicalViewer) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) EditPart(org.eclipse.gef.EditPart) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PlatformObject(org.eclipse.core.runtime.PlatformObject) ArrayList(java.util.ArrayList) List(java.util.List) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 8 with SubjobContainerPart

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

the class NodePartKeyHander method getNavigationSiblings.

@Override
protected List getNavigationSiblings() {
    EditPart focusPart = getFocusEditPart();
    boolean displayVa = true;
    if (focusPart.getParent() != null) {
        if (focusPart instanceof SubjobContainerPart) {
            // return getNodePart((SubjobContainerPart) focusPart);
            SubjobContainerPart subConPart = (SubjobContainerPart) focusPart;
            List subList = focusPart.getParent().getChildren();
            for (int j = 0; j < subList.size(); j++) {
                if (subList.get(j) instanceof SubjobContainerPart) {
                    subConPart = (SubjobContainerPart) subList.get(j);
                    SubjobContainer subContainer = (SubjobContainer) subConPart.getModel();
                    if (subContainer.isDisplayed() == false) {
                        displayVa = false;
                    }
                } else if (subList.get(j) instanceof NoteEditPart) {
                    NoteEditPart notePart = (NoteEditPart) subList.get(j);
                    return getNodePart((ProcessPart) notePart.getParent());
                } else if (subList.get(j) instanceof NodePart) {
                    NodePart node = (NodePart) subList.get(j);
                    return getNodePart((ProcessPart) node.getParent().getParent().getParent());
                }
            }
            if (displayVa == false) {
                return getNodePart((ProcessPart) focusPart.getParent());
            }
        } else if (focusPart instanceof NodePart) {
            // get all node part for a job.
            return getNodePart((ProcessPart) focusPart.getParent().getParent().getParent());
        // return getNodePart((SubjobContainerPart) focusPart.getParent().getParent());
        } else if (focusPart instanceof NoteEditPart) {
            return getNodePart((ProcessPart) focusPart.getParent());
        }
        return focusPart.getParent().getChildren();
    }
    List list = new ArrayList();
    list.add(focusPart);
    return list;
}
Also used : SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) EditPart(org.eclipse.gef.EditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) ArrayList(java.util.ArrayList) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) List(java.util.List) ArrayList(java.util.ArrayList) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 9 with SubjobContainerPart

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

the class NodesMoveCommond method execute.

@SuppressWarnings("unchecked")
@Override
public void execute() {
    // create the node container list to paste
    createNodeContainerList();
    AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
    // save old selection
    if (!multipleCommand) {
        oldSelection = new ArrayList<EditPart>();
        for (EditPart editPart : (List<EditPart>) viewer.getSelectedEditParts()) {
            oldSelection.add(editPart);
        }
        // remove the old selection
        viewer.deselectAll();
    }
    // creates the different nodes
    for (NodeContainer nodeContainer : nodeContainerList) {
        ((Process) process).addNodeContainer(nodeContainer);
    }
    // check that the created connections exists now, or create them if needed
    for (String newConnectionName : createdNames) {
        if (process.checkValidConnectionName(newConnectionName, true)) {
            process.addUniqueConnectionName(newConnectionName);
        }
    }
    process.checkStartNodes();
    process.checkProcess();
    // set the new node as the current selection
    if (!multipleCommand) {
        EditPart processPart = (EditPart) viewer.getRootEditPart().getChildren().get(0);
        if (processPart instanceof ProcessPart) {
            // can only be
            // ProcessPart but still
            // test
            List<EditPart> sel = new ArrayList<EditPart>();
            for (EditPart editPart : (List<EditPart>) processPart.getChildren()) {
                if (editPart instanceof SubjobContainerPart) {
                    for (EditPart subjobChildsPart : (List<EditPart>) editPart.getChildren()) {
                        if (subjobChildsPart instanceof NodeContainerPart) {
                            if (nodeContainerList.contains(((NodeContainerPart) subjobChildsPart).getModel())) {
                                NodePart nodePart = ((NodeContainerPart) subjobChildsPart).getNodePart();
                                if (nodePart != null) {
                                    sel.add(nodePart);
                                }
                            }
                        }
                    }
                }
                if (editPart instanceof NodePart) {
                    Node currentNode = (Node) editPart.getModel();
                    if (nodeContainerList.contains(currentNode.getNodeContainer())) {
                        sel.add(editPart);
                    }
                }
            }
            StructuredSelection s = new StructuredSelection(sel);
            viewer.setSelection(s);
        }
    }
}
Also used : GraphicalViewer(org.eclipse.gef.GraphicalViewer) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) EditPart(org.eclipse.gef.EditPart) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) List(java.util.List) ArrayList(java.util.ArrayList) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 10 with SubjobContainerPart

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

the class NodesPasteCommand method execute.

@SuppressWarnings("unchecked")
@Override
public void execute() {
    // create the node container list to paste
    createNodeContainerList();
    AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
    // save old selection
    if (!multipleCommand) {
        oldSelection = new ArrayList<EditPart>();
        for (EditPart editPart : (List<EditPart>) viewer.getSelectedEditParts()) {
            oldSelection.add(editPart);
        }
        // remove the old selection
        viewer.deselectAll();
    }
    // creates the different nodes
    for (NodeContainer nodeContainer : nodeContainerList) {
        ((Process) process).addNodeContainer(nodeContainer);
    }
    // check that the created connections exists now, or create them if needed
    for (String newConnectionName : createdNames) {
        if (process.checkValidConnectionName(newConnectionName, true)) {
            process.addUniqueConnectionName(newConnectionName);
        }
    }
    process.checkStartNodes();
    process.checkProcess();
    // set the new node as the current selection
    if (!multipleCommand) {
        EditPart processPart = (EditPart) viewer.getRootEditPart().getChildren().get(0);
        if (processPart instanceof ProcessPart) {
            // can only be
            // ProcessPart but still
            // test
            List<EditPart> sel = new ArrayList<EditPart>();
            for (EditPart editPart : (List<EditPart>) processPart.getChildren()) {
                if (editPart instanceof SubjobContainerPart) {
                    for (EditPart subjobChildsPart : (List<EditPart>) editPart.getChildren()) {
                        if (subjobChildsPart instanceof NodeContainerPart) {
                            if (nodeContainerList.contains(((NodeContainerPart) subjobChildsPart).getModel())) {
                                NodePart nodePart = ((NodeContainerPart) subjobChildsPart).getNodePart();
                                if (jobletNodeToExpand.contains(((Node) nodePart.getModel()).getNodeContainer())) {
                                    PropertyChangeCommand ppc = new PropertyChangeCommand(((Node) nodePart.getModel()).getNodeContainer(), EParameterName.COLLAPSED.getName(), false);
                                    ppc.execute();
                                    for (EditPart jobletChildren : (List<EditPart>) subjobChildsPart.getChildren()) {
                                        if (jobletChildren instanceof NodePart) {
                                            sel.add(jobletChildren);
                                        }
                                    }
                                } else if (nodePart != null) {
                                    sel.add(nodePart);
                                }
                            }
                        }
                    }
                }
                if (editPart instanceof NodePart) {
                    Node currentNode = (Node) editPart.getModel();
                    if (nodeContainerList.contains(currentNode.getNodeContainer())) {
                        sel.add(editPart);
                    }
                }
            }
            if (!isJunitCreate() && !isJobletRefactor()) {
                StructuredSelection s = new StructuredSelection(sel);
                viewer.setSelection(s);
            }
        }
    }
}
Also used : GraphicalViewer(org.eclipse.gef.GraphicalViewer) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) EditPart(org.eclipse.gef.EditPart) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) List(java.util.List) ArrayList(java.util.ArrayList) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Aggregations

SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)34 List (java.util.List)23 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)23 Node (org.talend.designer.core.ui.editor.nodes.Node)19 ArrayList (java.util.ArrayList)18 EditPart (org.eclipse.gef.EditPart)18 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)15 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)14 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)13 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)12 SubjobContainer (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer)10 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)8 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)7 NodeLabelEditPart (org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart)7 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)6 IExternalNode (org.talend.core.model.process.IExternalNode)6 INode (org.talend.core.model.process.INode)6 JobletContainerPart (org.talend.designer.core.ui.editor.jobletcontainer.JobletContainerPart)6 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5