use of org.talend.designer.core.ui.editor.outline.ProcessTreeEditPart 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