diff options
author | Ed Willink | 2017-02-26 15:35:01 +0000 |
---|---|---|
committer | Ed Willink | 2017-03-11 10:47:14 +0000 |
commit | da121481815276ec528c5ffb2182b1ba220e1487 (patch) | |
tree | 5a3430dae154c8bbd7168806e1518c1e46f26aa7 | |
parent | 5916d33cf6f200efea11e4e50a2886d25ac3169f (diff) | |
download | org.eclipse.qvtd-da121481815276ec528c5ffb2182b1ba220e1487.tar.gz org.eclipse.qvtd-da121481815276ec528c5ffb2182b1ba220e1487.tar.xz org.eclipse.qvtd-da121481815276ec528c5ffb2182b1ba220e1487.zip |
[512737] Provide opposite navigation for an includes edge
-rw-r--r-- | plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java index 2a858d510..e92da7564 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java @@ -70,6 +70,7 @@ import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreHelper; import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreUtil; import org.eclipse.qvtd.pivot.qvtschedule.Edge; import org.eclipse.qvtd.pivot.qvtschedule.NavigableEdge; +import org.eclipse.qvtd.pivot.qvtschedule.NavigationEdge; import org.eclipse.qvtd.pivot.qvtschedule.Node; import org.eclipse.qvtd.pivot.qvtschedule.OperationRegion; import org.eclipse.qvtd.pivot.qvtschedule.utilities.QVTscheduleConstants; @@ -127,6 +128,18 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl Node targetNode = analyze(operationCallExp.getOwnedArguments().get(0)); String name = operationCallExp.getReferredOperation().getName(); createPredicateEdge(sourceNode, "«" + name + "»", targetNode); + if (sourceNode.isDataType()) { // expecting a CollectionType + for (@NonNull Edge edge : RegionUtil.getIncomingEdges(sourceNode)) { + if (edge instanceof NavigationEdge) { + NavigationEdge navigationEdge = (NavigationEdge)edge; + Property property = navigationEdge.getProperty(); + Property oppositeProperty = property.getOpposite(); + if ((oppositeProperty != null) && !oppositeProperty.isIsMany()) { + createNavigationEdge(targetNode, oppositeProperty, RegionUtil.getSourceNode(navigationEdge), false); + } + } + } + } return null; } |