Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2013-10-18 11:53:51 -0400
committerMikaël Barbero2013-10-20 04:17:00 -0400
commit6ee5e109d8875ce63f456eebdbff6a2b979fed5c (patch)
tree4768d5f1478eb7ff2d35f6bebacbf3ca39b97b14 /plugins/org.eclipse.emf.compare.ide.ui/src
parenta4dce4c75f69c122d82f27a14b3c264b0af86a53 (diff)
downloadorg.eclipse.emf.compare-6ee5e109d8875ce63f456eebdbff6a2b979fed5c.tar.gz
org.eclipse.emf.compare-6ee5e109d8875ce63f456eebdbff6a2b979fed5c.tar.xz
org.eclipse.emf.compare-6ee5e109d8875ce63f456eebdbff6a2b979fed5c.zip
Improve title message : manage pseudo conflicts diffs
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java42
1 files changed, 32 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index d61d6836a..76a2c105f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
-import static com.google.common.base.Predicates.or;
+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.collect.Iterables.any;
import static com.google.common.collect.Iterables.getFirst;
import static com.google.common.collect.Iterables.size;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
@@ -70,6 +73,7 @@ import org.eclipse.emf.compare.rcp.ui.internal.configuration.ICompareEditingDoma
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IMergePreviewModeChange;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilterChange;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.PseudoConflictsFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.IDifferenceGroupProviderChange;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.StructureMergeViewerGrouper;
@@ -113,11 +117,8 @@ import org.eclipse.ui.actions.ActionFactory;
*/
public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrapper<Composite, WrappableTreeViewer> implements CommandStackListener {
- /**
- *
- */
- private static final Predicate<Diff> UNRESOLVED_OR_WITHOUT_PSEUDO_CONFLICT = or(
- hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.PSEUDO));
+ private static final Predicate<Diff> UNRESOLVED_AND_WITHOUT_PSEUDO_CONFLICT = and(
+ hasState(DifferenceState.UNRESOLVED), not(hasConflict(ConflictKind.PSEUDO)));
static final String REQUIRED_DIFF_COLOR = "RequiredDiffColor"; //$NON-NLS-1$
@@ -185,6 +186,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
private CompareToolBar toolBar;
+ private boolean pseudoConflictsFilterEnabled;
+
/**
* Constructor.
*
@@ -365,10 +368,27 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
Comparison comparison = getCompareConfiguration().getComparison();
if (comparison != null) {
List<Diff> differences = comparison.getDifferences();
- int computedDiff = differences.size();
- int filteredDiff = computedDiff - displayedDiff;
- int differencesToMerge = size(Iterables.filter(differences,
- UNRESOLVED_OR_WITHOUT_PSEUDO_CONFLICT));
+ final int computedDiff;
+ if (pseudoConflictsFilterEnabled) {
+ computedDiff = size(Iterables.filter(differences, not(hasConflict(ConflictKind.PSEUDO))));
+ } else {
+ computedDiff = differences.size();
+ }
+ int filteredDiff = differences.size() - displayedDiff;
+ if (filteredDiff < 0) {
+ // some differences (conflicts in default view) are displayed twice,
+ // use this workaround to avoid displayed negative numbers, but we have
+ // to know that we display wrong number.
+ filteredDiff = 0;
+ }
+ final int differencesToMerge;
+ if (pseudoConflictsFilterEnabled) {
+ differencesToMerge = size(Iterables.filter(differences,
+ UNRESOLVED_AND_WITHOUT_PSEUDO_CONFLICT));
+ } else {
+ differencesToMerge = size(Iterables.filter(differences,
+ hasState(DifferenceState.UNRESOLVED)));
+ }
((CompareViewerSwitchingPane)parent).setTitleArgument(differencesToMerge + " over "
+ computedDiff + " differences still to be merged — " + filteredDiff
+ " differences filtered from view");
@@ -395,6 +415,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
@Subscribe
public void handleDifferenceFilterChange(IDifferenceFilterChange event) {
+ pseudoConflictsFilterEnabled = any(event.getSelectedDifferenceFilters(),
+ instanceOf(PseudoConflictsFilter.class));
SWTUtil.safeRefresh(this, false);
}

Back to the top