Search in sources :

Example 11 with Element

use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.

the class ConnTextMovePolicy method getMoveCommand.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.gef.editpolicies.NonResizableEditPolicy#getMoveCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
     */
public Command getMoveCommand(ChangeBoundsRequest request) {
    if (((Connection) getHost().getParent().getModel()).isReadOnly()) {
        return null;
    }
    if (getHost().getModel() instanceof ConnectionTrace) {
        ConnectionTrace model = (ConnectionTrace) getHost().getModel();
        Point delta = request.getMoveDelta();
        ConnectionPart edge = (ConnectionPart) getHost().getParent();
        MoveConnTraceCommand command = new MoveConnTraceCommand(model, (Figure) edge.getFigure(), delta);
        return command;
    } else if (getHost().getModel() instanceof ConnectionLabel) {
        ConnectionLabel model = (ConnectionLabel) getHost().getModel();
        Point delta = request.getMoveDelta();
        ConnectionPart edge = (ConnectionPart) getHost().getParent();
        List<Element> elements = edge.getModelChildren();
        for (Element e : elements) {
            if (e instanceof ConnectionResuming) {
                MoveConnTextCommand command = new MoveConnTextCommand(model, (ConnectionResuming) e, (Figure) edge.getFigure(), delta);
                return command;
            }
        }
        MoveConnTextCommand command = new MoveConnTextCommand(model, null, (Figure) edge.getFigure(), delta);
        return command;
    }
    return null;
}
Also used : MoveConnTextCommand(org.talend.designer.core.ui.editor.cmd.MoveConnTextCommand) Element(org.talend.core.model.process.Element) List(java.util.List) Point(org.eclipse.draw2d.geometry.Point) MoveConnTraceCommand(org.talend.designer.core.ui.editor.cmd.MoveConnTraceCommand) Figure(org.eclipse.draw2d.Figure)

Example 12 with Element

use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.

the class ConnectionPart method getModelChildren.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
     */
@Override
protected List getModelChildren() {
    List<Element> elements;
    elements = new ArrayList<Element>();
    elements.add(((Connection) getModel()).getConnectionLabel());
    elements.add(((Connection) getModel()).getPerformance());
    if (((Connection) getModel()).getResuming() != null) {
        elements.add(((Connection) getModel()).getResuming());
    }
    boolean monitorSupport = true;
    if (getParent() != null && getRoot() != null) {
        EditPart contents = getRoot().getContents();
        if (contents.getModel() instanceof IProcess) {
            IProcess currentProcess = (IProcess) contents.getModel();
            if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
                monitorSupport = false;
            }
        }
    } else {
        IProcess currentProcess = ((Connection) getModel()).getSource().getProcess();
        if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
            monitorSupport = false;
        }
    }
    if (monitorSupport) {
        if (((Connection) getModel()).getConnectionTrace() != null) {
            elements.add(((Connection) getModel()).getConnectionTrace());
        }
        // Add monitor label
        if (((Connection) getModel()).isMonitorConnection()) {
            elements.add(((Connection) getModel()).getMonitorLabel());
        }
    }
    return elements;
}
Also used : Element(org.talend.core.model.process.Element) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) AbstractConnectionEditPart(org.eclipse.gef.editparts.AbstractConnectionEditPart) IConnection(org.talend.core.model.process.IConnection) IProcess(org.talend.core.model.process.IProcess)

Example 13 with Element

use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.

the class DesignerCoreService method refreshComponentView.

@Override
public void refreshComponentView() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view = page.findView(ComponentSettingsView.ID);
    if (view == null) {
        // don't do anything. before it made the view appear for nothing even in other product like DQ.
        return;
    }
    if (view != null && view instanceof ComponentSettingsView) {
        ComponentSettingsView settingView = (ComponentSettingsView) view;
        Element element = settingView.getElement();
        if (element != null) {
            settingView.cleanDisplay();
            settingView.setElement(element);
        }
    }
    List<ComponentSettingsView> otherViews = JobTemplateViewsAndProcessUtil.getInstance().getAllViews();
    if (otherViews == null || otherViews.isEmpty()) {
        return;
    }
    for (ComponentSettingsView v : otherViews) {
        if (v.getParent() != null && !v.getParent().isDisposed()) {
            Element elem = v.getElement();
            if (elem != null) {
                v.cleanDisplay();
                v.setElement(elem);
            }
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) Element(org.talend.core.model.process.Element) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView)

Example 14 with Element

use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.

the class JobletUtil method getModifyMap.

public Map<String, List<AbstractJobletContainer>> getModifyMap(List<Element> elem) {
    Map<String, List<AbstractJobletContainer>> jobletNodeMap = new HashMap<String, List<AbstractJobletContainer>>();
    for (Element element : elem) {
        if (element instanceof SubjobContainer) {
            for (NodeContainer container : ((SubjobContainer) element).getNodeContainers()) {
                if (container instanceof AbstractJobletContainer) {
                    String processID = container.getNode().getProcess().getId();
                    if (!jobletNodeMap.containsKey(processID)) {
                        List<AbstractJobletContainer> nodeList = new ArrayList<AbstractJobletContainer>();
                        nodeList.add((AbstractJobletContainer) container);
                        jobletNodeMap.put(processID, nodeList);
                    } else {
                        jobletNodeMap.get(processID).add((AbstractJobletContainer) container);
                    }
                }
            }
        }
    }
    return jobletNodeMap;
}
Also used : HashMap(java.util.HashMap) SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) ISubjobContainer(org.talend.core.model.process.ISubjobContainer) Element(org.talend.core.model.process.Element) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)

Example 15 with Element

use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.

the class ElementParameter2ParameterType method saveElementParameters.

/**
     * save the EMF Model's parameters to Element
     *
     * @param elem
     * @param pType
     */
public static void saveElementParameters(Element elem, ParametersType pType) {
    EList<ElementParameterType> listParamType = pType.getElementParameter();
    listParamType.clear();
    Element defaultElement = getDefaultElement(pType);
    List<? extends IElementParameter> paramList = elem.getElementParametersWithChildrens();
    for (IElementParameter param : paramList) {
        ElementParameterType type = getElemeterParameterType(param);
        IElementParameter defalutParam = defaultElement.getElementParameter(type.getName());
        if (defalutParam != null) {
            listParamType.add(type);
        }
    }
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) Element(org.talend.core.model.process.Element) IElementParameter(org.talend.core.model.process.IElementParameter)

Aggregations

Element (org.talend.core.model.process.Element)37 IProcess (org.talend.core.model.process.IProcess)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)11 IElementParameter (org.talend.core.model.process.IElementParameter)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 IElement (org.talend.core.model.process.IElement)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 TalendPropertyTabDescriptor (org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor)4 FakeElement (org.talend.designer.core.model.FakeElement)4 Process (org.talend.designer.core.ui.editor.process.Process)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 Control (org.eclipse.swt.widgets.Control)3 IEditorPart (org.eclipse.ui.IEditorPart)3 Test (org.junit.Test)3 IProcess2 (org.talend.core.model.process.IProcess2)3 EmptyRepositoryObject (org.talend.core.model.repository.EmptyRepositoryObject)3 Form (org.talend.daikon.properties.presentation.Form)3 ChangeValuesFromRepository (org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository)3