use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class NodeBreakpointAction method canPerformAction.
/**
* Test if the selected item is a node.
*
* @return true / false
*/
private boolean canPerformAction() {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (!brandingService.getBrandingConfiguration().isAllowDebugMode()) {
return false;
}
if (getSelectedObjects().isEmpty()) {
return false;
}
if (PluginUtil.isMediation()) {
return false;
}
List parts = getSelectedObjects();
if (parts.size() == 1) {
Object o = parts.get(0);
if (!(o instanceof NodePart)) {
return false;
}
NodePart part = (NodePart) o;
if (!(part.getModel() instanceof INode)) {
return false;
}
node = (Node) part.getModel();
if (node.getJobletNode() != null) {
return false;
}
EditPart parentPart = part.getParent();
while (!(parentPart instanceof ProcessPart)) {
parentPart = parentPart.getParent();
}
if (!(parentPart instanceof ProcessPart)) {
return false;
}
process = (IProcess) ((ProcessPart) parentPart).getModel();
if (CorePlugin.getContext().getBreakpointNodes(process).contains(node)) {
//$NON-NLS-1$
setText(Messages.getString("NodeBreakpointAction.removeBreakpoint"));
} else {
//$NON-NLS-1$
setText(Messages.getString("NodeBreakpointAction.addBreakPoint"));
}
return true;
}
return false;
}
use of org.talend.designer.core.ui.editor.process.ProcessPart 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.process.ProcessPart 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.process.ProcessPart in project tdi-studio-se by Talend.
the class GefEditorLabelProvider method getImage.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
public Image getImage(Object objects) {
Node node = null;
if (objects == null || objects.equals(StructuredSelection.EMPTY)) {
return null;
}
if (!(objects instanceof IStructuredSelection)) {
return null;
}
final boolean[] multiple = { false };
Object object = getObject(objects, multiple);
if (object == null) {
return null;
}
if ((object instanceof NodeTreeEditPart)) {
node = (Node) ((NodeTreeEditPart) object).getModel();
} else {
if (object instanceof NodeReturnsTreeEditPart) {
node = lastNode;
} else {
if (object instanceof ProcessPart) {
return ImageProvider.getImage(ECoreImage.PROCESS_ICON);
}
if (object instanceof ConnectionPart) {
return ImageProvider.getImage(EImage.RIGHT_ICON);
}
if (object instanceof NoteEditPart) {
return ImageProvider.getImage(ECoreImage.CODE_ICON);
}
if (object instanceof ConnLabelEditPart) {
return ImageProvider.getImage(EImage.RIGHT_ICON);
}
if ((object instanceof NodeLabelEditPart)) {
node = ((NodeContainer) ((NodeLabelEditPart) object).getParent().getModel()).getNode();
}
if (!(object instanceof NodePart)) {
return null;
}
if (node == null) {
node = (Node) ((NodePart) object).getModel();
}
}
}
if (lastNode != node) {
lastNode = node;
}
return CoreImageProvider.getComponentIcon(node.getComponent(), ICON_SIZE.ICON_24);
}
use of org.talend.designer.core.ui.editor.process.ProcessPart in project tdi-studio-se by Talend.
the class GefEditorLabelProvider method getText.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*/
public String getText(Object objects) {
Node node = null;
if (objects == null || objects.equals(StructuredSelection.EMPTY)) {
//$NON-NLS-1$
return "No items selected";
}
if (!(objects instanceof IStructuredSelection)) {
return null;
}
final boolean[] multiple = { false };
Object object = getObject(objects, multiple);
if (object == null) /* || ((IStructuredSelection) objects).size() > 1 */
{
//$NON-NLS-1$
return "No items selected";
} else {
if (object instanceof NodeContainerPart) {
NodeContainerPart nContainer = (NodeContainerPart) object;
Process process = (Process) nContainer.getParent().getModel();
return process.getName();
} else if (object instanceof ProcessPart) {
Process process = (Process) ((ProcessPart) object).getModel();
return process.getLabel();
} else if (object instanceof ProcessTreeEditPart) {
Process process = (Process) ((ProcessTreeEditPart) object).getModel();
return process.getName();
}
if (object instanceof ConnectionPart) {
Connection conn = (Connection) ((ConnectionPart) object).getModel();
return conn.getName();
}
if (object instanceof NoteEditPart) {
return Note.class.getSimpleName();
}
if (object instanceof ConnLabelEditPart) {
Connection conn = (Connection) ((ConnectionLabel) ((ConnLabelEditPart) object).getModel()).getConnection();
return conn.getName();
}
if (object instanceof NodeTreeEditPart) {
node = (Node) ((NodeTreeEditPart) object).getModel();
} else {
if (object instanceof NodeReturnsTreeEditPart) {
node = lastNode;
} else {
if (object instanceof NodeLabelEditPart) {
node = ((NodeContainer) ((NodeLabelEditPart) object).getParent().getModel()).getNode();
}
if (!(object instanceof NodePart)) {
return null;
}
if (node == null) {
node = (Node) ((NodePart) object).getModel();
}
}
}
if (lastNode != node) {
lastNode = node;
}
String name = node.getUniqueName();
// }
return name;
}
}
Aggregations