diff options
author | Stefan Dirix | 2017-01-20 17:11:42 +0000 |
---|---|---|
committer | Philip Langer | 2017-01-25 18:03:58 +0000 |
commit | 74c6876c74f463dc8ebe8c27d7d5101d7412c6f2 (patch) | |
tree | 4e7b56f159b53dcaecf6a6e3ff2ef055384ced23 | |
parent | df499162002802e32144dc401e8ae7de00d31dbf (diff) | |
download | org.eclipse.emf.compare-74c6876c74f463dc8ebe8c27d7d5101d7412c6f2.tar.gz org.eclipse.emf.compare-74c6876c74f463dc8ebe8c27d7d5101d7412c6f2.tar.xz org.eclipse.emf.compare-74c6876c74f463dc8ebe8c27d7d5101d7412c6f2.zip |
Avoid redundant insertion points
The isVisibleInMergeViewer method now really only checks if a diff is
visible.
Previously the method also checked if the given diff was the
prime-refining diff of another diff and then also returned true. With
the latest StructureMergeViewer and ContentMergeViewer refactorings this
is no longer necessary and leads to duplicated insertion points within
the TreeContentMergeViewers.
Signed-off-by: Stefan Dirix <sdirix@eclipsesource.com>
Change-Id: I3ecd25abfa7a21b7e8c1e1ee986e36246175dc6e
-rw-r--r-- | plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/MergeViewerUtil.java | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/MergeViewerUtil.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/MergeViewerUtil.java index c3aec930b..9da9bf432 100644 --- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/MergeViewerUtil.java +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/MergeViewerUtil.java @@ -11,9 +11,6 @@ package org.eclipse.emf.compare.rcp.ui.internal.util; import static com.google.common.collect.Iterables.any; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.transform; import com.google.common.base.Predicate; @@ -38,7 +35,6 @@ import org.eclipse.emf.compare.internal.merge.MergeOperation; import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration; import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide; import org.eclipse.emf.compare.rcp.ui.mergeviewer.item.IMergeViewerItem; -import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup; import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider; import org.eclipse.emf.compare.utils.IEqualityHelper; import org.eclipse.emf.compare.utils.ReferenceUtil; @@ -393,40 +389,24 @@ public final class MergeViewerUtil { /** * Returns true if the given diff is displayed in an group as provided by the {@code groupProvider} and - * not filtered by the given {@code filters}. + * not filtered by the given filter {@code predicate}. * * @param diff + * the {@link Diff} to check. * @param groupProvider - * @param selectedFilters - * @return + * the {@link IDifferenceGroupProvider}. + * @param predicate + * the filter {@link Predicate}. + * @return {@code true} if the given {@code diff} is visible in the given {@code groupProvider}, + * {@code false} otherwise. */ public static boolean isVisibleInMergeViewer(Diff diff, IDifferenceGroupProvider groupProvider, Predicate<? super EObject> predicate) { Iterable<TreeNode> nodes = groupProvider.getTreeNodes(diff); - - boolean isDisplayedInSMV = any(nodes, predicate); - boolean isPrimeRefining = !isEmpty( - filter(transform(nodes, IDifferenceGroup.TREE_NODE_DATA), IS_PRIME_REFINING)); - return (isDisplayedInSMV || isPrimeRefining); + return any(nodes, predicate); } /** - * Check if the given object is a Diff that is a prime refining of one of its refine diffs. - */ - private static final Predicate<EObject> IS_PRIME_REFINING = new Predicate<EObject>() { - public boolean apply(EObject eObject) { - if (eObject instanceof Diff) { - for (Diff refine : ((Diff)eObject).getRefines()) { - if (refine.getPrimeRefining() == eObject) { - return true; - } - } - } - return false; - } - }; - - /** * Checks if the given diff is considered as a mark as merged diff. * * @see MergeOperation |