Search in sources :

Example 1 with NodeReturnsTreeEditPart

use of org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart 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);
}
Also used : NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) Node(org.talend.designer.core.ui.editor.nodes.Node) NodeReturnsTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)

Example 2 with NodeReturnsTreeEditPart

use of org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart 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;
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) Node(org.talend.designer.core.ui.editor.nodes.Node) Connection(org.talend.designer.core.ui.editor.connections.Connection) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) Process(org.talend.designer.core.ui.editor.process.Process) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ProcessTreeEditPart(org.talend.designer.core.ui.editor.outline.ProcessTreeEditPart) NodeReturnsTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)

Example 3 with NodeReturnsTreeEditPart

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

the class DynamicTabbedPropertySection method setInput.

// private ISelection lastSelection;
/*
     * @Override (non-Java)
     * 
     * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection# setInput(org.eclipse.ui.IWorkbenchPart,
     * org.eclipse.jface.viewers.ISelection)
     */
@Override
public void setInput(final IWorkbenchPart workbenchPart, final ISelection selection) {
    if (!(selection instanceof IStructuredSelection)) {
        return;
    }
    curRowSize = 0;
    Object input = ((IStructuredSelection) selection).getFirstElement();
    if (input instanceof NodeContainerPart) {
        NodeContainerPart nContainer = (NodeContainerPart) input;
        elem = (Element) nContainer.getParent().getModel();
    } else if (input instanceof NodeTreeEditPart) {
        NodeTreeEditPart nTreePart = (NodeTreeEditPart) input;
        elem = (Element) nTreePart.getModel();
    } else if (!(input instanceof NodeReturnsTreeEditPart)) {
        EditPart editPart = (EditPart) input;
        elem = (Element) editPart.getModel();
    }
    if (elem instanceof NodeLabel) {
        elem = ((NodeLabel) elem).getNode();
    }
    if (elem instanceof ConnectionLabel) {
        elem = ((ConnectionLabel) elem).getConnection();
    }
    if (workbenchPart instanceof AbstractMultiPageTalendEditor) {
        part = (AbstractMultiPageTalendEditor) workbenchPart;
    } else {
        if (elem instanceof INode) {
            part = (AbstractMultiPageTalendEditor) ((IProcess2) ((INode) elem).getProcess()).getEditor();
        } else if (elem instanceof IConnection) {
            IConnection conn;
            conn = (IConnection) elem;
            part = (AbstractMultiPageTalendEditor) ((IProcess2) conn.getSource().getProcess()).getEditor();
        } else {
            part = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        }
    }
    super.setInput(part, selection);
    commandStackEventListener = null;
    if ((currentComponent == null) || (!currentComponent.equals(elem.getElementName()))) {
        forceRedraw = true;
        elem.setPropertyValue(updataComponentParamName, Boolean.TRUE);
    }
    currentComponent = elem.getElementName();
}
Also used : INode(org.talend.core.model.process.INode) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) Element(org.talend.core.model.process.Element) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) EditPart(org.eclipse.gef.EditPart) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) NodeReturnsTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart) IConnection(org.talend.core.model.process.IConnection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) NodeLabel(org.talend.designer.core.ui.editor.nodes.NodeLabel) IProcess2(org.talend.core.model.process.IProcess2) NodeReturnsTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 NodeReturnsTreeEditPart (org.talend.designer.core.ui.editor.outline.NodeReturnsTreeEditPart)3 NodeTreeEditPart (org.talend.designer.core.ui.editor.outline.NodeTreeEditPart)3 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)2 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)2 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)2 Node (org.talend.designer.core.ui.editor.nodes.Node)2 NodeLabelEditPart (org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart)2 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)2 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)2 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)2 EditPart (org.eclipse.gef.EditPart)1 Element (org.talend.core.model.process.Element)1 IConnection (org.talend.core.model.process.IConnection)1 INode (org.talend.core.model.process.INode)1 IProcess2 (org.talend.core.model.process.IProcess2)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)1 Connection (org.talend.designer.core.ui.editor.connections.Connection)1 ConnectionLabel (org.talend.designer.core.ui.editor.connections.ConnectionLabel)1