use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class OpenJobHierarchyAction method calculateEnabled.
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
Object o = parts.get(0);
if (o instanceof NodePart) {
NodePart part = (NodePart) o;
Node node = (Node) part.getModel();
if (DesignerUtilities.isTRunJobComponent(node)) {
return true;
}
} else if (o instanceof ProcessPart) {
return true;
}
return false;
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class OpenJobHierarchyAction method caculateProcess.
/**
* retrieve the process from the NodePart or ProcessPart
*
* @param input
* @return
*/
private IProcess2 caculateProcess(Object input) {
if (input instanceof NodePart) {
NodePart part = (NodePart) input;
Node node = (Node) part.getModel();
if (DesignerUtilities.isTRunJobComponent(node)) {
return DesignerUtilities.getCorrespondingProcessFromTRunjob(node);
}
} else if (input instanceof ProcessPart) {
ProcessPart processPart = (ProcessPart) input;
return (IProcess2) processPart.getModel();
}
return null;
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method getSelectedGraphicNode.
/**
* DOC amaumont Comment method "getSelectedNode".
*
* @return
*/
public Node getSelectedGraphicNode() {
Node node = null;
List selections = designerEditor.getViewer().getSelectedEditParts();
if (selections.size() == 1) {
Object selection = selections.get(0);
if (selection instanceof NodeTreeEditPart) {
NodeTreeEditPart nTreePart = (NodeTreeEditPart) selection;
node = (Node) nTreePart.getModel();
} else {
if (selection instanceof NodePart) {
NodePart editPart = (NodePart) selection;
node = (Node) editPart.getModel();
} else if (selection instanceof NodeLabelEditPart) {
NodeLabelEditPart editPart = (NodeLabelEditPart) selection;
node = ((NodeLabel) editPart.getModel()).getNode();
}
}
}
return node;
}
use of org.talend.designer.core.ui.editor.nodes.NodePart 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.nodes.NodePart 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;
}
Aggregations