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;
}
}
}
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));
}
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);
}
}
}
}
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;
}
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);
}
}
}
}
Aggregations