Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Constant2019-04-17 12:23:30 -0400
committerOlivier Constant2019-04-17 12:23:30 -0400
commitb9dd89c5eba1d3d3faaa6db54cb5b56d0c7a176f (patch)
treeea34037e7dfb274eb0459a25ebf64d824ed3e590
parent56107efd62a99c7e7ac11d713e8b26f5612f29c4 (diff)
downloadorg.eclipse.emf.diffmerge.core-b9dd89c5eba1d3d3faaa6db54cb5b56d0c7a176f.tar.gz
org.eclipse.emf.diffmerge.core-b9dd89c5eba1d3d3faaa6db54cb5b56d0c7a176f.tar.xz
org.eclipse.emf.diffmerge.core-b9dd89c5eba1d3d3faaa6db54cb5b56d0c7a176f.zip
Bug 546527 - Differences can be ignored when merging from above the container of the concerned element
Change-Id: I2006e7ba574f09fe7fe0b1ef84e10dc4c57b46c3 Signed-off-by: Olivier Constant <olivier.constant@thalesgroup.com>
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/CategoryManager.java38
1 files changed, 31 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/CategoryManager.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/CategoryManager.java
index 5254ef7f..b25b68b7 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/CategoryManager.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/CategoryManager.java
@@ -220,8 +220,7 @@ public class CategoryManager {
IComparison comparison = match_p.getMapping().getComparison();
List<IMatch> candidates = comparison.getContentsOf(match_p);
for (IMatch candidate : candidates) {
- if (isMove(candidate, false) &&
- comparison.getContainerOf(candidate, _node.getDrivingRole().opposite()) == match_p)
+ if (isMoveOrigin(candidate))
continue; // Move origin
if (getDifferenceNumber(candidate) > 0)
result.add(candidate);
@@ -696,6 +695,34 @@ public class CategoryManager {
}
/**
+ * Return whether the given match represents a moved element on the side of the
+ * source of the move in the driving role
+ * @param match_p a non-null match
+ */
+ public boolean isMoveOrigin(IMatch match_p) {
+ IComparison comparison = match_p.getMapping().getComparison();
+ IMatch parent = comparison.getContainerOf(match_p, _node.getDrivingRole());
+ return isMoveOrigin(parent, match_p);
+ }
+
+ /**
+ * Return whether the given (parent, child) couple represents a moved element on the side of
+ * the source of the move, where source corresponds to the opposite of the driving role
+ * @param parent_p a potentially null match
+ * @param child_p a non-null match
+ */
+ public boolean isMoveOrigin(IMatch parent_p, IMatch child_p) {
+ boolean result = false;
+ if (isMove(child_p, false)) {
+ IComparison comparison = child_p.getMapping().getComparison();
+ Role drivingRole = _node.getDrivingRole();
+ result = comparison.getContainerOf(child_p, drivingRole.opposite()) == parent_p &&
+ comparison.getContainerOf(child_p, drivingRole) != parent_p;
+ }
+ return result;
+ }
+
+ /**
* Return whether the given path represents a moved element on the side of
* the source of the move, where source corresponds to the opposite of the driving role
* @param path_p a non-null path
@@ -703,14 +730,11 @@ public class CategoryManager {
public boolean isMoveOrigin(TreePath path_p) {
boolean result = false;
IMatch end = (IMatch)path_p.getLastSegment();
- if (end != null && isMove(end, false)) {
+ if (end != null) {
TreePath parentPath = path_p.getParentPath();
IMatch father =
parentPath == null? null: (IMatch)parentPath.getLastSegment();
- IComparison comparison = end.getMapping().getComparison();
- Role drivingRole = _node.getDrivingRole();
- result = comparison.getContainerOf(end, drivingRole.opposite()) == father &&
- comparison.getContainerOf(end, drivingRole) != father;
+ result = isMoveOrigin(father, end);
}
return result;
}

Back to the top