Search in sources :

Example 21 with AbstractInOutTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.

the class OutputTreeNodeEditPart method notifyChanged.

@Override
public void notifyChanged(Notification notification) {
    super.notifyChanged(notification);
    int type = notification.getEventType();
    int featureId = notification.getFeatureID(XmlmapPackage.class);
    switch(type) {
        case Notification.SET:
            switch(featureId) {
                case XmlmapPackage.TREE_NODE__TYPE:
                    if (XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) || !XmlMapUtil.DOCUMENT.equals(notification.getOldValue()) && XmlMapUtil.DOCUMENT.equals(notification.getNewValue())) {
                        MapperTablePart mapperTablePart = MapperUtils.getMapperTablePart(this);
                        if (mapperTablePart.getFigure() instanceof OutputXmlTreeFigure) {
                            ((OutputXmlTreeFigure) mapperTablePart.getFigure()).update(XmlmapPackage.TREE_NODE__TYPE);
                        }
                    }
                    break;
                case XmlmapPackage.TREE_NODE__LOOP:
                    ((XmlmapTreeNodeFigure) getFigure()).getBranchContent().updateLoopButtonFigure();
                    AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree((OutputTreeNode) getModel());
                    if (abstractInOutTree != null) {
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getProblemsAnalyser().checkProblems(abstractInOutTree);
                        ((XmlMapGraphicViewer) getViewer()).getMapperManager().getMapperUI().updateStatusBar();
                    }
            }
            break;
        case Notification.REMOVE:
        case Notification.REMOVE_MANY:
            switch(featureId) {
            }
        // }
        case Notification.ADD:
        case Notification.ADD_MANY:
            switch(featureId) {
                case XmlmapPackage.INPUT_LOOP_NODES_TABLE__INPUTLOOPNODES:
                case XmlmapPackage.OUTPUT_TREE_NODE__INPUT_LOOP_NODES_TABLE:
                    XmlmapTreeNodeFigure outputFigure = (XmlmapTreeNodeFigure) getFigure();
                    if (outputFigure.getElement() != null) {
                        outputFigure.getBranchContent().updateLoopButtonFigure();
                    }
                    break;
                default:
                    break;
            }
    }
}
Also used : AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) MapperTablePart(org.talend.designer.gefabstractmap.part.MapperTablePart) OutputXmlTreeFigure(org.talend.designer.xmlmap.figures.OutputXmlTreeFigure) XmlMapGraphicViewer(org.talend.designer.xmlmap.editor.XmlMapGraphicViewer)

Example 22 with AbstractInOutTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.

the class FilterConnectionImpl method setTarget.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * @generated
     */
@Override
public void setTarget(AbstractInOutTree newTarget) {
    AbstractInOutTree oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, XmlmapPackage.FILTER_CONNECTION__TARGET, oldTarget, target));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)

Example 23 with AbstractInOutTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.

the class XmlMapUtil method detachFilterTarget.

public static void detachFilterTarget(AbstractNode abstractNode, XmlMapData mapData, boolean detachChildren) {
    for (FilterConnection connection : abstractNode.getFilterOutGoingConnections()) {
        AbstractInOutTree target = connection.getTarget();
        if (target.getFilterIncomingConnections().contains(connection)) {
            target.getFilterIncomingConnections().remove(connection);
            mapData.getConnections().remove(connection);
        }
    }
    abstractNode.getFilterOutGoingConnections().clear();
    if (detachChildren && abstractNode instanceof TreeNode) {
        TreeNode treeNode = (TreeNode) abstractNode;
        if (!treeNode.getChildren().isEmpty()) {
            for (TreeNode child : treeNode.getChildren()) {
                detachFilterTarget(child, mapData, detachChildren);
            }
        }
    }
}
Also used : FilterConnection(org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)

Example 24 with AbstractInOutTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.

the class ProblemsAnalyser method checkNodeInputLookTableProblem.

private boolean checkNodeInputLookTableProblem(OutputTreeNode outputNode, InputXmlTree mainInputTree, boolean checkChildren) {
    for (Connection connection : outputNode.getIncomingConnections()) {
        if (connection.getSource() instanceof TreeNode) {
            TreeNode source = (TreeNode) connection.getSource();
            InputXmlTree abstractInOutTree = (InputXmlTree) XmlMapUtil.getAbstractInOutTree(source);
            if (abstractInOutTree == mainInputTree) {
                return true;
            } else {
                EList<LookupConnection> lookupIncomingConnections = source.getLookupIncomingConnections();
                for (LookupConnection lookupConn : lookupIncomingConnections) {
                    TreeNode sourceNode = (TreeNode) lookupConn.getSource();
                    AbstractInOutTree abstractInOutTree2 = XmlMapUtil.getAbstractInOutTree(sourceNode);
                    if (abstractInOutTree2 == mainInputTree) {
                        return true;
                    }
                }
            }
            if (checkChildren && !outputNode.getChildren().isEmpty()) {
                for (TreeNode child : outputNode.getChildren()) {
                    if (checkNodeInputLookTableProblem((OutputTreeNode) child, mainInputTree, checkChildren)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) Connection(org.talend.designer.xmlmap.model.emf.xmlmap.Connection) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) LookupConnection(org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)

Example 25 with AbstractInOutTree

use of org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree in project tdi-studio-se by Talend.

the class XmlMapUtil method updateTargetExpression.

public static void updateTargetExpression(AbstractNode renamedNode, String oldExpression, String newExpression, XmlMapExpressionManager expressionManager) {
    TableEntryLocation previousLocation = expressionManager.parseTableEntryLocation(oldExpression).get(0);
    TableEntryLocation newLocation = expressionManager.parseTableEntryLocation(newExpression).get(0);
    List<INodeConnection> connections = new ArrayList<INodeConnection>();
    connections.addAll(renamedNode.getOutgoingConnections());
    if (renamedNode instanceof TreeNode) {
        connections.addAll(((TreeNode) renamedNode).getLookupOutgoingConnections());
    }
    for (INodeConnection connection : connections) {
        AbstractNode target = connection.getTarget();
        List<TableEntryLocation> targetLocaitons = expressionManager.parseTableEntryLocation(target.getExpression());
        for (TableEntryLocation current : targetLocaitons) {
            if (current.equals(previousLocation)) {
                String replaced = expressionManager.replaceExpression(target.getExpression(), current, newLocation);
                target.setExpression(replaced);
            }
        }
    }
    for (FilterConnection connection : renamedNode.getFilterOutGoingConnections()) {
        AbstractInOutTree target = connection.getTarget();
        List<TableEntryLocation> targetLocaitons = expressionManager.parseTableEntryLocation(target.getExpressionFilter());
        for (TableEntryLocation current : targetLocaitons) {
            if (current.equals(previousLocation)) {
                String replaced = expressionManager.replaceExpression(target.getExpressionFilter(), current, newLocation);
                target.setExpressionFilter(replaced);
            }
        }
    }
}
Also used : INodeConnection(org.talend.designer.xmlmap.model.emf.xmlmap.INodeConnection) FilterConnection(org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection) AbstractNode(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) TableEntryLocation(org.talend.designer.xmlmap.ui.expressionutil.TableEntryLocation) ArrayList(java.util.ArrayList) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)

Aggregations

AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)32 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)25 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)23 ArrayList (java.util.ArrayList)15 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)13 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)12 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)8 List (java.util.List)6 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)6 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)6 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)5 InputLoopNodesTable (org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable)4 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)4 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)4 TransferedObject (org.talend.designer.gefabstractmap.dnd.TransferedObject)3 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)3 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)3 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)3 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)3 Iterator (java.util.Iterator)2