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));
}
}
}
}
}
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;
}
}
}
}
}
}
}
}
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;
}
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);
}
}
}
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);
}
}
}
}
Aggregations