Search in sources :

Example 1 with NodeLabel

use of org.talend.designer.core.ui.editor.nodes.NodeLabel 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;
}
Also used : NodeLabel(org.talend.designer.core.ui.editor.nodes.NodeLabel) NodeTreeEditPart(org.talend.designer.core.ui.editor.outline.NodeTreeEditPart) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) ArrayList(java.util.ArrayList) List(java.util.List) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PlatformObject(org.eclipse.core.runtime.PlatformObject) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 2 with NodeLabel

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

the class PartFactory method createEditPart.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)
     */
@Override
public EditPart createEditPart(EditPart context, Object model) {
    EditPart part = null;
    if (model instanceof SubjobContainer) {
        part = new SubjobContainerPart();
    } else if (model instanceof Process) {
        part = new ProcessPart();
    } else if (model instanceof Node) {
        part = new NodePart();
    } else if (model instanceof Connection) {
        part = new ConnectionPart();
    } else if (model instanceof ConnectionLabel) {
        part = new ConnLabelEditPart();
    } else if (model instanceof MonitorConnectionLabel) {
        part = new MonitorConnectionLabelPart();
    } else if (model instanceof ConnectionPerformance) {
        part = new ConnectionPerformanceEditPart();
    } else if (model instanceof ConnectionTrace) {
        part = new ConnectionTraceEditPart();
    } else if (model instanceof ConnectionResuming) {
        part = new ConnectionResumingEditPart();
    } else if (model instanceof NodeLabel) {
        part = new NodeLabelEditPart();
    } else if (model instanceof NodeContainer) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
            ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault().getService(ITestContainerGEFService.class);
            if (testContainerService != null) {
                part = testContainerService.createEditorPart(model);
                if (part != null) {
                    part.setModel(model);
                    return part;
                }
            }
        }
        if (((NodeContainer) model).getNode().isSparkJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
                ISparkJobletProviderService sparkService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isSparkStreamingJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
                ISparkStreamingJobletProviderService sparkService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isStandardJoblet()) {
            part = new JobletContainerPart();
        } else if (((NodeContainer) model).getNode().isMapReduce()) {
            part = new JobletContainerPart();
        } else {
            part = new NodeContainerPart();
        }
    } else if (model instanceof Note) {
        part = new NoteEditPart();
    } else if (model instanceof NodeError) {
        part = new NodeErrorEditPart();
    } else if (model instanceof NodeProgressBar) {
        part = new NodeProgressBarPart();
    } else {
        return null;
    }
    // tell the newly created part about the model object
    part.setModel(model);
    return part;
}
Also used : NodeError(org.talend.designer.core.ui.editor.nodes.NodeError) NodeProgressBar(org.talend.designer.core.ui.editor.nodes.NodeProgressBar) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeProgressBarPart(org.talend.designer.core.ui.editor.nodes.NodeProgressBarPart) Node(org.talend.designer.core.ui.editor.nodes.Node) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) ConnectionResuming(org.talend.designer.core.ui.editor.connections.ConnectionResuming) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeLabel(org.talend.designer.core.ui.editor.nodes.NodeLabel) SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) ITestContainerGEFService(org.talend.designer.core.ITestContainerGEFService) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) EditPart(org.eclipse.gef.EditPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart) Connection(org.talend.designer.core.ui.editor.connections.Connection) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) JobletContainerPart(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainerPart) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ConnectionPerformance(org.talend.designer.core.ui.editor.connections.ConnectionPerformance) ConnectionTrace(org.talend.designer.core.ui.editor.connections.ConnectionTrace) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService) Note(org.talend.designer.core.ui.editor.notes.Note) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) MonitorConnectionLabelPart(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabelPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)

Example 3 with NodeLabel

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

NodeLabel (org.talend.designer.core.ui.editor.nodes.NodeLabel)3 EditPart (org.eclipse.gef.EditPart)2 INode (org.talend.core.model.process.INode)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 ConnectionLabel (org.talend.designer.core.ui.editor.connections.ConnectionLabel)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 NodeTreeEditPart (org.talend.designer.core.ui.editor.outline.NodeTreeEditPart)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PlatformObject (org.eclipse.core.runtime.PlatformObject)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Element (org.talend.core.model.process.Element)1 IConnection (org.talend.core.model.process.IConnection)1 IProcess2 (org.talend.core.model.process.IProcess2)1 ISparkJobletProviderService (org.talend.core.ui.ISparkJobletProviderService)1 ISparkStreamingJobletProviderService (org.talend.core.ui.ISparkStreamingJobletProviderService)1 ITestContainerGEFService (org.talend.designer.core.ITestContainerGEFService)1