Search in sources :

Example 31 with XmlMapData

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

the class XMLMapperHelper method hasAllInOne.

private static boolean hasAllInOne(final INode xmlMapperNode) {
    boolean hasAllInOne = false;
    List<? extends IConnection> outConnections = (List<? extends IConnection>) xmlMapperNode.getOutgoingConnections();
    XmlMapData xmlMapData = (XmlMapData) ElementParameterParser.getObjectValueXMLTree(xmlMapperNode);
    if (xmlMapData != null && outConnections != null && outConnections.size() > 0) {
        List<OutputXmlTree> outputTables = xmlMapData.getOutputTrees();
        HashMap<String, IConnection> hNameToConnection = new HashMap<String, IConnection>();
        for (IConnection connection : outConnections) {
            hNameToConnection.put(connection.getName(), connection);
        }
        for (OutputXmlTree outputTable : outputTables) {
            String tableName = outputTable.getName();
            IConnection connection = hNameToConnection.get(tableName);
            if (connection == null) {
                continue;
            }
            if (outputTable.isAllInOne()) {
                hasAllInOne = true;
                break;
            }
        }
    }
    return hasAllInOne;
}
Also used : HashMap(java.util.HashMap) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) List(java.util.List) IConnection(org.talend.core.model.process.IConnection) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 32 with XmlMapData

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

the class ProblemsAnalyser method checkProblems.

public void checkProblems(AbstractInOutTree abstractTree) {
    // clear problems for the tree before recheck it
    if (treeAndProblems.get(abstractTree) != null) {
        treeAndProblems.get(abstractTree).clear();
    }
    // check problems for InputLoopTable in output
    final XmlMapData copyOfMapData = mapperManager.getExternalData();
    // check problems for InputLoopTable in output
    InputXmlTree mainInputTree = mapperManager.getMainInputTree();
    if (abstractTree instanceof OutputXmlTree) {
        checkInputLoopTablesProblem((OutputXmlTree) abstractTree, mainInputTree);
    }
    isMultipleDocType = false;
    List<? extends TreeNode> nodes = null;
    if (abstractTree instanceof InputXmlTree) {
        nodes = ((InputXmlTree) abstractTree).getNodes();
    } else if (abstractTree instanceof OutputXmlTree) {
        nodes = ((OutputXmlTree) abstractTree).getNodes();
    }
    if (nodes != null) {
        checkTreeNodesProblem(abstractTree, nodes);
    }
    if (treeAndProblems.get(abstractTree) == null || treeAndProblems.get(abstractTree).isEmpty()) {
        treeAndProblems.remove(abstractTree);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 33 with XmlMapData

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

the class XmlMapFiguresManager method getInputTables.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.manager.FiguresManager#getInputTables()
     */
@Override
protected List<MapperTable> getInputTables() {
    List<MapperTable> inputTables = new ArrayList<MapperTable>();
    XmlMapData mapData = (XmlMapData) getRootEditPart().getModel();
    inputTables.addAll(mapData.getInputTrees());
    return inputTables;
}
Also used : MapperTable(org.talend.designer.gefabstractmap.model.abstractmap.MapperTable) ArrayList(java.util.ArrayList) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 34 with XmlMapData

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

the class VarToolBarFigure method removeVar.

@Override
protected void removeVar() {
    CommandStack commandStack = getTableManager().getGraphicalViewer().getEditDomain().getCommandStack();
    commandStack.execute(new Command() {

        @Override
        public void execute() {
            List selectedEditParts = getTableManager().getGraphicalViewer().getSelectedEditParts();
            final List<VarNode> toRemove = new ArrayList<VarNode>();
            int minIndex = parentTable.getNodes().size() - 1;
            for (Object obj : selectedEditParts) {
                if (obj instanceof VarNodeEditPart) {
                    VarNode model = (VarNode) ((VarNodeEditPart) obj).getModel();
                    toRemove.add(model);
                    XmlMapUtil.detachNodeConnections(model, (XmlMapData) parentTable.eContainer(), true);
                    int index = parentTable.getNodes().indexOf(model);
                    if (index < minIndex) {
                        minIndex = index;
                    }
                }
            }
            parentTable.getNodes().removeAll(toRemove);
            if (!tablePart.getChildren().isEmpty()) {
                if (minIndex > tablePart.getChildren().size() - 1) {
                    minIndex = tablePart.getChildren().size() - 1;
                }
                tablePart.getViewer().select((EditPart) tablePart.getChildren().get(minIndex));
            } else {
                remove.setEnabled(false);
            }
        }
    });
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) CommandStack(org.eclipse.gef.commands.CommandStack) VarNodeEditPart(org.talend.designer.xmlmap.parts.VarNodeEditPart) Command(org.eclipse.gef.commands.Command) VarNodeEditPart(org.talend.designer.xmlmap.parts.VarNodeEditPart) EditPart(org.eclipse.gef.EditPart) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) List(java.util.List) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 35 with XmlMapData

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

the class XmlMapFiguresManager method getOutputTables.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.manager.FiguresManager#getOutputTables()
     */
@Override
protected List<MapperTable> getOutputTables() {
    List<MapperTable> outputTables = new ArrayList<MapperTable>();
    XmlMapData mapData = (XmlMapData) getRootEditPart().getModel();
    outputTables.addAll(mapData.getOutputTrees());
    return outputTables;
}
Also used : MapperTable(org.talend.designer.gefabstractmap.model.abstractmap.MapperTable) ArrayList(java.util.ArrayList) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Aggregations

XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)36 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)18 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)17 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)15 ArrayList (java.util.ArrayList)14 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)14 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)8 List (java.util.List)7 EList (org.eclipse.emf.common.util.EList)6 HashMap (java.util.HashMap)5 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)5 IConnection (org.talend.core.model.process.IConnection)4 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)4 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)3 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)3 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)2 CCombo (org.eclipse.swt.custom.CCombo)2 Test (org.junit.Test)2 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)2 MapperTable (org.talend.designer.gefabstractmap.model.abstractmap.MapperTable)2