Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Cartaud2016-10-28 15:55:34 +0000
committerLaurent Delaigue2016-11-02 13:28:29 +0000
commit8d6429cbd16b2c49f0579c53af567b600cbf1322 (patch)
treefa2ef6f81a42ac3109556553a997d46e62e573a9
parent72972f4bb54dd7650da6f73aab42da39cda316f3 (diff)
downloadorg.eclipse.emf.compare-3.3.tar.gz
org.eclipse.emf.compare-3.3.tar.xz
org.eclipse.emf.compare-3.3.zip
[506723] Fix merge dependencies for cascading diffs3.3.03.3
Bug: 506723 Change-Id: Ibd5a0eea9dcbc797117303c56e9f0dd5ac5d9e87 Signed-off-by: Mathieu Cartaud <mathieu.cartaud@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ComparisonUtil.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ComparisonUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ComparisonUtil.java
index 5e6a8539f..e53e34f46 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ComparisonUtil.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ComparisonUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2015 Obeo and others.
+ * Copyright (c) 2012, 2016 Obeo and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,13 +11,18 @@
*******************************************************************************/
package org.eclipse.emf.compare.internal.utils;
-import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.not;
+import static com.google.common.base.Predicates.or;
import static com.google.common.collect.Iterables.addAll;
import static com.google.common.collect.Iterables.concat;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.getFirst;
+import static org.eclipse.emf.compare.ConflictKind.REAL;
+import static org.eclipse.emf.compare.DifferenceKind.ADD;
+import static org.eclipse.emf.compare.DifferenceKind.CHANGE;
+import static org.eclipse.emf.compare.DifferenceKind.DELETE;
+import static org.eclipse.emf.compare.DifferenceKind.MOVE;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
@@ -36,9 +41,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
-import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.Equivalence;
import org.eclipse.emf.compare.FeatureMapChange;
@@ -65,8 +68,9 @@ public final class ComparisonUtil {
/**
* Predicate to know if the given diff respects the requirements of a cascading diff.
*/
- private static final Predicate<Diff> CASCADING_DIFF = and(not(hasConflict(ConflictKind.REAL)),
- not(instanceOf(ResourceAttachmentChange.class)));
+ @SuppressWarnings("unchecked")
+ private static final Predicate<Diff> CASCADING_DIFF = not(
+ or(hasConflict(REAL), instanceOf(ResourceAttachmentChange.class), ofKind(MOVE)));
/** Hides default constructor. */
private ComparisonUtil() {
@@ -130,9 +134,9 @@ public final class ComparisonUtil {
*/
public static boolean isAddOrSetDiff(Diff difference) {
boolean result = false;
- if (difference.getKind() == DifferenceKind.ADD) {
+ if (difference.getKind() == ADD) {
result = true;
- } else if (difference.getKind() == DifferenceKind.CHANGE) {
+ } else if (difference.getKind() == CHANGE) {
final EStructuralFeature feature;
if (difference instanceof ReferenceChange) {
feature = ((ReferenceChange)difference).getReference();
@@ -190,9 +194,9 @@ public final class ComparisonUtil {
*/
public static boolean isDeleteOrUnsetDiff(Diff difference) {
boolean result = false;
- if (difference.getKind() == DifferenceKind.DELETE) {
+ if (difference.getKind() == DELETE) {
result = true;
- } else if (difference.getKind() == DifferenceKind.CHANGE) {
+ } else if (difference.getKind() == CHANGE) {
final EStructuralFeature feature;
if (difference instanceof ReferenceChange) {
feature = ((ReferenceChange)difference).getReference();
@@ -368,7 +372,7 @@ public final class ComparisonUtil {
if (((ReferenceChange)diff).getReference().isContainment()) {
final Iterable<Diff> subDiffs;
// if the diff is a Move diff, we don't want its children.
- if (ofKind(DifferenceKind.MOVE).apply(diff)) {
+ if (ofKind(MOVE).apply(diff)) {
subDiffs = ImmutableList.of();
} else if (matchOfValue != null && !firstLevelOnly) {
subDiffs = filter(matchOfValue.getAllDifferences(), CASCADING_DIFF);

Back to the top