Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2012-07-17 05:34:29 -0400
committerMikaël Barbero2012-07-17 05:34:29 -0400
commite152358b094a18f20ac856725811f0ba4f521d29 (patch)
tree09c1bdc80868475feb0ba4cab1fc83fb13b4a101
parent908f15779b37803ad46479213c90c0eb161921d9 (diff)
downloadorg.eclipse.emf.compare-e152358b094a18f20ac856725811f0ba4f521d29.tar.gz
org.eclipse.emf.compare-e152358b094a18f20ac856725811f0ba4f521d29.tar.xz
org.eclipse.emf.compare-e152358b094a18f20ac856725811f0ba4f521d29.zip
hide pseudo conflicts
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java38
1 files changed, 31 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
index 4166c6127..5a5b8768f 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
@@ -22,11 +22,13 @@ import com.google.common.collect.ImmutableList;
import java.util.Collection;
import org.eclipse.emf.common.notify.AdapterFactory;
+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.Match;
+import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.provider.MatchItemProvider;
import org.eclipse.emf.ecore.EObject;
@@ -56,10 +58,28 @@ public class MatchItemProviderSpec extends MatchItemProvider {
}
};
- static final Predicate<Diff> LEFT_CONFLICTUAL_DIFF = new Predicate<Diff>() {
+ static final Predicate<Diff> CONFLICTUAL_DIFF_TO_DISPLAY = new Predicate<Diff>() {
public boolean apply(Diff input) {
- return input.getConflict() == null
- || (input.getConflict() != null && input.getSource() == DifferenceSource.LEFT);
+ Conflict conflict = input.getConflict();
+ if (conflict != null) {
+ if (conflict.getKind() == ConflictKind.PSEUDO) {
+ return false;
+ }
+ if (input.getMatch().getLeft() != null && input.getMatch().getRight() != null) {
+ return input.getSource() == DifferenceSource.LEFT;
+ }
+ }
+ return true;
+ }
+ };
+
+ static final Predicate<Diff> CONTAINMENT_REFERENCE_DIFF = new Predicate<Diff>() {
+ public boolean apply(Diff input) {
+ if (input instanceof ReferenceChange) {
+ ReferenceChange referenceChange = (ReferenceChange)input;
+ return referenceChange.getReference().isContainment();
+ }
+ return false;
}
};
@@ -73,8 +93,13 @@ public class MatchItemProviderSpec extends MatchItemProvider {
/**
*
*/
- private static final Predicate<Diff> DIFF_TO_DISPLAY = and(not(PSEUDO_DELETE_CONFLICT),
- LEFT_CONFLICTUAL_DIFF);
+ private static final Predicate<Diff> DIFF_TO_DISPLAY = and(CONFLICTUAL_DIFF_TO_DISPLAY,
+ not(CONTAINMENT_REFERENCE_DIFF));
+
+ /**
+ *
+ */
+ private static final Predicate<Match> MATCH_TO_DISPLAY = and(not(PSEUDO_MATCH), HAS_DIFFERENCE);
/**
* Constructor calling super {@link #MatchItemProvider(AdapterFactory)}.
@@ -155,8 +180,7 @@ public class MatchItemProviderSpec extends MatchItemProvider {
* @see #getChildren(Object)
*/
static Iterable<EObject> getChildrenIterable(Match object) {
- Iterable<Match> matchToDisplay = filter(object.getSubmatches(),
- and(not(PSEUDO_MATCH), HAS_DIFFERENCE));
+ Iterable<Match> matchToDisplay = filter(object.getSubmatches(), MATCH_TO_DISPLAY);
Iterable<Diff> diffToDisplay = filter(object.getDifferences(), DIFF_TO_DISPLAY);

Back to the top