use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.
the class InsertNewColumnCommand method createLookupConnection.
private void createLookupConnection(TreeNode sourceNode, TreeNode targetNode) {
LookupConnection conn = XmlmapFactory.eINSTANCE.createLookupConnection();
conn.setSource(sourceNode);
conn.setTarget(targetNode);
targetNode.getLookupIncomingConnections().add(conn);
sourceNode.getLookupOutgoingConnections().add(conn);
if (xmlMapData != null) {
xmlMapData.getConnections().add(conn);
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.
the class XmlMapConnectionBuilder method createLookupConnection.
public void createLookupConnection(TreeNode sourceNode, TreeNode targetNode, XmlMapData mapData) {
LookupConnection conn = XmlmapFactory.eINSTANCE.createLookupConnection();
conn.setSource(sourceNode);
conn.setTarget(targetNode);
targetNode.getLookupIncomingConnections().add(conn);
sourceNode.getLookupOutgoingConnections().add(conn);
mapData.getConnections().add(conn);
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.
the class XmlMapUtil method detachLookupSource.
public static void detachLookupSource(TreeNode treeNode, XmlMapData mapData, boolean detachChildren) {
for (LookupConnection connection : treeNode.getLookupIncomingConnections()) {
TreeNode source = (TreeNode) connection.getSource();
if (source.getLookupOutgoingConnections().contains(connection)) {
source.getLookupOutgoingConnections().remove(connection);
mapData.getConnections().remove(connection);
}
}
treeNode.getLookupIncomingConnections().clear();
if (detachChildren) {
if (!treeNode.getChildren().isEmpty()) {
for (TreeNode child : treeNode.getChildren()) {
detachLookupSource(child, mapData, detachChildren);
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.
the class XmlMapUtil method detachLookupTarget.
public static void detachLookupTarget(TreeNode treeNode, XmlMapData mapData, boolean detachChildren) {
for (LookupConnection connection : treeNode.getLookupOutgoingConnections()) {
if (connection.getTarget() instanceof TreeNode) {
TreeNode target = (TreeNode) connection.getTarget();
if (target.getLookupIncomingConnections().contains(connection)) {
target.getLookupIncomingConnections().remove(connection);
mapData.getConnections().remove(connection);
}
}
}
treeNode.getLookupOutgoingConnections().clear();
if (detachChildren) {
if (!treeNode.getChildren().isEmpty()) {
for (TreeNode child : treeNode.getChildren()) {
detachLookupTarget(child, mapData, detachChildren);
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection in project tdi-studio-se by Talend.
the class XmlMapLookupConnectionPart method calculateConnOffset.
protected int calculateConnOffset() {
LookupConnection model = (LookupConnection) getModel();
if (model.getSource() == null) {
return 0;
}
TreeNode sourceTreeNode = (TreeNode) model.getSource();
List<IConnection> outConns = new ArrayList<IConnection>();
TreeNode inputTreeNodeRoot = XmlMapUtil.getTreeNodeRoot(sourceTreeNode);
if (inputTreeNodeRoot != null) {
InputXmlTree inputTree = (InputXmlTree) inputTreeNodeRoot.eContainer();
outConns.addAll(XmlMapUtil.getAllNodeLookConnections(inputTree));
}
int indexOf = outConns.indexOf(model);
if (indexOf != -1) {
return -(indexOf + 1) * XmlMapUtil.DEFAULT_OFFSET;
}
return 0;
}
Aggregations