Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Cartaud2016-07-11 03:59:27 -0400
committerLaurent Delaigue2016-09-13 05:43:18 -0400
commitfcd978f0da71c72346636fe4a59773b42758f3c9 (patch)
tree7bd8fe7ddd520fa25637b09757d1aa260df31dff
parent763123a51d6610d979bce46993b2c6e559c15308 (diff)
downloadorg.eclipse.emf.compare-fcd978f0da71c72346636fe4a59773b42758f3c9.tar.gz
org.eclipse.emf.compare-fcd978f0da71c72346636fe4a59773b42758f3c9.tar.xz
org.eclipse.emf.compare-fcd978f0da71c72346636fe4a59773b42758f3c9.zip
Change SMV groups algorithm
All groups (default, bySide, byResource, byKind) are affected. The new algorithm focuses on displaying diffs in a better way and on avoiding as far as we can duplicates in the created groups. This change leads to filter modifications: filters no longer have a special behavior when deactivated, they are plain filters. Change-Id: I6ef96eab4e6a6bf6ffb1e2ac2f3f70b79a641f59 Also-by: Laurent Delaigue <laurent.delaigue@obeo.fr> Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr> Signed-off-by: Mathieu Cartaud <mathieu.cartaud@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/plugin.xml15
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/GMFRefinedElementsFilter.java3
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramChangeExtender.java64
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramDiffExtender.java64
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/EdgeChangeExtender.java40
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/NodeChangeExtender.java39
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusConflictsGroupProviderTests.java2
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java38
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java10
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java35
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug475586.java26
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java209
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java11
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestBug435365.java52
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestFeatureMapDifferencesFilter.java4
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java700
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestMatchTreeNodeItemProviderSpec.java43
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestReferenceChangeTreeNodeItemProviderSpec.java624
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/plugin.properties12
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml30
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/CascadingDifferencesFilter.java104
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/EmptyMatchedResourcesFilter.java54
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/FeatureMapDifferencesFilter.java54
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/IdenticalElementsFilter.java66
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/PseudoConflictsFilter.java75
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/TechnicalitiesFilter.java133
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/BasicDifferenceGroupImpl.java651
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ByResourceGroupProvider.java22
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ConflictNodeBuilder.java90
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/KindGroupProvider.java18
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ThreeWayComparisonGroupProvider.java208
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/ConflictNode.java76
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/DiffNode.java78
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchNode.java107
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchResourceNode.java98
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java10
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithUMLRefineElementFilter.nodes22
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithoutUMLRefineElementFilter.nodes141
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/DynamicProfileIntegrationDisplayTest.java6
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/StaticProfileIntegrationDisplayTest.java6
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/dynamic/expectedResult.nodes48
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/static_/expectedResult.nodes48
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/structuremergeviewer/filters/UMLRefinedElementsFilter.java3
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/MatchUtil.java24
47 files changed, 1813 insertions, 2362 deletions
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.diagram.ide.ui/META-INF/MANIFEST.MF
index 70c8c1d47..f1965d317 100644
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.diagram.ide.ui/META-INF/MANIFEST.MF
@@ -23,8 +23,7 @@ Export-Package: org.eclipse.emf.compare.diagram.ide.ui.internal;x-internal:=true
org.eclipse.emf.compare.diagram.ide.ui.internal.accessor.factory;x-internal:=true,
org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram;x-internal:=true,
org.eclipse.emf.compare.diagram.ide.ui.internal.preferences;x-internal:=true,
- org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters;x-friends:="org.eclipse.emf.compare.diagram.papyrus.tests",
- org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders
+ org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters;x-friends:="org.eclipse.emf.compare.diagram.papyrus.tests"
Bundle-Vendor: %providerName
Import-Package: com.google.common.base;version="[11.0.0,16.0.0)",
com.google.common.collect;version="[11.0.0,16.0.0)"
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/plugin.xml b/plugins/org.eclipse.emf.compare.diagram.ide.ui/plugin.xml
index ffc8f9496..50ec2f4e2 100644
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.diagram.ide.ui/plugin.xml
@@ -42,21 +42,6 @@
label="Diagram Refined elements">
</filter>
</extension>
- <extension
- point="org.eclipse.emf.compare.rcp.ui.differenceGroupExtender">
- <differenceGroupExtender
- class="org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders.DiagramDiffExtender">
- </differenceGroupExtender>
- <differenceGroupExtender
- class="org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders.DiagramChangeExtender">
- </differenceGroupExtender>
- <differenceGroupExtender
- class="org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders.EdgeChangeExtender">
- </differenceGroupExtender>
- <differenceGroupExtender
- class="org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders.NodeChangeExtender">
- </differenceGroupExtender>
- </extension>
<extension
point="org.eclipse.compare.contentMergeViewers">
<viewer
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/GMFRefinedElementsFilter.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/GMFRefinedElementsFilter.java
index be3733e06..f05b98324 100644
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/GMFRefinedElementsFilter.java
+++ b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/GMFRefinedElementsFilter.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.fil
import static com.google.common.base.Predicates.instanceOf;
import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import org.eclipse.emf.compare.Comparison;
@@ -101,7 +102,7 @@ public class GMFRefinedElementsFilter extends AbstractDifferenceFilter {
*/
@Override
public Predicate<? super EObject> getPredicateWhenUnselected() {
- return PREDICATE_WHEN_UNSELECTED;
+ return Predicates.alwaysFalse();
}
}
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramChangeExtender.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramChangeExtender.java
deleted file mode 100644
index 0797a6ad9..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramChangeExtender.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders;
-
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.diagram.internal.extensions.DiagramChange;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * Difference group extender for diagram changes.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class DiagramChangeExtender extends DiagramDiffExtender {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#addChildren(TreeNode)
- */
- @Override
- public void addChildren(TreeNode treeNode) {
- super.addChildren(treeNode);
- if (handle(treeNode)) {
- EObject data = treeNode.getData();
- TreeNode remove = null;
- for (TreeNode child : treeNode.getChildren()) {
- EObject childData = child.getData();
- if (data == childData) {
- remove = child;
- break;
- }
- }
- if (remove != null) {
- treeNode.getChildren().remove(remove);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#handle(TreeNode)
- */
- @Override
- public boolean handle(TreeNode treeNode) {
- if (treeNode != null) {
- EObject data = treeNode.getData();
- return data instanceof DiagramChange && (((DiagramChange)data).getKind() == DifferenceKind.ADD
- || ((DiagramChange)data).getKind() == DifferenceKind.DELETE);
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramDiffExtender.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramDiffExtender.java
deleted file mode 100644
index eda84e3e6..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/DiagramDiffExtender.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders;
-
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.diagram.internal.extensions.DiagramDiff;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * Difference group extender for diagram diffs.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class DiagramDiffExtender implements IDifferenceGroupExtender {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#addChildren(TreeNode)
- */
- public void addChildren(TreeNode treeNode) {
- Adapter group = EcoreUtil.getAdapter(treeNode.eAdapters(), IDifferenceGroup.class);
- if (group instanceof BasicDifferenceGroupImpl) {
- EObject data = treeNode.getData();
- DiagramDiff diagramDiff = (DiagramDiff)data;
- EObject view = diagramDiff.getView();
- Comparison comparison = diagramDiff.getMatch().getComparison();
- Match match = comparison.getMatch(view);
- if (match != null) {
- for (Match subMatch : match.getSubmatches()) {
- List<TreeNode> buildSubTree = ((BasicDifferenceGroupImpl)group)
- .buildContainmentSubTree(subMatch);
- treeNode.getChildren().addAll(buildSubTree);
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#handle(TreeNode)
- */
- public boolean handle(TreeNode treeNode) {
- return false;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/EdgeChangeExtender.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/EdgeChangeExtender.java
deleted file mode 100644
index ba763f148..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/EdgeChangeExtender.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders;
-
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.diagram.internal.extensions.EdgeChange;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * Difference group extender for edge changes.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class EdgeChangeExtender extends DiagramDiffExtender {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#handle(TreeNode)
- */
- @Override
- public boolean handle(TreeNode treeNode) {
- if (treeNode != null) {
- EObject data = treeNode.getData();
- return data instanceof EdgeChange && (((EdgeChange)data).getKind() == DifferenceKind.ADD
- || ((EdgeChange)data).getKind() == DifferenceKind.DELETE);
-
- }
- return false;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/NodeChangeExtender.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/NodeChangeExtender.java
deleted file mode 100644
index 11a042b61..000000000
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/structuremergeviewer/filters/groups/extenders/NodeChangeExtender.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.diagram.ide.ui.internal.structuremergeviewer.filters.groups.extenders;
-
-import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.diagram.internal.extensions.NodeChange;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * Difference group extender for node changes.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class NodeChangeExtender extends DiagramDiffExtender {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender#handle(TreeNode)
- */
- @Override
- public boolean handle(TreeNode treeNode) {
- if (treeNode != null) {
- EObject data = treeNode.getData();
- return data instanceof NodeChange && (((NodeChange)data).getKind() == DifferenceKind.ADD
- || ((NodeChange)data).getKind() == DifferenceKind.DELETE);
- }
- return false;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusConflictsGroupProviderTests.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusConflictsGroupProviderTests.java
index 433e0d893..17cf9e756 100644
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusConflictsGroupProviderTests.java
+++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusConflictsGroupProviderTests.java
@@ -58,6 +58,7 @@ import org.eclipse.gmf.runtime.notation.provider.NotationItemProviderAdapterFact
import org.eclipse.gmf.runtime.notation.util.NotationAdapterFactory;
import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
@SuppressWarnings("restriction")
@@ -95,6 +96,7 @@ public class PapyrusConflictsGroupProviderTests extends AbstractTest {
* @throws IOException
*/
@Test
+ @Ignore("This should be tested manually during validation of releases. The set-up doesn't allow this test to behave like a real running eclipse with papyrus installed.")
public void testBug478539() throws IOException {
final Resource left = input.getBug478539Left();
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java
index 8bb6d4d5d..83301f724 100644
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java
+++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java
@@ -31,9 +31,7 @@ import org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.EmptyMatchedResourcesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.IdenticalElementsFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.PseudoConflictsFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
@@ -74,10 +72,8 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
public void before() throws IOException {
super.before();
getFilter().removeFilter(new CascadingDifferencesFilter());
- getFilter().removeFilter(new PseudoConflictsFilter());
- getFilter().removeFilter(new EmptyMatchedResourcesFilter());
+ getFilter().removeFilter(new TechnicalitiesFilter());
// Adds this filter for clarity
- getFilter().addFilter(new IdenticalElementsFilter());
getFilter().addFilter(new UMLRefinedElementsFilter());
expectedResultData = new ExpectedResultData();
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java
index 293e2bf16..ac152ca5f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java
@@ -16,12 +16,12 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Collection;
+import java.util.List;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
@@ -70,40 +70,30 @@ public class MergeActionTest extends AbstractTestUITreeNodeItemProviderAdapter {
scopeProvider.getOrigin());
TreeNode ePackageMatch = getEcoreA1_EPackageMatch(comparison);
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
+ List<TreeNode> ePackage_MatchChildren = ePackageMatch.getChildren();
Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
// Get children of Match Person
Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildrenData, "name", "Person");
TreeNode person_Match_Node = getTreeNode(ePackageMatch, person_Match);
- Collection<?> person_MatchChildren = person_Match_Node.getChildren();
- Iterable<EObject> person_MatchChildrenData = transform(person_MatchChildren, TREE_NODE_DATA);
+ List<TreeNode> personChildren = person_Match_Node.getChildren();
- // Get left add difference
- ReferenceChange fullNameChange = getReferenceChangeWithFeatureValue(person_MatchChildrenData, "name",
- "fullName");
- leftAdd = getTreeNode(person_Match_Node, fullNameChange);
+ // Get left add difference (fullName)
+ leftAdd = personChildren.get(0).getChildren().get(0);
- // Get left delete difference
- ReferenceChange firstNameChange = getReferenceChangeWithFeatureValue(person_MatchChildrenData, "name",
- "firstName");
- leftDelete = getTreeNode(person_Match_Node, firstNameChange);
+ // Get left delete difference (firstName)
+ leftDelete = personChildren.get(1).getChildren().get(0);
// Get children of Match Book
Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildrenData, "name", "Book");
TreeNode book_Match_Node = getTreeNode(ePackageMatch, book_Match);
- Collection<?> book_MatchChildren = book_Match_Node.getChildren();
- Iterable<EObject> book_MatchChildrenData = transform(book_MatchChildren, TREE_NODE_DATA);
-
- // Get right add difference
- ReferenceChange subtitleNameChange = getReferenceChangeWithFeatureValue(book_MatchChildrenData,
- "name", "subtitle");
- rightAdd = getTreeNode(book_Match_Node, subtitleNameChange);
-
- // Get right delete difference
- ReferenceChange titleNameChange = getReferenceChangeWithFeatureValue(book_MatchChildrenData, "name",
- "title");
- rightDelete = getTreeNode(book_Match_Node, titleNameChange);
+ List<TreeNode> bookChildren = book_Match_Node.getChildren();
+
+ // Get right add difference (subtitle)
+ rightAdd = bookChildren.get(2).getChildren().get(0);
+
+ // Get right delete difference (title)
+ rightDelete = bookChildren.get(1).getChildren().get(0);
}
@Test
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java
index 3a8eb26b5..b14dd0556 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java
@@ -90,29 +90,29 @@ public class PseudoConflictsMergeActionTest extends AbstractTestUITreeNodeItemPr
scopeProvider.getOriginPseudoConflictFullScope());
TreeNode nodeRootMatch = getNodeRootMatch(comparison);
- TreeNode nodeD = nodeRootMatch.getChildren().get(0).getChildren().get(0);
EList<Diff> differences = comparison.getDifferences();
// Get left add difference
Diff leftAddDiff = Iterators.find(differences.iterator(),
and(fromSide(DifferenceSource.LEFT), ofKind(DifferenceKind.ADD)));
- leftAdd = getTreeNode(nodeRootMatch, leftAddDiff);
+ leftAdd = getTreeNode(nodeRootMatch.getChildren().get(0), leftAddDiff);
// Get right add difference
Diff rightAddDiff = Iterators.find(differences.iterator(),
and(fromSide(DifferenceSource.RIGHT), ofKind(DifferenceKind.ADD)));
- rightAdd = getTreeNode(nodeRootMatch, rightAddDiff);
+ rightAdd = getTreeNode(nodeRootMatch.getChildren().get(0), rightAddDiff);
// Get left delete difference
Diff leftDeleteDiff = Iterators.find(differences.iterator(),
and(fromSide(DifferenceSource.LEFT), ofKind(DifferenceKind.DELETE)));
- leftDelete = getTreeNode(nodeRootMatch, leftDeleteDiff);
+ leftDelete = getTreeNode(nodeRootMatch.getChildren().get(2), leftDeleteDiff);
// Get right delete difference
Diff rightDeleteDiff = Iterators.find(differences.iterator(),
and(fromSide(DifferenceSource.RIGHT), ofKind(DifferenceKind.DELETE)));
- rightDelete = getTreeNode(nodeRootMatch, rightDeleteDiff);
+ rightDelete = getTreeNode(nodeRootMatch.getChildren().get(2), rightDeleteDiff);
+ TreeNode nodeD = nodeRootMatch.getChildren().get(1).getChildren().get(0);
// Get left change difference
Diff leftChangeDiff = Iterators.find(differences.iterator(),
and(fromSide(DifferenceSource.LEFT), ofKind(DifferenceKind.CHANGE)));
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java
index 6e5f43692..73f74ffa4 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java
@@ -11,7 +11,6 @@
package org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -19,14 +18,13 @@ import com.google.common.collect.Iterables;
import java.io.IOException;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
@@ -39,7 +37,6 @@ import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
@@ -52,7 +49,7 @@ import org.junit.Test;
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
-@SuppressWarnings({"nls", "restriction" })
+@SuppressWarnings({"restriction" })
public class TestBug470503 extends AbstractTestUITreeNodeItemProviderAdapter {
private static TreeNodeItemProviderSpec itemProvider;
@@ -80,35 +77,21 @@ public class TestBug470503 extends AbstractTestUITreeNodeItemProviderAdapter {
editingDomain = EMFCompareEditingDomain.create(left, right, null);
- TreeNode ePackageMatch = getExtlibrary_EPackageMatch(comparison);
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
+ TreeNode extLibraryNode = getExtlibrary_EPackageMatch(comparison);
+ List<TreeNode> extLibraryNodeChildren = extLibraryNode.getChildren();
// Get children of Match Book
- Match book_Match = getMatchWithFeatureValue(ePackage_MatchChildrenData, "name", "Book");
- TreeNode book_Match_Node = getTreeNode(ePackageMatch, book_Match);
- Collection<?> book_MatchChildren = book_Match_Node.getChildren();
- Iterable<EObject> book_MatchChildrenData = transform(book_MatchChildren, TREE_NODE_DATA);
+ TreeNode bookNode = extLibraryNodeChildren.get(0);
// Get TitledItem [eSuperTypes delete] difference
- ReferenceChange titledItemESuperTypesDeleteChange = getReferenceChangeWithFeatureValue(
- book_MatchChildrenData, "name", "TitledItem");
- titledItemESuperTypesDelete = getTreeNode(book_Match_Node, titledItemESuperTypesDeleteChange);
+ titledItemESuperTypesDelete = bookNode.getChildren().get(0);
// Get TitledItem [eClassifiers delete] difference
- ReferenceChange titledItemEClassifiersDeleteChange = getReferenceChangeWithFeatureValue(
- ePackage_MatchChildrenData, "name", "TitledItem");
- titledItemEClassifiersDelete = getTreeNode(ePackageMatch, titledItemEClassifiersDeleteChange);
-
- // Get children of Match TitledItem
- TreeNode titledItem_Match_Node = getTreeNode(ePackageMatch, titledItemEClassifiersDeleteChange);
- Collection<?> titledItem_MatchChildren = titledItem_Match_Node.getChildren();
- Iterable<EObject> titledItem_MatchChildrenData = transform(titledItem_MatchChildren, TREE_NODE_DATA);
+ TreeNode titledItemNode = extLibraryNodeChildren.get(1);
+ titledItemEClassifiersDelete = titledItemNode.getChildren().get(0);
// Get title [eStructuralFeatures delete] difference
- ReferenceChange titleESFDeleteChange = getReferenceChangeWithFeatureValue(
- titledItem_MatchChildrenData, "name", "title");
- titleESFDelete = getTreeNode(titledItem_Match_Node, titleESFDeleteChange);
+ titleESFDelete = titledItemNode.getChildren().get(1).getChildren().get(0);
}
@Test
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug475586.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug475586.java
index 33814bb66..3f8c0693f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug475586.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug475586.java
@@ -11,7 +11,6 @@
package org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -22,12 +21,10 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Map;
-import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.EMFCompare;
-import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
@@ -40,7 +37,6 @@ import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.tests.framework.AbstractInputData;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
@@ -60,7 +56,7 @@ import org.junit.Test;
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
-@SuppressWarnings({"nls", "restriction" })
+@SuppressWarnings({"restriction" })
public class TestBug475586 extends AbstractTestUITreeNodeItemProviderAdapter {
private static TreeNodeItemProviderSpec itemProvider;
@@ -90,24 +86,12 @@ public class TestBug475586 extends AbstractTestUITreeNodeItemProviderAdapter {
editingDomain = EMFCompareEditingDomain.create(left, right, ancestor);
TreeNode nodeRoot = getMatchNodeRoot(comparison);
- Collection<?> nodeRootChildren = nodeRoot.getChildren();
- Iterable<EObject> nodeRootChildrenData = transform(nodeRootChildren, TREE_NODE_DATA);
// Get Node Single Value Reference A [containmentRef1 delete] difference
- ReferenceChange nodeA = getReferenceChangeWithFeatureValue(nodeRootChildrenData, "name", "A");
- containmentRefDeleteA = getTreeNode(nodeRoot, nodeA);
-
- // Get children of Match Node Single Value Reference A
- Collection<?> nodeAChildren = containmentRefDeleteA.getChildren();
- Iterable<EObject> nodeAChildrenData = transform(nodeAChildren, TREE_NODE_DATA);
-
- // Get C [name set] difference
- AttributeChange nodeC = getAttributeChangeWithFeatureValue(nodeAChildrenData, "name", "C");
- nameSetC = getTreeNode(containmentRefDeleteA, nodeC);
-
- // Get Node B [singleValuedReference unset] difference
- ReferenceChange nodeB = getReferenceChangeWithFeatureValue(nodeAChildrenData, "name", "B");
- singleValuedReferenceUnsetB = getTreeNode(containmentRefDeleteA, nodeB);
+ TreeNode nodeA = nodeRoot.getChildren().get(0);
+ containmentRefDeleteA = nodeA.getChildren().get(0);
+ singleValuedReferenceUnsetB = nodeA.getChildren().get(1);
+ nameSetC = nodeA.getChildren().get(2);
}
@Test
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java
index aec1dc331..b32d88d19 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java
@@ -10,19 +10,8 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions;
-import static com.google.common.base.Predicates.and;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
import static org.eclipse.emf.compare.internal.EMFCompareEditMessages.getString;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.added;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.addedToReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedAttribute;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.changedReference;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.moved;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removed;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.removedFromReference;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.Lists;
@@ -31,10 +20,7 @@ import java.io.IOException;
import java.util.Collection;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.EMFCompare.Builder;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
@@ -147,151 +133,60 @@ public class TooltipProviderTest extends AbstractTestUITreeNodeItemProviderAdapt
editingDomain = EMFCompareEditingDomain.create(scopeProvider.getLeft(), scopeProvider.getRight(),
scopeProvider.getOrigin());
- TreeNode nodeRootMatch = getNodeRootMatch(comparison);
- EList<Diff> differences = comparison.getDifferences();
+ TreeNode root = getNodeRootMatch(comparison);
// Get the compare editor tree nodes linked with each diff
- TreeNode nodeA = nodeRootMatch.getChildren().get(1).getChildren().get(0);
- Diff leftSet = find(differences,
- and(changedAttribute("Root.SetString.A", "singleValuedAttribute", "value1", "value1bis"),
- ofKind(DifferenceKind.CHANGE)));
- leftStringSet = getTreeNode(nodeA, leftSet);
-
- TreeNode nodeB = nodeRootMatch.getChildren().get(1).getChildren().get(1);
- Diff rightSet = find(differences,
- and(changedAttribute("Root.SetString.B", "singleValuedAttribute", "value2", "value2bis"),
- ofKind(DifferenceKind.CHANGE)));
- rightStringSet = getTreeNode(nodeB, rightSet);
-
- TreeNode nodeC = nodeRootMatch.getChildren().get(2).getChildren().get(0);
- Diff leftEmptySet = find(differences,
- and(changedAttribute("Root.SetFromEmptyString.C", "singleValuedAttribute", "", "newValue1"),
- ofKind(DifferenceKind.CHANGE)));
- leftEmptyStringSet = getTreeNode(nodeC, leftEmptySet);
-
- TreeNode nodeD = nodeRootMatch.getChildren().get(2).getChildren().get(1);
- Diff rightEmptySet = find(differences,
- and(changedAttribute("Root.SetFromEmptyString.D", "singleValuedAttribute", "", "newValue2"),
- ofKind(DifferenceKind.CHANGE)));
- rightEmptyStringSet = getTreeNode(nodeD, rightEmptySet);
-
- TreeNode nodeE = nodeRootMatch.getChildren().get(3).getChildren().get(0);
- Diff leftRefSet = find(differences,
- and(changedReference("Root.SetReference.E", "singleValuedReference", "Root.temp.temp1",
- "Root.temp.temp5"), ofKind(DifferenceKind.CHANGE)));
- leftReferenceSet = getTreeNode(nodeE, leftRefSet);
-
- TreeNode nodeF = nodeRootMatch.getChildren().get(3).getChildren().get(1);
- Diff rightRefSet = find(differences,
- and(changedReference("Root.SetReference.F", "singleValuedReference", "Root.temp.temp2",
- "Root.temp.temp6"), ofKind(DifferenceKind.CHANGE)));
- rightReferenceSet = getTreeNode(nodeF, rightRefSet);
-
- TreeNode nodeG = nodeRootMatch.getChildren().get(4).getChildren().get(0);
- Diff leftRefSetEmpty = find(differences, and(changedReference("Root.SetFromEmptyReference.G",
- "singleValuedReference", null, "Root.temp.temp5"), ofKind(DifferenceKind.CHANGE)));
- leftEmptyReferenceSet = getTreeNode(nodeG, leftRefSetEmpty);
-
- TreeNode nodeH = nodeRootMatch.getChildren().get(4).getChildren().get(1);
- Diff rightRefSetEmpty = find(differences, and(changedReference("Root.SetFromEmptyReference.H",
- "singleValuedReference", null, "Root.temp.temp6"), ofKind(DifferenceKind.CHANGE)));
- rightEmptyReferenceSet = getTreeNode(nodeH, rightRefSetEmpty);
-
- TreeNode nodeI = nodeRootMatch.getChildren().get(5).getChildren().get(0);
- Diff leftUnset = find(differences,
- and(changedAttribute("Root.UnsetString.I", "singleValuedAttribute", "value3", ""),
- ofKind(DifferenceKind.CHANGE)));
- leftStringUnset = getTreeNode(nodeI, leftUnset);
-
- TreeNode nodeJ = nodeRootMatch.getChildren().get(5).getChildren().get(1);
- Diff rightUnset = find(differences,
- and(changedAttribute("Root.UnsetString.J", "singleValuedAttribute", "value4", ""),
- ofKind(DifferenceKind.CHANGE)));
- rightStringUnset = getTreeNode(nodeJ, rightUnset);
-
- TreeNode nodeK = nodeRootMatch.getChildren().get(6).getChildren().get(0);
- Diff leftRefUnset = find(differences, and(
- changedReference("Root.UnsetReference.K", "singleValuedReference", "Root.temp.temp3", null),
- ofKind(DifferenceKind.CHANGE)));
- leftReferenceUnset = getTreeNode(nodeK, leftRefUnset);
-
- TreeNode nodeL = nodeRootMatch.getChildren().get(6).getChildren().get(1);
- Diff rightRefUnset = find(differences, and(
- changedReference("Root.UnsetReference.L", "singleValuedReference", "Root.temp.temp4", null),
- ofKind(DifferenceKind.CHANGE)));
- rightReferenceUnset = getTreeNode(nodeL, rightRefUnset);
-
- TreeNode nodeAddAtt1 = nodeRootMatch.getChildren().get(7).getChildren().get(0);
- Diff leftAddAtribute = find(differences,
- and(addedToAttribute("Root.AddAttribute.attribute1", "multiValuedAttribute", "value 1"),
- ofKind(DifferenceKind.ADD)));
- leftAttributeAdd = getTreeNode(nodeAddAtt1, leftAddAtribute);
-
- TreeNode nodeAddAtt2 = nodeRootMatch.getChildren().get(7).getChildren().get(1);
- Diff rightAddAtribute = find(differences,
- and(addedToAttribute("Root.AddAttribute.attribute2", "multiValuedAttribute", "value 2"),
- ofKind(DifferenceKind.ADD)));
- rightAttributeAdd = getTreeNode(nodeAddAtt2, rightAddAtribute);
-
- TreeNode nodeAddRef = nodeRootMatch.getChildren().get(8);
- Diff leftAddRef = find(differences,
- and(added("Root.AddReference.newNode1"), ofKind(DifferenceKind.ADD)));
- leftContainmentAdd = getTreeNode(nodeAddRef, leftAddRef);
-
- Diff rightAddRef = find(differences,
- and(added("Root.AddReference.newNode2"), ofKind(DifferenceKind.ADD)));
- rightContainmentAdd = getTreeNode(nodeAddRef, rightAddRef);
-
- TreeNode nodeAddRefNonCont1 = nodeRootMatch.getChildren().get(9).getChildren().get(0);
- Diff leftAddNonCont = find(differences,
- and(addedToReference("Root.AddReferenceNonContainment.reference1", "multiValuedReference",
- "Root.temp.temp1"), ofKind(DifferenceKind.ADD)));
- leftNonContainmentAdd = getTreeNode(nodeAddRefNonCont1, leftAddNonCont);
-
- TreeNode nodeAddRefNonCont2 = nodeRootMatch.getChildren().get(9).getChildren().get(1);
- Diff rightAddNonCont = find(differences,
- and(addedToReference("Root.AddReferenceNonContainment.reference2", "multiValuedReference",
- "Root.temp.temp2"), ofKind(DifferenceKind.ADD)));
- rightNonContainmentAdd = getTreeNode(nodeAddRefNonCont2, rightAddNonCont);
-
- TreeNode nodeDel = nodeRootMatch.getChildren().get(10);
- Diff leftDelete = find(differences,
- and(removed("Root.DelContainment.M"), ofKind(DifferenceKind.DELETE)));
- leftContainmentDelete = getTreeNode(nodeDel, leftDelete);
-
- Diff rightDelete = find(differences,
- and(removed("Root.DelContainment.N"), ofKind(DifferenceKind.DELETE)));
- rightContainmentDelete = getTreeNode(nodeDel, rightDelete);
-
- TreeNode nodeDelNonCont1 = nodeRootMatch.getChildren().get(11).getChildren().get(0);
- Diff leftDeleteNonCont = find(differences,
- and(removedFromReference("Root.DelNonContainment.reference3", "multiValuedReference",
- "Root.temp.temp7"), ofKind(DifferenceKind.DELETE)));
- leftNonContainmentDelete = getTreeNode(nodeDelNonCont1, leftDeleteNonCont);
-
- TreeNode nodeDelNonCont2 = nodeRootMatch.getChildren().get(11).getChildren().get(1);
- Diff rightDeleteNonCont = find(differences,
- and(removedFromReference("Root.DelNonContainment.reference4", "multiValuedReference",
- "Root.temp.temp8"), ofKind(DifferenceKind.DELETE)));
- rightNonContainmentDelete = getTreeNode(nodeDelNonCont2, rightDeleteNonCont);
-
- TreeNode nodeMoveCont = nodeRootMatch.getChildren().get(13);
- Diff leftMoveCont = find(differences, and(moved("Root.MoveContainerDestination.O", "containmentRef1"),
- ofKind(DifferenceKind.MOVE)));
- leftContainerMove = getTreeNode(nodeMoveCont, leftMoveCont);
-
- Diff rightMoveCont = find(differences, and(
- moved("Root.MoveContainerDestination.P", "containmentRef1"), ofKind(DifferenceKind.MOVE)));
- rightContainerMove = getTreeNode(nodeMoveCont, rightMoveCont);
-
- TreeNode nodeMovePos = nodeRootMatch.getChildren().get(14);
- Diff leftMovePos = find(differences,
- and(moved("Root.MovePosition.Q", "containmentRef1"), ofKind(DifferenceKind.MOVE)));
- leftPositionMove = getTreeNode(nodeMovePos, leftMovePos);
-
- Diff rightMovePos = find(differences,
- and(moved("Root.MovePosition.S", "containmentRef1"), ofKind(DifferenceKind.MOVE)));
- rightPositionMove = getTreeNode(nodeMovePos, rightMovePos);
+ TreeNode nodeSetString = root.getChildren().get(0);
+ leftStringSet = nodeSetString.getChildren().get(0).getChildren().get(0);
+ rightStringSet = nodeSetString.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeSetFromEmptyString = root.getChildren().get(1);
+ leftEmptyStringSet = nodeSetFromEmptyString.getChildren().get(0).getChildren().get(0);
+ rightEmptyStringSet = nodeSetFromEmptyString.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeSetReference = root.getChildren().get(2);
+ leftReferenceSet = nodeSetReference.getChildren().get(0).getChildren().get(0);
+ rightReferenceSet = nodeSetReference.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeSetFromEmptyReference = root.getChildren().get(3);
+ leftEmptyReferenceSet = nodeSetFromEmptyReference.getChildren().get(0).getChildren().get(0);
+ rightEmptyReferenceSet = nodeSetFromEmptyReference.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeUnsetString = root.getChildren().get(4);
+ leftStringUnset = nodeUnsetString.getChildren().get(0).getChildren().get(0);
+ rightStringUnset = nodeUnsetString.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeUnsetRef = root.getChildren().get(5);
+ leftReferenceUnset = nodeUnsetRef.getChildren().get(0).getChildren().get(0);
+ rightReferenceUnset = nodeUnsetRef.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeAddAttribute = root.getChildren().get(6);
+ leftAttributeAdd = nodeAddAttribute.getChildren().get(0).getChildren().get(0);
+ rightAttributeAdd = nodeAddAttribute.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeAddRef = root.getChildren().get(7);
+ leftContainmentAdd = nodeAddRef.getChildren().get(2).getChildren().get(0); // newNode1
+ rightContainmentAdd = nodeAddRef.getChildren().get(3).getChildren().get(0); // newNode2
+
+ TreeNode nodeAddRefNonCont1 = root.getChildren().get(8);
+ leftNonContainmentAdd = nodeAddRefNonCont1.getChildren().get(0).getChildren().get(0);
+ rightNonContainmentAdd = nodeAddRefNonCont1.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeDel = root.getChildren().get(9);
+ leftContainmentDelete = nodeDel.getChildren().get(1).getChildren().get(0);
+ rightContainmentDelete = nodeDel.getChildren().get(0).getChildren().get(0);
+
+ TreeNode nodeDelNonCont = root.getChildren().get(10);
+ leftNonContainmentDelete = nodeDelNonCont.getChildren().get(0).getChildren().get(0);
+ rightNonContainmentDelete = nodeDelNonCont.getChildren().get(1).getChildren().get(0);
+
+ TreeNode nodeMoveCont = root.getChildren().get(11);
+ leftContainerMove = nodeMoveCont.getChildren().get(1).getChildren().get(0);
+ rightContainerMove = nodeMoveCont.getChildren().get(0).getChildren().get(0);
+
+ TreeNode nodeMovePos = root.getChildren().get(12);
+ leftPositionMove = nodeMovePos.getChildren().get(0).getChildren().get(0);
+ rightPositionMove = nodeMovePos.getChildren().get(1).getChildren().get(0);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
index acc624e4a..3b67da0bc 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/suite/AllTests.java
@@ -13,10 +13,6 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.tests.suite;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.textui.TestRunner;
-
import org.eclipse.emf.compare.ComparePackage;
import org.eclipse.emf.compare.ide.ui.tests.command.MergeAllCommandTests;
import org.eclipse.emf.compare.ide.ui.tests.compareconfiguration.EMFCompareConfigurationTest;
@@ -39,7 +35,6 @@ import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions.MergeAc
import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions.MergeNonConflictingRunnableTest;
import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions.PseudoConflictsMergeActionTest;
import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions.TooltipProviderTest;
-import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.notloadedfragment.NotLoadedFragmentNodeTest;
import org.eclipse.emf.compare.ide.ui.tests.unit.DependenciesTest;
import org.eclipse.emf.compare.tests.nodes.NodesPackage;
import org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl;
@@ -50,10 +45,14 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
@RunWith(Suite.class)
@SuiteClasses({EMFCompareConfigurationTest.class, DependenciesTest.class, MergeActionTest.class,
PseudoConflictsMergeActionTest.class, BugsTestSuite.class, NavigatableTest.class,
- NotLoadedFragmentNodeTest.class, NotLoadedFragmentItemTest.class, ResolutionEventsTest.class,
+ /* NotLoadedFragmentNodeTest.class, */ NotLoadedFragmentItemTest.class, ResolutionEventsTest.class,
ResourceComputationSchedulerTest.class, ResourceComputationSchedulerWithEventBusTest.class,
ThreadedModelResolverGraphTest.class, ThreadedModelResolverWithCustomDependencyProviderTest.class,
DependencyGraphUpdaterTest.class, GraphResolutionTest.class, EMFModelProviderTest.class,
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestBug435365.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestBug435365.java
index b6fc95c99..d2374a9b4 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestBug435365.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestBug435365.java
@@ -11,17 +11,19 @@
package org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.filters;
import static com.google.common.base.Predicates.alwaysTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.IOException;
import java.util.List;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.DiffNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
import org.eclipse.emf.compare.tests.edit.data.ResourceScopeProvider;
@@ -32,7 +34,6 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.emf.edit.tree.TreePackage;
-import org.junit.Assert;
import org.junit.Test;
import com.google.common.base.Predicate;
@@ -52,7 +53,7 @@ public class TestBug435365 extends AbstractTestTreeNodeItemProviderAdapter {
* @throws IOException
*/
@Test
- public void testCascadingFilterNotHiddingDiffUnderMove() throws IOException {
+ public void testCascadingFilterNotHidingDiffUnderMove() throws IOException {
// Builds the input tree.
Comparison comparison = getComparison(new Bug435365Scope());
ECrossReferenceAdapter crossReferenceAdapter = new ECrossReferenceAdapter() {
@@ -70,39 +71,20 @@ public class TestBug435365 extends AbstractTestTreeNodeItemProviderAdapter {
crossReferenceAdapter);
List<? extends TreeNode> roots = group.getChildren();
// Gets the node matching the move diff.
- TreeNode moveNode = getMoveNode(roots);
- Predicate<? super EObject> whenSelectedCascadingFilterPredicate = new CascadingDifferencesFilter()
+ TreeNode movingNode = roots.get(0).getChildren().get(0).getChildren().get(0);
+ Predicate<? super EObject> cascadingFilter = new CascadingDifferencesFilter()
.getPredicateWhenSelected();
- Assert.assertEquals(false, whenSelectedCascadingFilterPredicate.apply(moveNode));
- EList<TreeNode> children = moveNode.getChildren();
- Assert.assertEquals(1, children.size());
- TreeNode newAdditionNode = children.get(0);
+ assertFalse(cascadingFilter.apply(movingNode));
+ EList<TreeNode> children = movingNode.getChildren();
+ assertEquals(2, children.size());
+ DiffNode diffNode = (DiffNode)children.get(0);
// Checks that its child is not hidden by the filter.
- Assert.assertEquals(false, whenSelectedCascadingFilterPredicate.apply(newAdditionNode));
- }
-
- /**
- * Retrieves the node matching the Move difference.
- *
- * @param roots
- * @return
- */
- private TreeNode getMoveNode(List<? extends TreeNode> roots) {
- for (TreeNode root : roots) {
- TreeIterator<EObject> nodeIte = root.eAllContents();
- while (nodeIte.hasNext()) {
- EObject n = nodeIte.next();
- if (n instanceof TreeNode) {
- TreeNode treeNode = (TreeNode)n;
- EObject data = treeNode.getData();
- if (data instanceof ReferenceChange
- && ((ReferenceChange)data).getKind() == DifferenceKind.MOVE) {
- return treeNode;
- }
- }
- }
- }
- return null;
+ assertFalse(cascadingFilter.apply(diffNode));
+ MatchNode matchNode = (MatchNode)children.get(1);
+ assertFalse(cascadingFilter.apply(matchNode));
+ assertEquals(1, matchNode.getChildren().size());
+ diffNode = (DiffNode)matchNode.getChildren().get(0);
+ assertFalse(cascadingFilter.apply(diffNode));
}
/**
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestFeatureMapDifferencesFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestFeatureMapDifferencesFilter.java
index fc5ab5bea..5794aa193 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestFeatureMapDifferencesFilter.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/filters/TestFeatureMapDifferencesFilter.java
@@ -18,7 +18,7 @@ import java.util.List;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.FeatureMapChange;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.FeatureMapDifferencesFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
@@ -65,7 +65,7 @@ public class TestFeatureMapDifferencesFilter extends AbstractTestTreeNodeItemPro
IDifferenceGroup group = new BasicDifferenceGroupImpl(comparison, alwaysTrue(),
crossReferenceAdapter);
List<? extends TreeNode> roots = group.getChildren();
- Predicate<? super EObject> featureMapDifferencesFilter = new FeatureMapDifferencesFilter()
+ Predicate<? super EObject> featureMapDifferencesFilter = new TechnicalitiesFilter()
.getPredicateWhenSelected();
for (TreeNode root : roots) {
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java
index dc5633fe3..13879b3ae 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.data.nodes.addconflict.NodesAddConflictInputData;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
@@ -79,426 +78,270 @@ public class TestBasicDifferenceGroupImpl extends AbstractTestTreeNodeItemProvid
TreeNode node = roots.get(0);
- assertEquals("extlibrary", itemDelegator.getText(node));
+ checkText(node, "extlibrary");
List<? extends TreeNode> extlibraryChildren = node.getChildren();
- assertEquals(18, extlibraryChildren.size());
+ assertEquals(10, extlibraryChildren.size());
+ // Book
node = extlibraryChildren.get(0);
- assertEquals("Book -> CirculatingItem", itemDelegator.getText(node));
+ checkText(node, "Book -> CirculatingItem");
List<? extends TreeNode> bookChildren = node.getChildren();
- assertEquals(6, bookChildren.size());
+ assertEquals(3, bookChildren.size());
node = bookChildren.get(0);
- assertEquals("pages : EInt", itemDelegator.getText(node));
+ checkText(node, "TitledItem [eSuperTypes add]");
assertEquals(0, node.getChildren().size());
- node = bookChildren.get(1);
- assertEquals("category : BookCategory", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookChildren.get(2);
- assertEquals("author : Writer", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookChildren.get(3);
- assertEquals("TitledItem [eSuperTypes add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookChildren.get(4);
- assertEquals("subtitle : EString [eStructuralFeatures add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> subtitleChildren = node.getChildren();
- assertEquals(1, subtitleChildren.size());
- node = subtitleChildren.get(0);
- assertEquals("EString [java.lang.String] [eType set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookChildren.get(5);
- assertEquals("title : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> titleChildren = node.getChildren();
- assertEquals(1, titleChildren.size());
- node = titleChildren.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ TreeNode titleNode = bookChildren.get(1);
+ checkText(titleNode, "title : EString");
- node = extlibraryChildren.get(1);
- assertEquals("Library -> Addressable", itemDelegator.getText(node));
-
- List<? extends TreeNode> libraryChildren = node.getChildren();
- assertEquals(9, libraryChildren.size());
-
- node = libraryChildren.get(0);
- assertEquals("name : EString", itemDelegator.getText(node));
+ List<TreeNode> bookTitleChildren = titleNode.getChildren();
+ assertEquals(2, bookTitleChildren.size());
+ node = bookTitleChildren.get(0);
+ checkText(node, "title : EString [eStructuralFeatures delete]");
assertEquals(0, node.getChildren().size());
-
- node = libraryChildren.get(1);
- assertEquals("writers : Writer", itemDelegator.getText(node));
- assertEquals(1, node.getChildren().size()); // ExtendedMetaData
-
- node = libraryChildren.get(2);
- assertEquals("employees : Employee", itemDelegator.getText(node));
- assertEquals(1, node.getChildren().size()); // ExtendedMetaData
-
- node = libraryChildren.get(3);
- assertEquals("borrowers : Borrower", itemDelegator.getText(node));
- assertEquals(1, node.getChildren().size()); // ExtendedMetaData
-
- node = libraryChildren.get(4);
- assertEquals("stock : Item", itemDelegator.getText(node));
+ node = bookTitleChildren.get(1);
+ checkText(node, "EString [java.lang.String] [eType unset]");
assertEquals(0, node.getChildren().size());
- node = libraryChildren.get(5);
- assertEquals("books : Book", itemDelegator.getText(node));
+ TreeNode subtitleNode = bookChildren.get(2);
+ checkText(subtitleNode, "subtitle : EString");
assertEquals(0, node.getChildren().size());
- node = libraryChildren.get(6);
- assertEquals("branches : Library", itemDelegator.getText(node));
+ List<TreeNode> bookSubtitleChildren = subtitleNode.getChildren();
+ assertEquals(2, bookSubtitleChildren.size());
+ node = bookSubtitleChildren.get(0);
+ checkText(node, "subtitle : EString [eStructuralFeatures add]");
assertEquals(0, node.getChildren().size());
-
- node = libraryChildren.get(7);
- assertEquals("parentBranch : Library", itemDelegator.getText(node));
+ node = bookSubtitleChildren.get(1);
+ checkText(node, "EString [java.lang.String] [eType set]");
assertEquals(0, node.getChildren().size());
- node = libraryChildren.get(8);
- assertEquals("people : EFeatureMapEntry", itemDelegator.getText(node));
- assertEquals(1, node.getChildren().size()); // ExtendedMetaData
-
+ // BookCategory
+ node = extlibraryChildren.get(1);
+ checkText(node, "BookCategory");
+ assertEquals(4, node.getChildren().size());
+
+ TreeNode childNode = node.getChildren().get(0);
+ checkText(childNode, "Encyclopedia = 3");
+ assertEquals(1, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "Encyclopedia = 3 [eLiterals add]");
+
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "Dictionary = 4");
+ assertEquals(1, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "Dictionary = 4 [eLiterals add]");
+
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "Manga = 3");
+ assertEquals(1, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "Manga = 3 [eLiterals add]");
+
+ childNode = node.getChildren().get(3);
+ checkText(childNode, "Manhwa = 5");
+ assertEquals(1, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "Manhwa = 5 [eLiterals add]");
+
+ // Borrowable
node = extlibraryChildren.get(2);
- assertEquals("Writer -> Person", itemDelegator.getText(node));
-
- List<? extends TreeNode> writerChildren = node.getChildren();
- assertEquals(2, writerChildren.size());
-
- node = writerChildren.get(0);
- assertEquals("name : EString", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = writerChildren.get(1);
- assertEquals("books : Book", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ checkText(node, "Borrowable");
+ assertEquals(1, node.getChildren().size());
+ checkText(node.getChildren().get(0), "Borrowable [name changed]");
+ // AudioVisualItem
node = extlibraryChildren.get(3);
- assertEquals("BookCategory", itemDelegator.getText(node));
-
- List<? extends TreeNode> bookCategoryChildren = node.getChildren();
- assertEquals(7, bookCategoryChildren.size());
-
- node = bookCategoryChildren.get(0);
- assertEquals("Mystery = 0", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(1);
- assertEquals("ScienceFiction = 1", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(2);
- assertEquals("Biography = 2", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(3);
- assertEquals("Encyclopedia = 3 [eLiterals add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(4);
- assertEquals("Dictionary = 4 [eLiterals add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(5);
- assertEquals("Manga = 3 [eLiterals add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookCategoryChildren.get(6);
- assertEquals("Manhwa = 5 [eLiterals add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
+ checkText(node, "AudioVisualItem -> CirculatingItem");
+ assertEquals(3, node.getChildren().size());
+
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "TitledItem [eSuperTypes add]");
+ assertEquals(0, childNode.getChildren().size());
+
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "title : EString");
+ assertEquals(2, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "title : EString [eStructuralFeatures delete]");
+ checkText(childNode.getChildren().get(1), "EString [java.lang.String] [eType unset]");
+
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "length : EInt");
+ assertEquals(2, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "length [name changed]");
+ checkText(childNode.getChildren().get(1), "minutes [name changed]");
+
+ // BookOnTape
node = extlibraryChildren.get(4);
- assertEquals("Item", itemDelegator.getText(node));
-
- List<? extends TreeNode> itemChildren = node.getChildren();
- assertEquals(1, itemChildren.size());
+ checkText(node, "BookOnTape -> AudioVisualItem");
+ assertEquals(1, node.getChildren().size());
- node = itemChildren.get(0);
- assertEquals("publicationDate : EDate", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ node = node.getChildren().get(0);
+ checkText(node, "reader : Person");
+ assertEquals(4, node.getChildren().size());
- node = extlibraryChildren.get(5);
- assertEquals("Borrowable", itemDelegator.getText(node));
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "reader : Person [eStructuralFeatures delete]");
+ assertEquals(0, childNode.getChildren().size());
- List<? extends TreeNode> borrowableChildren = node.getChildren();
- assertEquals(3, borrowableChildren.size());
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "reader : Person [eStructuralFeatures delete]");
+ assertEquals(0, childNode.getChildren().size());
- node = borrowableChildren.get(0);
- assertEquals("copies : EInt", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "Person -> Addressable [eType unset]");
+ assertEquals(0, childNode.getChildren().size());
- node = borrowableChildren.get(1);
- assertEquals("borrowers : Borrower", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = borrowableChildren.get(2);
- assertEquals("Borrowable [name changed]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ childNode = node.getChildren().get(3);
+ checkText(childNode, "Person -> Addressable [eType unset]");
+ assertEquals(0, childNode.getChildren().size());
+ // Person
+ node = extlibraryChildren.get(5);
+ checkText(node, "Person -> Addressable");
+ assertEquals(3, node.getChildren().size());
+ // Person.fullName
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "fullName : EString");
+ assertEquals(2, childNode.getChildren().size());
+
+ TreeNode childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "fullName : EString [eStructuralFeatures add]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EString [java.lang.String] [eType set]");
+ assertEquals(0, childNode2.getChildren().size());
+ // Person.firstName
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "firstName : EString");
+ assertEquals(2, childNode.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "firstName : EString [eStructuralFeatures delete]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EString [java.lang.String] [eType unset]");
+ assertEquals(0, childNode2.getChildren().size());
+ // Person.lastName
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "lastName : EString");
+ assertEquals(3, childNode.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "lastName : EString [eStructuralFeatures delete]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EString [java.lang.String] [eType unset]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(2);
+ checkText(childNode2, "familyName [name set]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ // Magazine
node = extlibraryChildren.get(6);
- assertEquals("CirculatingItem -> Item, Borrowable", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
+ checkText(node, "Magazine -> CirculatingItem");
+ assertEquals(4, node.getChildren().size());
+ // eClassifiers add
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "Magazine -> CirculatingItem [eClassifiers add]");
+ assertEquals(0, childNode.getChildren().size());
+ // eSuperTypes add
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "CirculatingItem -> Item, Borrowable [eSuperTypes add]");
+ assertEquals(0, childNode.getChildren().size());
+ // Magazine.title
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "title : EString");
+ assertEquals(2, childNode.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "title : EString [eStructuralFeatures add]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EString [java.lang.String] [eType set]");
+ assertEquals(0, childNode2.getChildren().size());
+ // Magazine.pages
+ childNode = node.getChildren().get(3);
+ checkText(childNode, "pages : EInt");
+ assertEquals(2, childNode.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "pages : EInt [eStructuralFeatures add]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EInt [int] [eType set]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ // Periodical
node = extlibraryChildren.get(7);
- assertEquals("AudioVisualItem -> CirculatingItem", itemDelegator.getText(node));
-
- List<? extends TreeNode> audioVisualItemChildren = node.getChildren();
- assertEquals(4, audioVisualItemChildren.size());
-
- node = audioVisualItemChildren.get(0);
- assertEquals("length : EInt", itemDelegator.getText(node));
-
- List<? extends TreeNode> lengthChildren = node.getChildren();
- assertEquals(2, lengthChildren.size());
-
- node = lengthChildren.get(0);
- assertEquals("length [name changed]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = lengthChildren.get(1);
- assertEquals("minutes [name changed]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = audioVisualItemChildren.get(1);
- assertEquals("damaged : EBoolean", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = audioVisualItemChildren.get(2);
- assertEquals("TitledItem [eSuperTypes add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = audioVisualItemChildren.get(3);
- assertEquals("title : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> audioTitleChildren = node.getChildren();
- assertEquals(1, audioTitleChildren.size());
-
- node = audioTitleChildren.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
+ checkText(node, "Periodical -> Item");
+ assertEquals(5, node.getChildren().size());
+ // eClassifiers add
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "Periodical -> Item [eClassifiers delete]");
+ assertEquals(0, childNode.getChildren().size());
+ // eSuperTypes add
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "TitledItem [eSuperTypes add]");
+ assertEquals(0, childNode.getChildren().size());
+ // eSuperTypes delete
+ childNode = node.getChildren().get(2);
+ checkText(childNode, "Item [eSuperTypes delete]");
+ assertEquals(0, childNode.getChildren().size());
+
+ // Periodical.issuesPerYear
+ childNode = node.getChildren().get(3);
+ checkText(childNode, "issuesPerYear : EInt");
+ assertEquals(2, childNode.getChildren().size());
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "issuesPerYear : EInt [eStructuralFeatures delete]");
+ assertEquals(0, childNode2.getChildren().size());
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EInt [int] [eType unset]");
+ assertEquals(0, childNode2.getChildren().size());
+
+ // Periodical.title
+ childNode = node.getChildren().get(4);
+ checkText(childNode, "title : EString");
+ assertEquals(4, childNode.getChildren().size());
+ checkText(childNode.getChildren().get(0), "title : EString [eStructuralFeatures delete]");
+ checkText(childNode.getChildren().get(1), "title : EString [eStructuralFeatures delete]");
+ checkText(childNode.getChildren().get(2), "EString [java.lang.String] [eType unset]");
+ checkText(childNode.getChildren().get(3), "EString [java.lang.String] [eType unset]");
+
+ // Magazine (from the right)
node = extlibraryChildren.get(8);
- assertEquals("BookOnTape -> AudioVisualItem", itemDelegator.getText(node));
-
- List<? extends TreeNode> bookOnTapeChildren = node.getChildren();
- assertEquals(3, bookOnTapeChildren.size());
-
- node = bookOnTapeChildren.get(0);
- assertEquals("author : Writer", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookOnTapeChildren.get(1);
- assertEquals("reader : Person [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> reader1Children = node.getChildren();
- assertEquals(1, reader1Children.size());
-
- node = reader1Children.get(0);
- assertEquals("Person -> Addressable [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = bookOnTapeChildren.get(2);
- assertEquals("reader : Person [eStructuralFeatures delete]", itemDelegator.getText(node));
- assertEquals(1, node.getChildren().size());
-
- List<? extends TreeNode> reader2Children = node.getChildren();
- assertEquals(1, reader2Children.size());
-
- node = reader2Children.get(0);
- assertEquals("Person -> Addressable [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
+ checkText(node, "Magazine -> Periodical");
+ assertEquals(2, node.getChildren().size());
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "Magazine -> Periodical [eClassifiers add]");
+ assertEquals(0, childNode.getChildren().size());
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "Periodical -> Item, TitledItem [eSuperTypes add]");
+ assertEquals(0, childNode.getChildren().size());
+
+ // TitledItem
node = extlibraryChildren.get(9);
- assertEquals("VideoCassette -> AudioVisualItem", itemDelegator.getText(node));
-
- List<? extends TreeNode> videoCassetteChildren = node.getChildren();
- assertEquals(1, videoCassetteChildren.size());
-
- node = videoCassetteChildren.get(0);
- assertEquals("cast : Person", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(10);
- assertEquals("Borrower -> Person", itemDelegator.getText(node));
-
- List<? extends TreeNode> borrowerChildren = node.getChildren();
- assertEquals(1, borrowerChildren.size());
-
- node = borrowerChildren.get(0);
- assertEquals("borrowed : Borrowable", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(11);
- assertEquals("Person -> Addressable", itemDelegator.getText(node));
-
- List<? extends TreeNode> personChildren = node.getChildren();
- assertEquals(3, personChildren.size());
-
- node = personChildren.get(0);
- assertEquals("fullName : EString [eStructuralFeatures add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> fullNameChildren = node.getChildren();
- assertEquals(1, fullNameChildren.size());
-
- node = fullNameChildren.get(0);
- assertEquals("EString [java.lang.String] [eType set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = personChildren.get(1);
- assertEquals("firstName : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> firstNameChildren = node.getChildren();
- assertEquals(1, firstNameChildren.size());
-
- node = firstNameChildren.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = personChildren.get(2);
- assertEquals("lastName : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> lastNameChildren = node.getChildren();
- assertEquals(2, lastNameChildren.size());
-
- node = lastNameChildren.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = lastNameChildren.get(1);
- assertEquals("familyName [name set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(12);
- assertEquals("Employee -> Person", itemDelegator.getText(node));
-
- List<? extends TreeNode> employeeChildren = node.getChildren();
- assertEquals(1, employeeChildren.size());
-
- node = employeeChildren.get(0);
- assertEquals("manager : Employee", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(13);
- assertEquals("Addressable", itemDelegator.getText(node));
-
- List<? extends TreeNode> addressableChildren = node.getChildren();
- assertEquals(1, addressableChildren.size());
-
- node = addressableChildren.get(0);
- assertEquals("address : EString", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(14);
- assertEquals("Magazine -> CirculatingItem [eClassifiers add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> magazineCirculatingItemChildren = node.getChildren();
- assertEquals(3, magazineCirculatingItemChildren.size());
-
- node = magazineCirculatingItemChildren.get(0);
- assertEquals("CirculatingItem -> Item, Borrowable [eSuperTypes add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = magazineCirculatingItemChildren.get(1);
- assertEquals("title : EString [eStructuralFeatures add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> circulatingItemTitleChildren = node.getChildren();
- assertEquals(1, circulatingItemTitleChildren.size());
-
- node = circulatingItemTitleChildren.get(0);
- assertEquals("EString [java.lang.String] [eType set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = magazineCirculatingItemChildren.get(2);
- assertEquals("pages : EInt [eStructuralFeatures add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> pagesChildren = node.getChildren();
- assertEquals(1, pagesChildren.size());
-
- node = pagesChildren.get(0);
- assertEquals("EInt [int] [eType set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(15);
- assertEquals("Magazine -> Periodical [eClassifiers add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> magazineChildren = node.getChildren();
- assertEquals(1, magazineChildren.size());
-
- node = magazineChildren.get(0);
- assertEquals("Periodical -> Item, TitledItem [eSuperTypes add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(16);
- assertEquals("TitledItem [eClassifiers add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> titledItemChildren = node.getChildren();
- assertEquals(1, titledItemChildren.size());
-
- node = titledItemChildren.get(0);
- assertEquals("title : EString [eStructuralFeatures add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> titledItemTitleChildren = node.getChildren();
- assertEquals(1, titledItemTitleChildren.size());
-
- node = titledItemTitleChildren.get(0);
- assertEquals("EString [java.lang.String] [eType set]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = extlibraryChildren.get(17);
- assertEquals("Periodical -> Item [eClassifiers delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> periodicalItemChildren = node.getChildren();
- assertEquals(5, periodicalItemChildren.size());
-
- node = periodicalItemChildren.get(0);
- assertEquals("TitledItem [eSuperTypes add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = periodicalItemChildren.get(1);
- assertEquals("Item [eSuperTypes delete]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = periodicalItemChildren.get(2);
- assertEquals("title : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> title1Children = node.getChildren();
- assertEquals(1, title1Children.size());
-
- node = title1Children.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = periodicalItemChildren.get(3);
- assertEquals("title : EString [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> title2Children = node.getChildren();
- assertEquals(1, title2Children.size());
-
- node = title2Children.get(0);
- assertEquals("EString [java.lang.String] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = periodicalItemChildren.get(4);
- assertEquals("issuesPerYear : EInt [eStructuralFeatures delete]", itemDelegator.getText(node));
-
- List<? extends TreeNode> issuesPerYearChildren = node.getChildren();
- assertEquals(1, issuesPerYearChildren.size());
-
- node = issuesPerYearChildren.get(0);
- assertEquals("EInt [int] [eType unset]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = roots.get(1);
- assertEquals("extlibraryLeft.ecore <-> extlibraryRight.ecore (extlibraryOrigin.ecore)",
- itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ checkText(node, "TitledItem");
+ assertEquals(2, node.getChildren().size());
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "TitledItem [eClassifiers add]");
+ assertEquals(0, childNode.getChildren().size());
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "title : EString");
+ assertEquals(2, childNode.getChildren().size());
+ childNode2 = childNode.getChildren().get(0);
+ checkText(childNode2, "title : EString [eStructuralFeatures add]");
+ assertEquals(0, childNode2.getChildren().size());
+ childNode2 = childNode.getChildren().get(1);
+ checkText(childNode2, "EString [java.lang.String] [eType set]");
+ assertEquals(0, childNode2.getChildren().size());
}
@Test
@@ -523,63 +366,70 @@ public class TestBasicDifferenceGroupImpl extends AbstractTestTreeNodeItemProvid
TreeNode node = roots.get(0);
- assertEquals("Node root", itemDelegator.getText(node));
+ checkText(node, "Node root");
List<? extends TreeNode> nodeRootChildren = node.getChildren();
assertEquals(3, nodeRootChildren.size());
node = nodeRootChildren.get(0);
- assertEquals("Node A", itemDelegator.getText(node));
+ checkText(node, "Node A");
List<? extends TreeNode> aChildren = node.getChildren();
assertEquals(1, aChildren.size());
- node = aChildren.get(0);
- assertEquals("Node C [containmentRef1 add]", itemDelegator.getText(node));
+ TreeNode nodeC1 = aChildren.get(0);
+ checkText(nodeC1, "Node C");
+ assertEquals(4, nodeC1.getChildren().size());
- List<? extends TreeNode> c1Children = node.getChildren();
- assertEquals(2, c1Children.size());
+ node = nodeC1.getChildren().get(0);
+ checkText(node, "Node C [containmentRef1 add]");
- node = c1Children.get(0);
- assertEquals("Node D [containmentRef1 add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
-
- node = c1Children.get(1);
- assertEquals("Node E [containmentRef1 add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ node = nodeC1.getChildren().get(1);
+ checkText(node, "Node D");
+ assertEquals(2, node.getChildren().size());
+ TreeNode childNode = node.getChildren().get(0);
+ checkText(childNode, "Node D [containmentRef1 add]");
+ childNode = node.getChildren().get(1);
+ checkText(childNode, "Node D [containmentRef1 add]");
- node = nodeRootChildren.get(1);
- assertEquals("Node B", itemDelegator.getText(node));
-
- List<? extends TreeNode> bChildren = node.getChildren();
- assertEquals(1, bChildren.size());
-
- node = bChildren.get(0);
- assertEquals("Node C [containmentRef1 add]", itemDelegator.getText(node));
-
- List<? extends TreeNode> c2Children = node.getChildren();
- assertEquals(2, c2Children.size());
+ node = nodeC1.getChildren().get(2);
+ checkText(node, "Node E");
+ assertEquals(1, node.getChildren().size());
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "Node E [containmentRef1 add]");
- node = c2Children.get(0);
- assertEquals("Node D [containmentRef1 add]", itemDelegator.getText(node));
- assertEquals(0, node.getChildren().size());
+ node = nodeC1.getChildren().get(3);
+ checkText(node, "Node F");
+ assertEquals(1, node.getChildren().size());
+ childNode = node.getChildren().get(0);
+ checkText(childNode, "Node F [containmentRef1 add]");
- node = c2Children.get(1);
- assertEquals("Node F [containmentRef1 add]", itemDelegator.getText(node));
+ node = nodeRootChildren.get(1);
+ checkText(node, "Node B");
+ assertEquals(1, node.getChildren().size());
+ node = node.getChildren().get(0);
+ checkText(node, "Node C");
+ assertEquals(1, node.getChildren().size());
+ node = node.getChildren().get(0);
+ checkText(node, "Node C [containmentRef1 add]");
assertEquals(0, node.getChildren().size());
node = nodeRootChildren.get(2);
- assertEquals("Node G", itemDelegator.getText(node));
-
- List<? extends TreeNode> gChildren = node.getChildren();
- assertEquals(1, gChildren.size());
-
- node = gChildren.get(0);
- assertEquals("Node H [containmentRef1 add]", itemDelegator.getText(node));
+ checkText(node, "Node G");
+ assertEquals(1, node.getChildren().size());
+ node = node.getChildren().get(0);
+ checkText(node, "Node H");
+ assertEquals(1, node.getChildren().size());
+ node = node.getChildren().get(0);
+ checkText(node, "Node H [containmentRef1 add]");
assertEquals(0, node.getChildren().size());
node = roots.get(1);
- assertEquals("left.nodes <-> right.nodes (ancestor.nodes)", itemDelegator.getText(node));
+ checkText(node, "left.nodes <-> right.nodes (ancestor.nodes)");
assertEquals(0, node.getChildren().size());
}
+
+ protected void checkText(TreeNode childNode, String expected) {
+ assertEquals(expected, itemDelegator.getText(childNode));
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestMatchTreeNodeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestMatchTreeNodeItemProviderSpec.java
index 58b86b267..bff104405 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestMatchTreeNodeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestMatchTreeNodeItemProviderSpec.java
@@ -10,10 +10,13 @@
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider;
+import static com.google.common.base.Predicates.instanceOf;
+import static com.google.common.collect.Iterables.all;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.size;
import static com.google.common.collect.Iterables.transform;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Collection;
@@ -23,6 +26,8 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.DiffNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
import org.eclipse.emf.compare.tests.edit.data.ecore.a1.EcoreA1InputData;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeFactory;
@@ -52,10 +57,10 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
Collection<?> ePackageMatchChildren = ePackageMatch.getChildren();
- assertEquals(18, ePackageMatchChildren.size());
+ assertEquals(10, ePackageMatchChildren.size());
+ assertTrue(all(ePackageMatchChildren, instanceOf(MatchNode.class)));
Iterable<EObject> ePackageData = transform(ePackageMatchChildren, TREE_NODE_DATA);
- assertEquals(4, size(filter(ePackageData, Diff.class)));
- assertEquals(14, size(filter(ePackageData, Match.class)));
+ assertEquals(10, size(filter(ePackageData, Match.class)));
}
static TreeNode getEcoreA1_EPackageMatch() throws IOException {
@@ -97,11 +102,11 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
Collection<?> audioVisualItem_MatchChildren = audioVisualItem_Match_Node.getChildren();
- assertEquals(4, audioVisualItem_MatchChildren.size());
+ assertEquals(3, audioVisualItem_MatchChildren.size());
Iterable<EObject> audioData = transform(audioVisualItem_MatchChildren, TREE_NODE_DATA);
- assertEquals(2, size(filter(audioData, Diff.class)));
+ assertEquals(1, size(filter(audioData, Diff.class)));
assertEquals(2, size(filter(audioData, Match.class)));
}
@@ -128,6 +133,7 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
Collection<?> audioVisualItem_length_MatchChildren = itemProvider.getChildren(audioLengthTreeNode);
assertEquals(2, audioVisualItem_length_MatchChildren.size());
+ assertTrue(all(audioVisualItem_length_MatchChildren, instanceOf(DiffNode.class)));
Iterable<EObject> audioLengthData = transform(audioVisualItem_length_MatchChildren, TREE_NODE_DATA);
@@ -149,12 +155,12 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
Collection<?> book_MatchChildren = book_Match_Node.getChildren();
- assertEquals(6, book_MatchChildren.size());
+ assertEquals(3, book_MatchChildren.size());
Iterable<EObject> book_MatchChildrenData = transform(book_MatchChildren, TREE_NODE_DATA);
- assertEquals(3, size(filter(book_MatchChildrenData, Diff.class)));
- assertEquals(3, size(filter(book_MatchChildrenData, Match.class)));
+ assertEquals(1, size(filter(book_MatchChildrenData, Diff.class)));
+ assertEquals(2, size(filter(book_MatchChildrenData, Match.class)));
}
@Test
@@ -170,15 +176,18 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
TreeNode bookCategory_Match_Node = getTreeNode(ePackageMatch, bookCategory_Match);
- Collection<?> bookCategory_MatchChildren = bookCategory_Match_Node.getChildren();
+ Collection<? extends TreeNode> bookCategory_MatchChildren = bookCategory_Match_Node.getChildren();
- assertEquals(7, bookCategory_MatchChildren.size());
+ assertEquals(4, bookCategory_MatchChildren.size());
+ assertTrue(all(bookCategory_MatchChildren, instanceOf(MatchNode.class)));
Iterable<EObject> bookCategory_MatchChildrenData = transform(bookCategory_MatchChildren,
TREE_NODE_DATA);
- assertEquals(4, size(filter(bookCategory_MatchChildrenData, Diff.class)));
- assertEquals(3, size(filter(bookCategory_MatchChildrenData, Match.class)));
+ assertEquals(4, size(filter(bookCategory_MatchChildrenData, Match.class)));
+ for (TreeNode matchNode : bookCategory_MatchChildren) {
+ assertEquals(1, matchNode.getChildren().size());
+ }
}
@Test
@@ -193,14 +202,13 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
TreeNode borrowable_Match_Node = getTreeNode(ePackageMatch, borrowable_Match);
- Collection<?> borrowable_MatchChildren = borrowable_Match_Node.getChildren();
+ Collection<? extends TreeNode> borrowable_MatchChildren = borrowable_Match_Node.getChildren();
- assertEquals(3, borrowable_MatchChildren.size());
+ assertEquals(1, borrowable_MatchChildren.size());
Iterable<EObject> borrowable_MatchChildrenData = transform(borrowable_MatchChildren, TREE_NODE_DATA);
assertEquals(1, size(filter(borrowable_MatchChildrenData, Diff.class)));
- assertEquals(2, size(filter(borrowable_MatchChildrenData, Match.class)));
}
@Test
@@ -215,13 +223,12 @@ public class TestMatchTreeNodeItemProviderSpec extends AbstractTestTreeNodeItemP
TreeNode person_Match_Node = getTreeNode(ePackageMatch, person_Match);
- Collection<?> person_MatchChildren = person_Match_Node.getChildren();
+ Collection<? extends TreeNode> person_MatchChildren = person_Match_Node.getChildren();
assertEquals(3, person_MatchChildren.size());
Iterable<EObject> person_MatchChildrenData = transform(person_MatchChildren, TREE_NODE_DATA);
- assertEquals(3, size(filter(person_MatchChildrenData, Diff.class)));
- assertEquals(0, size(filter(person_MatchChildrenData, Match.class)));
+ assertEquals(3, size(filter(person_MatchChildrenData, Match.class)));
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestReferenceChangeTreeNodeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestReferenceChangeTreeNodeItemProviderSpec.java
index 16b48413d..2a4c89d5b 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestReferenceChangeTreeNodeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/TestReferenceChangeTreeNodeItemProviderSpec.java
@@ -10,33 +10,44 @@
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider;
+import static com.google.common.collect.Iterables.filter;
+import static org.eclipse.emf.compare.ConflictKind.PSEUDO;
+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.DifferenceSource.LEFT;
+import static org.eclipse.emf.compare.DifferenceSource.RIGHT;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
-import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Conflict;
+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.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.DiffNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.data.ecore.a1.EcoreA1InputData;
-import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
import org.junit.Before;
import org.junit.Test;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.get;
-import static com.google.common.collect.Iterables.transform;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
/**
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
@@ -68,327 +79,358 @@ public class TestReferenceChangeTreeNodeItemProviderSpec extends AbstractTestTre
@Test
public void testGetChildren_AudioVisualItem() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
-
- Iterable<EObject> ePackageData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- Match audioVisualItem_Match = getMatchWithFeatureValue(ePackageData, "name", "AudioVisualItem");
-
- TreeNode audioVisualItem_Match_Node = getTreeNode(ePackageMatch, audioVisualItem_Match);
-
- Collection<?> audioVisualItem_MatchChildren = audioVisualItem_Match_Node.getChildren();
-
- Iterable<EObject> audioVisualItemChildrenData = transform(audioVisualItem_MatchChildren,
- TREE_NODE_DATA);
-
- ReferenceChange titleReferenceChange = getReferenceChangeWithFeatureValue(audioVisualItemChildrenData,
- "name", "title");
-
- TreeNode titleReferenceChange_Node = getTreeNode(audioVisualItem_Match_Node, titleReferenceChange);
-
- Collection<?> titleReferenceChange_Children = titleReferenceChange_Node.getChildren();
-
- assertEquals(1, titleReferenceChange_Children.size());
- Object child = get(titleReferenceChange_Children, 0);
-
- assertTrue(child instanceof TreeNode);
- assertTrue(((TreeNode)child).getData() instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE,
- ((ReferenceChange)((TreeNode)child).getData()).getReference());
-
- ReferenceChange titledItemReferenceChange = getReferenceChangeWithFeatureValue(
- audioVisualItemChildrenData, "name", "TitledItem");
-
- TreeNode titledItemReferenceChange_Node = getTreeNode(audioVisualItem_Match_Node,
- titledItemReferenceChange);
-
- Collection<?> titledItemReferenceChange_Children = titledItemReferenceChange_Node.getChildren();
- assertEquals(0, titledItemReferenceChange_Children.size());
+ MatchNode audioVisualItemNode = (MatchNode)ePackageMatch.getChildren().get(3);
+ checkMatch(audioVisualItemNode, RIGHT, "AudioVisualItem");
+
+ List<TreeNode> audioVisualChildren = audioVisualItemNode.getChildren();
+ assertEquals(3, audioVisualChildren.size());
+ TreeNode node = audioVisualChildren.get(0);
+ checkRefChange(node, RIGHT, ADD, "eSuperTypes");
+ checkNoChild(node);
+
+ node = audioVisualChildren.get(1);
+ assertTrue(node instanceof MatchNode);
+ assertEquals(2, node.getChildren().size());
+ TreeNode childNode = node.getChildren().get(0);
+ checkRefChange(childNode, RIGHT, DELETE, "eStructuralFeatures");
+ checkNoChild(childNode);
+ childNode = node.getChildren().get(1);
+ checkRefChange(childNode, RIGHT, CHANGE, "eType");
+ checkNoChild(childNode);
+
+ node = audioVisualChildren.get(2);
+ assertTrue(node instanceof MatchNode);
+ assertEquals(2, node.getChildren().size());
+ childNode = node.getChildren().get(0);
+ checkAttChange(childNode, LEFT, CHANGE, "name", "length");
+ checkNoChild(childNode);
+ childNode = node.getChildren().get(1);
+ checkAttChange(childNode, RIGHT, CHANGE, "name", "minutes");
+ checkNoChild(childNode);
}
@Test
public void testGetChildren_Book() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
-
- Iterable<EObject> ePackageData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- Match book_Match = getMatchWithFeatureValue(ePackageData, "name", "Book");
-
- TreeNode book_Match_Node = getTreeNode(ePackageMatch, book_Match);
-
- Collection<?> book_MatchChildren = book_Match_Node.getChildren();
-
- Iterable<EObject> book_MatchChildrenData = transform(book_MatchChildren, TREE_NODE_DATA);
-
- ReferenceChange subtitleReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildrenData,
- "name", "subtitle");
-
- TreeNode subtitleReferenceChange_Node = getTreeNode(book_Match_Node, subtitleReferenceChange);
-
- Collection<?> subtitleReferenceChange_Children = subtitleReferenceChange_Node.getChildren();
-
- assertEquals(1, subtitleReferenceChange_Children.size());
- Notifier child = (Notifier)get(subtitleReferenceChange_Children, 0);
- assertTrue(child instanceof TreeNode);
- assertTrue(((TreeNode)child).getData() instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE,
- ((ReferenceChange)((TreeNode)child).getData()).getReference());
- assertTrue(((TreeNode)child).getChildren().isEmpty());
-
- ReferenceChange titleReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildrenData,
- "name", "title");
-
- TreeNode titleReferenceChange_Node = getTreeNode(book_Match_Node, titleReferenceChange);
-
- Collection<?> titleReferenceChange_Children = titleReferenceChange_Node.getChildren();
- assertEquals(1, titleReferenceChange_Children.size());
- child = (Notifier)get(titleReferenceChange_Children, 0);
- assertTrue(child instanceof TreeNode);
- assertTrue(((TreeNode)child).getData() instanceof ReferenceChange);
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE,
- ((ReferenceChange)((TreeNode)child).getData()).getReference());
- assertTrue(((TreeNode)child).getChildren().isEmpty());
-
- ReferenceChange titledItemReferenceChange = getReferenceChangeWithFeatureValue(book_MatchChildrenData,
- "name", "TitledItem");
-
- TreeNode titledItemReferenceChange_Node = getTreeNode(book_Match_Node, titledItemReferenceChange);
-
- Collection<?> titledItemReferenceChange_Children = titledItemReferenceChange_Node.getChildren();
- assertEquals(0, titledItemReferenceChange_Children.size());
+ MatchNode bookNode = (MatchNode)ePackageMatch.getChildren().get(0);
+ checkMatch(bookNode, RIGHT, "Book");
+
+ List<TreeNode> bookChildren = bookNode.getChildren();
+ assertEquals(3, bookChildren.size());
+ TreeNode diffNode = bookChildren.get(0);
+ checkRefChange(diffNode, RIGHT, ADD, "eSuperTypes");
+ checkNoChild(diffNode);
+
+ MatchNode titleMatchNode = (MatchNode)bookChildren.get(1);
+ assertEquals(2, titleMatchNode.getChildren().size());
+ diffNode = titleMatchNode.getChildren().get(0);
+ checkRefChange(diffNode, RIGHT, DELETE, "eStructuralFeatures");
+ checkNoChild(diffNode);
+
+ diffNode = titleMatchNode.getChildren().get(1);
+ checkRefChange(diffNode, RIGHT, CHANGE, "eType");
+ checkNoChild(diffNode);
+
+ MatchNode subtitleMatchNode = (MatchNode)bookChildren.get(2);
+ assertEquals(2, subtitleMatchNode.getChildren().size());
+ diffNode = subtitleMatchNode.getChildren().get(0);
+ checkRefChange(diffNode, RIGHT, ADD, "eStructuralFeatures");
+ checkNoChild(diffNode);
+
+ diffNode = subtitleMatchNode.getChildren().get(1);
+ checkRefChange(diffNode, RIGHT, CHANGE, "eType");
+ checkNoChild(diffNode);
}
@Test
public void testGetChildren_Borrowable() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
+ MatchNode borrowableNode = (MatchNode)ePackageMatch.getChildren().get(2);
+ checkMatch(borrowableNode, LEFT, "Borrowable");
+ checkMatch(borrowableNode, RIGHT, "Lendable");
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackageData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
- Match borrowableCategory_Match = getMatchWithFeatureValue(ePackageData, "name", "Borrowable");
- TreeNode borrowableCategory_Match_Node = getTreeNode(ePackageMatch, borrowableCategory_Match);
- Collection<?> borrowable_MatchChildren = borrowableCategory_Match_Node.getChildren();
-
- assertEquals(3, borrowable_MatchChildren.size());
+ assertEquals(1, borrowableNode.getChildren().size());
+ TreeNode node = borrowableNode.getChildren().get(0);
+ checkAttChange(node, LEFT, CHANGE, "name", "Borrowable");
}
@Test
public void testGetChildren_BookCategory() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackageData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
- Match bookCategory_Match = getMatchWithFeatureValue(ePackageData, "name", "BookCategory");
- TreeNode bookCategory_Match_Node = getTreeNode(ePackageMatch, bookCategory_Match);
- Collection<?> bookCategory_MatchChildren = bookCategory_Match_Node.getChildren();
-
- Iterable<EObject> bookCategory_MatchChildrenData = transform(bookCategory_MatchChildren,
- TREE_NODE_DATA);
-
- ReferenceChange dictionaryReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildrenData, "name", "Dictionary");
- ReferenceChange encyclopediaReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildrenData, "name", "Encyclopedia");
- ReferenceChange mangaReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildrenData, "name", "Manga");
- ReferenceChange manhwaReferenceChange = getReferenceChangeWithFeatureValue(
- bookCategory_MatchChildrenData, "name", "Manhwa");
-
- TreeNode dictionaryReferenceChange_Node = getTreeNode(bookCategory_Match_Node,
- dictionaryReferenceChange);
- assertTrue(dictionaryReferenceChange_Node.getChildren().isEmpty());
-
- TreeNode encyclopediaReferenceChange_Node = getTreeNode(bookCategory_Match_Node,
- encyclopediaReferenceChange);
- assertTrue(encyclopediaReferenceChange_Node.getChildren().isEmpty());
-
- TreeNode mangaReferenceChange_Node = getTreeNode(bookCategory_Match_Node, mangaReferenceChange);
- assertTrue(mangaReferenceChange_Node.getChildren().isEmpty());
-
- TreeNode manhwaReferenceChange_Node = getTreeNode(bookCategory_Match_Node, manhwaReferenceChange);
- assertTrue(manhwaReferenceChange_Node.getChildren().isEmpty());
+ MatchNode bookCategoryNode = (MatchNode)ePackageMatch.getChildren().get(1);
+ checkMatch(bookCategoryNode, RIGHT, "BookCategory");
+ List<TreeNode> bookCategoryChildren = bookCategoryNode.getChildren();
+ assertEquals(4, bookCategoryChildren.size());
+
+ MatchNode matchNode = (MatchNode)bookCategoryChildren.get(0);
+ assertEquals(1, matchNode.getChildren().size());
+ Match match = matchNode.getMatch();
+ assertEquals("Encyclopedia", safeEGet(match.getLeft(), "name"));
+ DiffNode diffNode = (DiffNode)matchNode.getChildren().get(0);
+ assertTrue(diffNode.getChildren().isEmpty());
+ ReferenceChange diff = (ReferenceChange)diffNode.getDiff();
+ assertEquals(DifferenceKind.ADD, diff.getKind());
+ assertEquals(DifferenceSource.LEFT, diff.getSource());
+
+ matchNode = (MatchNode)bookCategoryChildren.get(1);
+ assertEquals(1, matchNode.getChildren().size());
+ match = matchNode.getMatch();
+ assertEquals("Dictionary", safeEGet(match.getLeft(), "name"));
+ diffNode = (DiffNode)matchNode.getChildren().get(0);
+ assertTrue(diffNode.getChildren().isEmpty());
+ diff = (ReferenceChange)diffNode.getDiff();
+ assertEquals(DifferenceKind.ADD, diff.getKind());
+ assertEquals(DifferenceSource.LEFT, diff.getSource());
+
+ matchNode = (MatchNode)bookCategoryChildren.get(2);
+ assertEquals(1, matchNode.getChildren().size());
+ match = matchNode.getMatch();
+ assertEquals("Manga", safeEGet(match.getRight(), "name"));
+ diffNode = (DiffNode)matchNode.getChildren().get(0);
+ assertTrue(diffNode.getChildren().isEmpty());
+ diff = (ReferenceChange)diffNode.getDiff();
+ assertEquals(DifferenceKind.ADD, diff.getKind());
+ assertEquals(DifferenceSource.RIGHT, diff.getSource());
+
+ matchNode = (MatchNode)bookCategoryChildren.get(3);
+ assertEquals(1, matchNode.getChildren().size());
+ match = matchNode.getMatch();
+ assertEquals("Manhwa", safeEGet(match.getRight(), "name"));
+ diffNode = (DiffNode)matchNode.getChildren().get(0);
+ assertTrue(diffNode.getChildren().isEmpty());
+ diff = (ReferenceChange)diffNode.getDiff();
+ assertEquals(DifferenceKind.ADD, diff.getKind());
+ assertEquals(DifferenceSource.RIGHT, diff.getSource());
}
@Test
public void testGetChildren_Magazine1() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
-
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- Collection<?> magazineChildren = null;
- TreeNode referenceChange_Node = null;
- for (ReferenceChange referenceChange : filter(ePackage_MatchChildrenData, ReferenceChange.class)) {
- EClass eClass = (EClass)referenceChange.getValue();
- if ("Magazine".equals(eClass.getName())
- && "CirculatingItem".equals(eClass.getESuperTypes().get(0).getName())) {
- referenceChange_Node = getTreeNode(ePackageMatch, referenceChange);
- magazineChildren = referenceChange_Node.getChildren();
- assertEquals(3, magazineChildren.size());
- break;
- }
- }
-
- Iterable<EObject> magazineChildrenData = transform(magazineChildren, TREE_NODE_DATA);
-
- ReferenceChange magazineSuperTypeChange = getReferenceChangeWithFeatureValue(magazineChildrenData,
- "name", "CirculatingItem");
- TreeNode magazineSuperTypeChange_Node = getTreeNode(referenceChange_Node, magazineSuperTypeChange);
- assertTrue(magazineSuperTypeChange_Node.getChildren().isEmpty());
-
- ReferenceChange magazineSFChange1 = getReferenceChangeWithFeatureValue(magazineChildrenData, "name",
- "pages");
- TreeNode magazineSFChange1_Node = getTreeNode(referenceChange_Node, magazineSFChange1);
- assertEquals(1, magazineSFChange1_Node.getChildren().size());
-
- ReferenceChange magazineSFChange2 = getReferenceChangeWithFeatureValue(magazineChildrenData, "name",
- "title");
- TreeNode magazineSFChange2_Node = getTreeNode(referenceChange_Node, magazineSFChange2);
- assertEquals(1, magazineSFChange2_Node.getChildren().size());
+ MatchNode magazine1Node = (MatchNode)ePackageMatch.getChildren().get(6);
+ checkMatch(magazine1Node, LEFT, "Magazine");
+ assertEquals(4, magazine1Node.getChildren().size());
+
+ DiffNode node = (DiffNode)magazine1Node.getChildren().get(0);
+ checkRefChange(node, LEFT, ADD, "eClassifiers");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ node = (DiffNode)magazine1Node.getChildren().get(1);
+ checkRefChange(node, LEFT, ADD, "eSuperTypes");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ MatchNode matchNode = (MatchNode)magazine1Node.getChildren().get(2);
+ assertEquals(2, matchNode.getChildren().size());
+ node = (DiffNode)matchNode.getChildren().get(0);
+ checkRefChange(node, LEFT, ADD, "eStructuralFeatures");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+ node = (DiffNode)matchNode.getChildren().get(1);
+ checkRefChange(node, LEFT, CHANGE, "eType");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ matchNode = (MatchNode)magazine1Node.getChildren().get(3);
+ assertEquals(2, matchNode.getChildren().size());
+ node = (DiffNode)matchNode.getChildren().get(0);
+ checkRefChange(node, LEFT, ADD, "eStructuralFeatures");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+ node = (DiffNode)matchNode.getChildren().get(1);
+ checkRefChange(node, LEFT, CHANGE, "eType");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
}
@Test
public void testGetChildren_Magazine2() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- Collection<?> magazineChildren = null;
- TreeNode referenceChange_Node = null;
- for (ReferenceChange referenceChange : filter(ePackage_MatchChildrenData, ReferenceChange.class)) {
- EClass eClass = (EClass)referenceChange.getValue();
- if ("Magazine".equals(eClass.getName())
- && "Periodical".equals(eClass.getESuperTypes().get(0).getName())) {
- referenceChange_Node = getTreeNode(ePackageMatch, referenceChange);
- magazineChildren = referenceChange_Node.getChildren();
- assertEquals(1, magazineChildren.size());
- break;
- }
- }
-
- Iterable<EObject> magazineChildrenData = transform(magazineChildren, TREE_NODE_DATA);
-
- ReferenceChange magazineSuperTypeChange = getReferenceChangeWithFeatureValue(magazineChildrenData,
- "name", "Periodical");
- TreeNode magazineSuperTypeChange_Node = getTreeNode(referenceChange_Node, magazineSuperTypeChange);
- assertTrue(magazineSuperTypeChange_Node.getChildren().isEmpty());
+ MatchNode magazine2Node = (MatchNode)ePackageMatch.getChildren().get(8);
+ checkMatch(magazine2Node, RIGHT, "Magazine");
+ assertEquals(2, magazine2Node.getChildren().size());
+ DiffNode node = (DiffNode)magazine2Node.getChildren().get(0);
+ checkRefChange(node, RIGHT, ADD, "eClassifiers");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ node = (DiffNode)magazine2Node.getChildren().get(1);
+ checkRefChange(node, RIGHT, ADD, "eSuperTypes");
+ checkNoChild(node);
+ assertNotNull(node.getDiff().getConflict());
}
@Test
public void testGetChildren_Periodical() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- ReferenceChange periodical_ReferenceChange = getReferenceChangeWithFeatureValue(
- ePackage_MatchChildrenData, "name", "Periodical");
- TreeNode periodical_ReferenceChange_Node = getTreeNode(ePackageMatch, periodical_ReferenceChange);
-
- Collection<?> periodical_ReferenceChangeChildren = periodical_ReferenceChange_Node.getChildren();
-
- assertEquals(5, periodical_ReferenceChangeChildren.size());
-
- Iterable<EObject> periodical_ReferenceChangeChildrenData = transform(
- periodical_ReferenceChangeChildren, TREE_NODE_DATA);
-
- ReferenceChange issuesPerYearChange = getReferenceChangeWithFeatureValue(
- periodical_ReferenceChangeChildrenData, "name", "issuesPerYear");
-
- ReferenceChange itemChange = getReferenceChangeWithFeatureValue(
- periodical_ReferenceChangeChildrenData, "name", "Item");
- ReferenceChange titledItemChange = getReferenceChangeWithFeatureValue(
- periodical_ReferenceChangeChildrenData, "name", "TitledItem");
-
- TreeNode issuesPerYearChange_Node = getTreeNode(periodical_ReferenceChange_Node, issuesPerYearChange);
- Collection<?> issuesPerYearChildren = issuesPerYearChange_Node.getChildren();
- assertEquals(1, issuesPerYearChildren.size());
-
- TreeNode issuePerYearChildNode = (TreeNode)issuesPerYearChildren.iterator().next();
- ReferenceChange issuePerYearChild = (ReferenceChange)issuePerYearChildNode.getData();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, issuePerYearChild.getReference());
-
- TreeNode itemChange_Node = getTreeNode(periodical_ReferenceChange_Node, itemChange);
- assertTrue(itemChange_Node.getChildren().isEmpty());
-
- TreeNode titledItemChange_Node = getTreeNode(periodical_ReferenceChange_Node, titledItemChange);
- assertTrue(titledItemChange_Node.getChildren().isEmpty());
+ MatchNode periodicalNode = (MatchNode)ePackageMatch.getChildren().get(7);
+ checkMatch(periodicalNode, RIGHT, "Periodical");
+ List<TreeNode> periodicalChildren = periodicalNode.getChildren();
+ assertEquals(5, periodicalChildren.size());
+
+ TreeNode node0 = periodicalChildren.get(0);
+ checkRefChange(node0, LEFT, DELETE, "eClassifiers");
+ checkNoChild(node0);
+ assertNotNull(((Diff)node0.getData()).getConflict());
+ TreeNode node1 = periodicalChildren.get(1);
+ checkRefChange(node1, RIGHT, ADD, "eSuperTypes");
+ checkNoChild(node1);
+ assertNotNull(((Diff)node1.getData()).getConflict());
+ assertSame(((Diff)node0.getData()).getConflict(), ((Diff)node1.getData()).getConflict());
+ TreeNode node2 = periodicalChildren.get(2);
+ checkRefChange(node2, LEFT, DELETE, "eSuperTypes");
+ checkNoChild(node2);
+
+ TreeNode node3 = periodicalChildren.get(3);
+ assertTrue(node3 instanceof MatchNode);
+ assertEquals(2, node3.getChildren().size());
+ DiffNode childNode = (DiffNode)node3.getChildren().get(0);
+ checkRefChange(childNode, LEFT, DELETE, "eStructuralFeatures");
+ checkNoChild(childNode);
+ assertNull(childNode.getDiff().getConflict());
+
+ childNode = (DiffNode)node3.getChildren().get(1);
+ checkRefChange(childNode, LEFT, CHANGE, "eType");
+ checkNoChild(childNode);
+ assertNull(childNode.getDiff().getConflict());
+
+ TreeNode node4 = periodicalChildren.get(4);
+ assertTrue(node4 instanceof MatchNode);
+ assertEquals(4, node4.getChildren().size());
+ childNode = (DiffNode)node4.getChildren().get(0);
+ checkRefChange(childNode, LEFT, DELETE, "eStructuralFeatures");
+ checkNoChild(childNode);
+ Conflict conflict = childNode.getDiff().getConflict();
+ assertNotNull(conflict);
+ assertEquals(PSEUDO, conflict.getKind());
+
+ childNode = (DiffNode)node4.getChildren().get(1);
+ checkRefChange(childNode, RIGHT, DELETE, "eStructuralFeatures");
+ checkNoChild(childNode);
+ assertNotNull(childNode.getDiff().getConflict());
+ assertSame(conflict, childNode.getDiff().getConflict());
+
+ childNode = (DiffNode)node4.getChildren().get(2);
+ checkRefChange(childNode, LEFT, CHANGE, "eType");
+ checkNoChild(childNode);
+ Conflict conflict2 = childNode.getDiff().getConflict();
+ assertNotNull(conflict2);
+ assertEquals(PSEUDO, conflict2.getKind());
+ assertNotSame(conflict, conflict2);
+
+ childNode = (DiffNode)node4.getChildren().get(3);
+ checkRefChange(childNode, RIGHT, CHANGE, "eType");
+ checkNoChild(childNode);
+ assertNotNull(childNode.getDiff().getConflict());
+ assertSame(conflict2, childNode.getDiff().getConflict());
}
@Test
public void testGetChildren_Person() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
-
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- Match person_Match = getMatchWithFeatureValue(ePackage_MatchChildrenData, "name", "Person");
- TreeNode person_Match_Node = getTreeNode(ePackageMatch, person_Match);
- Collection<?> person_MatchChildren = person_Match_Node.getChildren();
-
- assertEquals(3, person_MatchChildren.size());
-
- Iterable<EObject> person_MatchChildrenData = transform(person_MatchChildren, TREE_NODE_DATA);
-
- ReferenceChange firstNameChange = getReferenceChangeWithFeatureValue(person_MatchChildrenData, "name",
- "firstName");
- TreeNode firstNameChange_Node = getTreeNode(person_Match_Node, firstNameChange);
- Collection<?> firstNameChildren = firstNameChange_Node.getChildren();
- assertEquals(1, firstNameChildren.size());
- Iterable<EObject> firstNameChildrenData = transform(firstNameChildren, TREE_NODE_DATA);
- ReferenceChange firstNameChild = (ReferenceChange)firstNameChildrenData.iterator().next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, firstNameChild.getReference());
-
- ReferenceChange fullNameChange = getReferenceChangeWithFeatureValue(person_MatchChildrenData, "name",
- "fullName");
- TreeNode fullNameChange_Node = getTreeNode(person_Match_Node, fullNameChange);
- Collection<?> fullNameChildren = fullNameChange_Node.getChildren();
- assertEquals(1, fullNameChildren.size());
- Iterable<EObject> fullNameChildrenData = transform(fullNameChildren, TREE_NODE_DATA);
- ReferenceChange fullNameChild = (ReferenceChange)fullNameChildrenData.iterator().next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, fullNameChild.getReference());
-
- ReferenceChange lastNameChange = getReferenceChangeWithFeatureValue(person_MatchChildrenData, "name",
- "lastName");
- TreeNode lastNameChange_Node = getTreeNode(person_Match_Node, lastNameChange);
- Collection<?> lastNameChildren = lastNameChange_Node.getChildren();
- assertEquals(2, lastNameChildren.size());
- Iterable<EObject> lastNameChildrenData = transform(lastNameChildren, TREE_NODE_DATA);
- Iterator<?> lastNameiterator = lastNameChildrenData.iterator();
- ReferenceChange lastName1stChild = (ReferenceChange)lastNameiterator.next();
- AttributeChange lastName2ndChild = (AttributeChange)lastNameiterator.next();
- assertEquals(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE, lastName1stChild.getReference());
- assertEquals(EcorePackage.Literals.ENAMED_ELEMENT__NAME, lastName2ndChild.getAttribute());
+ MatchNode personNode = (MatchNode)ePackageMatch.getChildren().get(5);
+ checkMatch(personNode, LEFT, "Person");
+ List<TreeNode> personChildren = personNode.getChildren();
+ assertEquals(3, personChildren.size());
+
+ TreeNode fullNameNode = personChildren.get(0);
+ assertEquals(2, fullNameNode.getChildren().size());
+ DiffNode diffNode = (DiffNode)fullNameNode.getChildren().get(0);
+ checkRefChange(diffNode, LEFT, ADD, "eStructuralFeatures");
+ checkNoChild(diffNode);
+ assertNull(diffNode.getDiff().getConflict());
+
+ diffNode = (DiffNode)fullNameNode.getChildren().get(1);
+ checkRefChange(diffNode, LEFT, CHANGE, "eType");
+ checkNoChild(diffNode);
+ assertNull(diffNode.getDiff().getConflict());
+
+ TreeNode firstNameNode = personChildren.get(1);
+ assertEquals(2, firstNameNode.getChildren().size());
+ diffNode = (DiffNode)firstNameNode.getChildren().get(0);
+ checkRefChange(diffNode, LEFT, DELETE, "eStructuralFeatures");
+ checkNoChild(diffNode);
+ assertNull(diffNode.getDiff().getConflict());
+
+ diffNode = (DiffNode)firstNameNode.getChildren().get(1);
+ checkRefChange(diffNode, LEFT, CHANGE, "eType");
+ checkNoChild(diffNode);
+ assertNull(diffNode.getDiff().getConflict());
+
+ TreeNode lastNameNode = personChildren.get(2);
+ assertEquals(3, lastNameNode.getChildren().size());
+ diffNode = (DiffNode)lastNameNode.getChildren().get(0);
+ checkRefChange(diffNode, LEFT, DELETE, "eStructuralFeatures");
+ checkNoChild(diffNode);
+ Conflict conflict = diffNode.getDiff().getConflict();
+ assertNotNull(conflict);
+
+ diffNode = (DiffNode)lastNameNode.getChildren().get(1);
+ checkRefChange(diffNode, LEFT, CHANGE, "eType");
+ checkNoChild(diffNode);
+ assertNull(diffNode.getDiff().getConflict());
+
+ diffNode = (DiffNode)lastNameNode.getChildren().get(2);
+ checkAttChange(diffNode, RIGHT, CHANGE, "name", "familyName");
+ checkNoChild(diffNode);
+ assertSame(conflict, diffNode.getDiff().getConflict());
}
@Test
public void testGetChildren_TitledItem() throws IOException {
TreeNode ePackageMatch = getEcoreA1_EPackageMatch();
+ MatchNode titledItemNode = (MatchNode)ePackageMatch.getChildren().get(9);
+ checkMatch(titledItemNode, RIGHT, "TitledItem");
+ assertEquals(2, titledItemNode.getChildren().size());
+ DiffNode node = (DiffNode)titledItemNode.getChildren().get(0);
+ checkRefChange(node, RIGHT, ADD, "eClassifiers");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ MatchNode titleMatchNode = (MatchNode)titledItemNode.getChildren().get(1);
+ assertEquals(2, titleMatchNode.getChildren().size());
+ node = (DiffNode)titleMatchNode.getChildren().get(0);
+ checkRefChange(node, RIGHT, ADD, "eStructuralFeatures");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+
+ node = (DiffNode)titleMatchNode.getChildren().get(1);
+ checkRefChange(node, RIGHT, CHANGE, "eType");
+ checkNoChild(node);
+ assertNull(node.getDiff().getConflict());
+ }
+
+ private Object safeEGet(EObject o, String name) {
+ return o.eGet(o.eClass().getEStructuralFeature(name));
+ }
+
+ protected void checkMatch(MatchNode node, DifferenceSource side, String value) {
+ assertEquals(value, safeEGet(MatchUtil.getMatchedObject(node.getMatch(), side), "name"));
+ }
+
+ protected void checkDiffNode(TreeNode node, Class<?> clazz, DifferenceSource src, DifferenceKind kind) {
+ assertTrue(node instanceof DiffNode);
+ Diff diff = ((DiffNode)node).getDiff();
+ assertTrue(clazz.isAssignableFrom(diff.getClass()));
+ assertSame(src, diff.getSource());
+ assertSame(kind, diff.getKind());
+ }
+
+ protected void checkRefChange(TreeNode node, DifferenceSource src, DifferenceKind kind, String refName) {
+ checkDiffNode(node, ReferenceChange.class, src, kind);
+ ReferenceChange diff = (ReferenceChange)((DiffNode)node).getDiff();
+ assertEquals(refName, diff.getReference().getName());
+ }
+
+ protected void checkAttChange(TreeNode node, DifferenceSource src, DifferenceKind kind, String refName,
+ Object value) {
+ checkDiffNode(node, AttributeChange.class, src, kind);
+ AttributeChange diff = (AttributeChange)((DiffNode)node).getDiff();
+ assertEquals(refName, diff.getAttribute().getName());
+ assertEquals(value, diff.getValue());
+ }
- Collection<?> ePackage_MatchChildren = ePackageMatch.getChildren();
- Iterable<EObject> ePackage_MatchChildrenData = transform(ePackage_MatchChildren, TREE_NODE_DATA);
-
- ReferenceChange titledItem_ReferenceChange = getReferenceChangeWithFeatureValue(
- ePackage_MatchChildrenData, "name", "TitledItem");
- TreeNode titledItem_ReferenceChange_Node = getTreeNode(ePackageMatch, titledItem_ReferenceChange);
- Collection<?> titledItem_ReferenceChangeChildren = titledItem_ReferenceChange_Node.getChildren();
- assertEquals(1, titledItem_ReferenceChangeChildren.size());
-
- Iterable<EObject> titledItem_ReferenceChangeChildrenData = transform(
- titledItem_ReferenceChangeChildren, TREE_NODE_DATA);
- ReferenceChange title_Change = (ReferenceChange)titledItem_ReferenceChangeChildrenData.iterator()
- .next();
- TreeNode title_Change_Node = getTreeNode(titledItem_ReferenceChange_Node, title_Change);
- Collection<?> title_ChangeChildren = title_Change_Node.getChildren();
- assertEquals(1, title_ChangeChildren.size());
-
- Iterable<EObject> title_ChangeChildrenData = transform(title_ChangeChildren, TREE_NODE_DATA);
- ReferenceChange eType_Change = (ReferenceChange)title_ChangeChildrenData.iterator().next();
- TreeNode eType_Change_Node = getTreeNode(title_Change_Node, eType_Change);
- assertTrue(eType_Change_Node.getChildren().isEmpty());
+ protected void checkNoChild(TreeNode node) {
+ assertTrue(node.getChildren().isEmpty());
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
index 59af3e592..432829606 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/META-INF/MANIFEST.MF
@@ -46,6 +46,7 @@ Export-Package: org.eclipse.emf.compare.rcp.ui,
org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.extender;x-friends:="org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl;x-friends:="org.eclipse.emf.compare.ide.ui,org.eclipse.emf.compare.diagram.papyrus.tests,org.eclipse.emf.compare.uml2.rcp.ui.tests",
org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider;x-friends:="org.eclipse.emf.compare.ide.ui,org.eclipse.emf.compare.diagram.papyrus.tests,org.eclipse.emf.compare.uml2.rcp.ui.tests",
+ org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes,
org.eclipse.emf.compare.rcp.ui.internal.util;x-friends:="org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.rcp.ui.mergeviewer,
org.eclipse.emf.compare.rcp.ui.mergeviewer.item,
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.properties b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.properties
index d1e505401..e2497b1f6 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.properties
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.properties
@@ -18,13 +18,7 @@ emf.compare.side.groups = By Side
emf.compare.side.groups.description = Differences will be grouped by the side on which they have been detected (Left, Right or Conflict)
emf.compare.resource.group = By Resource
emf.compare.resource.group.description = Differences will be grouped by the resource in which they have been detected.
-emf.compare.empty.resource.mappings.filter = Empty resource mappings
-emf.compare.empty.resource.mappings.filter.description = Filters out resource mappings without differences
-emf.compare.feature.map.filter = Feature map differences
-emf.compare.feature.map.filter.description = Filters out differences that apply on EFEatureMapEntry type.
-emf.compare.pseudo.conflicts.differences.filter = Pseudo conflicts differences
-emf.compare.pseudo.conflicts.differences.filter.description = Filters out pseudo conflicts. Only applies to 3-ways comparison.
-emf.compare.identical.elements.filter = Identical elements
-emf.compare.identical.elements.filter.description = Filters out elements without difference.
+emf.compare.technicalities.filter = Technical elements
+emf.compare.technicalities.filter.description = Filters technical elements (pseudo conflicts, identical elements, feature maps and empty match resources).
emf.compare.cascading.differences.filter = Cascading differences
-emf.compare.cascading.differences.filter.description = Filters out differences contained by another difference, recursively. Does not apply to conflictual differences.
+emf.compare.cascading.differences.filter.description = Filters out differences that are part of the addition or deletion of a model element and all its children. Only the 'root' addition or deletion is left unfiltered.
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
index 7331d4180..f6518afd3 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/plugin.xml
@@ -51,34 +51,16 @@
point="org.eclipse.emf.compare.rcp.ui.filters">
<filter
activeByDefault="true"
- class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.EmptyMatchedResourcesFilter"
- description="%emf.compare.empty.resource.mappings.filter.description"
- label="%emf.compare.empty.resource.mappings.filter">
- </filter>
- <filter
- activeByDefault="true"
- class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.FeatureMapDifferencesFilter"
- description="%emf.compare.feature.map.filter.description"
- label="%emf.compare.feature.map.filter">
- </filter>
- <filter
- activeByDefault="true"
- class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.PseudoConflictsFilter"
- description="%emf.compare.pseudo.conflicts.differences.filter.description"
- label="%emf.compare.pseudo.conflicts.differences.filter">
- </filter>
- <filter
- activeByDefault="true"
- class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.IdenticalElementsFilter"
- description="%emf.compare.identical.elements.filter.description"
- label="%emf.compare.identical.elements.filter">
- </filter>
- <filter
- activeByDefault="true"
class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter"
description="%emf.compare.cascading.differences.filter.description"
label="%emf.compare.cascading.differences.filter">
</filter>
+ <filter
+ activeByDefault="true"
+ class="org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter"
+ description="%emf.compare.technicalities.filter.description"
+ label="%emf.compare.technicalities.filter">
+ </filter>
</extension>
<extension
point="org.eclipse.emf.compare.rcp.ui.accessorFactory">
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/CascadingDifferencesFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/CascadingDifferencesFilter.java
index dc21be95b..eb9be9869 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/CascadingDifferencesFilter.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/CascadingDifferencesFilter.java
@@ -11,23 +11,23 @@
package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
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.Iterators.any;
-import static com.google.common.collect.Iterators.transform;
+import static com.google.common.base.Predicates.or;
+import static org.eclipse.emf.compare.DifferenceKind.ADD;
+import static org.eclipse.emf.compare.DifferenceKind.DELETE;
+import static org.eclipse.emf.compare.DifferenceKind.MOVE;
+import static org.eclipse.emf.compare.DifferenceSource.LEFT;
+import static org.eclipse.emf.compare.DifferenceSource.RIGHT;
+import static org.eclipse.emf.compare.utils.EMFComparePredicates.CONTAINMENT_REFERENCE_CHANGE;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
import com.google.common.base.Predicate;
-import java.util.Iterator;
-
-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.ResourceAttachmentChange;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
+import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
@@ -49,48 +49,68 @@ public class CascadingDifferencesFilter extends AbstractDifferenceFilter {
if (input instanceof TreeNode) {
TreeNode treeNode = (TreeNode)input;
EObject data = treeNode.getData();
- if (data instanceof Diff && ofKind(DifferenceKind.MOVE).apply((Diff)data)) {
- ret = false;
- } else {
- TreeNode parent = treeNode.getParent();
- final EObject parentData;
- if (parent != null) {
- parentData = parent.getData();
- } else {
- parentData = null;
- }
- if (parentData instanceof Diff
- && !((parentData instanceof ResourceAttachmentChange)
- || ofKind(DifferenceKind.MOVE).apply((Diff)parentData))
- && data instanceof Diff) {
- Iterator<EObject> eAllDataContents = transform(treeNode.eAllContents(),
- IDifferenceGroup.TREE_NODE_DATA);
- return CASCADING_DIFF.apply(data) && !any(eAllDataContents, not(CASCADING_DIFF));
+ if (data instanceof Diff && !(data instanceof ResourceAttachmentChange)) {
+ Diff diff = (Diff)data;
+ if (diff.getKind() != MOVE && (diff.getConflict() == null)) {
+ TreeNode parent = treeNode.getParent();
+ if (parent != null && parent.getData() instanceof Match) {
+ Match match = (Match)parent.getData();
+ if (match.eContainer() instanceof Match) {
+ Match parentMatch = (Match)match.eContainer();
+ if (isAddOrDeleteMatch(parentMatch, diff.getSource())) {
+ ret = true;
+ } else if (isAddOrDeleteMatch(match, diff.getSource())) {
+ ret = !and(or(CONTAINMENT_REFERENCE_CHANGE,
+ REFINED_BY_CONTAINMENT_REF_CHANGE), ofKind(ADD, DELETE))
+ .apply(diff);
+ }
+ } else if (isAddOrDeleteMatch(match, diff.getSource())) {
+ ret = !and(
+ or(CONTAINMENT_REFERENCE_CHANGE, REFINED_BY_CONTAINMENT_REF_CHANGE),
+ ofKind(ADD, DELETE)).apply(diff);
+ }
+ }
}
}
}
return ret;
}
- };
- /**
- * Predicate to know if the given diff is a conflictual diff.
- */
- private static final Predicate<EObject> IS_NON_CONFLICTUAL_DIFF = new Predicate<EObject>() {
- public boolean apply(EObject eObject) {
- if (eObject instanceof Diff) {
- Conflict conflict = ((Diff)eObject).getConflict();
- return conflict == null || ConflictKind.PSEUDO == conflict.getKind();
+ /**
+ * Indicate whether a Match is that of an object that was either added or deleted on the given side.
+ *
+ * @param match
+ * The match
+ * @param side
+ * The side
+ * @return <code>true</code> if the matched object is present on side but not on origin or vice-versa.
+ */
+ protected boolean isAddOrDeleteMatch(Match match, DifferenceSource side) {
+ if (match.getComparison().isThreeWay()) {
+ return (MatchUtil.getMatchedObject(match, side) == null) != (match.getOrigin() == null);
+ }
+ return (MatchUtil.getMatchedObject(match, side) == null) != (MatchUtil.getMatchedObject(match,
+ opposite(side)) == null);
+ }
+
+ protected DifferenceSource opposite(DifferenceSource side) {
+ switch (side) {
+ case LEFT:
+ return RIGHT;
+ case RIGHT:
+ return LEFT;
+ default:
+ throw new IllegalArgumentException("Source value not supported: " + side); //$NON-NLS-1$
}
- return false;
}
};
- /**
- * Predicate to know if the given diff respects the requirements of a cascading diff.
- */
- private static final Predicate<EObject> CASCADING_DIFF = and(IS_NON_CONFLICTUAL_DIFF,
- not(instanceOf(ResourceAttachmentChange.class)));
+ private static final Predicate<Diff> REFINED_BY_CONTAINMENT_REF_CHANGE = new Predicate<Diff>() {
+ public boolean apply(Diff input) {
+ return input.getPrimeRefining() != null
+ && CONTAINMENT_REFERENCE_CHANGE.apply(input.getPrimeRefining());
+ }
+ };
/**
* {@inheritDoc}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/EmptyMatchedResourcesFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/EmptyMatchedResourcesFilter.java
deleted file mode 100644
index 93c80e660..000000000
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/EmptyMatchedResourcesFilter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
-
-import com.google.common.base.Predicate;
-
-import org.eclipse.emf.compare.MatchResource;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * A filter used by default that filtered out matched elements.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 4.0
- */
-public class EmptyMatchedResourcesFilter extends AbstractDifferenceFilter {
-
- /**
- * The predicate use by this filter when it is selected.
- */
- private static final Predicate<? super EObject> PREDICATE_WHEN_SELECTED = new Predicate<EObject>() {
- public boolean apply(EObject input) {
- boolean ret = false;
- if (input instanceof TreeNode) {
- TreeNode treeNode = (TreeNode)input;
- if (treeNode.getData() instanceof MatchResource) {
- ret = treeNode.getChildren().isEmpty();
- }
- }
- return ret;
- }
- };
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter#getPredicateWhenSelected()
- */
- @Override
- public Predicate<? super EObject> getPredicateWhenSelected() {
- return PREDICATE_WHEN_SELECTED;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/FeatureMapDifferencesFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/FeatureMapDifferencesFilter.java
deleted file mode 100644
index 6e6ef0ba9..000000000
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/FeatureMapDifferencesFilter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
-
-import com.google.common.base.Predicate;
-
-import org.eclipse.emf.compare.FeatureMapChange;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * A filter used by default that filtered out differences that apply on FeatureMapChanges.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 4.0
- */
-public class FeatureMapDifferencesFilter extends AbstractDifferenceFilter {
-
- /**
- * The predicate use by this filter when it is selected.
- */
- private static final Predicate<? super EObject> PREDICATE_WHEN_SELECTED = new Predicate<EObject>() {
- public boolean apply(EObject input) {
- boolean ret = false;
- if (input instanceof TreeNode) {
- EObject data = ((TreeNode)input).getData();
- if (data instanceof FeatureMapChange) {
- ret = ((FeatureMapChange)data).getEquivalence() != null;
- }
- }
- return ret;
- }
- };
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter#getPredicateWhenSelected()
- */
- @Override
- public Predicate<? super EObject> getPredicateWhenSelected() {
- return PREDICATE_WHEN_SELECTED;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/IdenticalElementsFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/IdenticalElementsFilter.java
deleted file mode 100644
index a82b27d74..000000000
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/IdenticalElementsFilter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
-
-import static com.google.common.collect.Iterators.any;
-
-import com.google.common.base.Predicate;
-
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * A filter used by default that filtered out identical elements.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 4.0
- */
-public class IdenticalElementsFilter extends AbstractDifferenceFilter {
-
- /**
- * The predicate use by this filter when it is selected.
- */
- private static final Predicate<? super EObject> PREDICATE_WHEN_SELECTED = new Predicate<EObject>() {
- public boolean apply(EObject input) {
- if (input instanceof TreeNode) {
- TreeNode treeNode = (TreeNode)input;
- EObject data = treeNode.getData();
- if (data instanceof Match) {
- return !any(treeNode.eAllContents(), DATA_IS_DIFF);
- }
- }
- return false;
- }
- };
-
- /**
- * Predicate to know if the given TreeNode is a diff.
- */
- private static final Predicate<EObject> DATA_IS_DIFF = new Predicate<EObject>() {
- public boolean apply(EObject treeNode) {
- return treeNode instanceof TreeNode && ((TreeNode)treeNode).getData() instanceof Diff;
- }
- };
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter#getPredicateWhenSelected()
- */
- @Override
- public Predicate<? super EObject> getPredicateWhenSelected() {
- return PREDICATE_WHEN_SELECTED;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/PseudoConflictsFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/PseudoConflictsFilter.java
deleted file mode 100644
index 2fbcf0af9..000000000
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/PseudoConflictsFilter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
-
-import com.google.common.base.Predicate;
-
-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.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
-import org.eclipse.emf.compare.scope.IComparisonScope;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.tree.TreeNode;
-
-/**
- * A filter used by default that filtered out pseudo conflicts differences.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 4.0
- */
-public class PseudoConflictsFilter extends AbstractDifferenceFilter {
-
- /**
- * The predicate use by this filter when it is selected.
- */
- private static final Predicate<? super EObject> PREDICATE_WHEN_SELECTED = new Predicate<EObject>() {
- public boolean apply(EObject input) {
- boolean ret = false;
- if (input instanceof TreeNode) {
- TreeNode treeNode = (TreeNode)input;
- EObject data = treeNode.getData();
- if (data instanceof Diff) {
- Diff diff = (Diff)data;
- Conflict conflict = diff.getConflict();
- ret = conflict != null && conflict.getKind() == ConflictKind.PSEUDO;
- }
- }
- return ret;
- }
- };
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter#isEnabled(org.eclipse.emf.compare.scope.IComparisonScope,
- * org.eclipse.emf.compare.Comparison)
- */
- @Override
- public boolean isEnabled(IComparisonScope scope, Comparison comparison) {
- if (comparison != null && comparison.isThreeWay()) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter#getPredicateWhenSelected()
- */
- @Override
- public Predicate<? super EObject> getPredicateWhenSelected() {
- return PREDICATE_WHEN_SELECTED;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/TechnicalitiesFilter.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/TechnicalitiesFilter.java
new file mode 100644
index 000000000..4c7a7988e
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/filters/impl/TechnicalitiesFilter.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl;
+
+import static com.google.common.collect.Iterators.any;
+
+import com.google.common.base.Predicate;
+
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.FeatureMapChange;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.tree.TreeNode;
+
+/**
+ * <p>
+ * A filter used by default that rejects all 'technical' differences. The technical differences are the diffs
+ * that apply on empty {@link MatchResource}s, on {@link FeatureMap} diffs, on identical elements and on
+ * pseudo-conflicts.
+ * </p>
+ * This filter aggregates the former 4 corresponding filters.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ */
+public class TechnicalitiesFilter extends AbstractDifferenceFilter {
+
+ /**
+ * The predicate use by this filter when it is selected.
+ */
+ private static final Predicate<? super EObject> PREDICATE_WHEN_SELECTED = new Predicate<EObject>() {
+ public boolean apply(EObject input) {
+ return PREDICATE_EMPTY_MATCH_RESOURCES.apply(input) || PREDICATE_FEATURE_MAP.apply(input)
+ || PREDICATE_IDENTICAL_ELEMENTS.apply(input) || PREDICATE_PSEUDO_CONFLICT.apply(input);
+ }
+ };
+
+ /**
+ * The predicate use to filter empty match resources.
+ */
+ private static final Predicate<? super EObject> PREDICATE_EMPTY_MATCH_RESOURCES = new Predicate<EObject>() {
+ public boolean apply(EObject input) {
+ boolean ret = false;
+ if (input instanceof TreeNode) {
+ TreeNode treeNode = (TreeNode)input;
+ if (treeNode.getData() instanceof MatchResource) {
+ ret = treeNode.getChildren().isEmpty();
+ }
+ }
+ return ret;
+ }
+ };
+
+ /**
+ * The predicate use to filter feature maps.
+ */
+ private static final Predicate<? super EObject> PREDICATE_FEATURE_MAP = new Predicate<EObject>() {
+ public boolean apply(EObject input) {
+ boolean ret = false;
+ if (input instanceof TreeNode) {
+ EObject data = ((TreeNode)input).getData();
+ if (data instanceof FeatureMapChange) {
+ ret = ((FeatureMapChange)data).getEquivalence() != null;
+ }
+ }
+ return ret;
+ }
+ };
+
+ /**
+ * The predicate use to filter pseudo conflicts.
+ */
+ private static final Predicate<? super EObject> PREDICATE_PSEUDO_CONFLICT = new Predicate<EObject>() {
+ public boolean apply(EObject input) {
+ boolean ret = false;
+ if (input instanceof TreeNode) {
+ TreeNode treeNode = (TreeNode)input;
+ EObject data = treeNode.getData();
+ if (data instanceof Diff) {
+ Diff diff = (Diff)data;
+ if (diff.getMatch().getComparison().isThreeWay()) {
+ Conflict conflict = diff.getConflict();
+ ret = conflict != null && conflict.getKind() == ConflictKind.PSEUDO;
+ }
+ }
+ }
+ return ret;
+ }
+ };
+
+ /**
+ * The predicate use to filter identical elements.
+ */
+ private static final Predicate<? super EObject> PREDICATE_IDENTICAL_ELEMENTS = new Predicate<EObject>() {
+ public boolean apply(EObject input) {
+ if (input instanceof TreeNode) {
+ TreeNode treeNode = (TreeNode)input;
+ EObject data = treeNode.getData();
+ if (data instanceof Match) {
+ return !any(treeNode.eAllContents(), DATA_IS_DIFF);
+ }
+ }
+ return false;
+ }
+ };
+
+ /**
+ * Predicate to know if the given TreeNode is a diff.
+ */
+ private static final Predicate<EObject> DATA_IS_DIFF = new Predicate<EObject>() {
+ public boolean apply(EObject treeNode) {
+ return treeNode instanceof TreeNode && ((TreeNode)treeNode).getData() instanceof Diff;
+ }
+ };
+
+ @Override
+ public Predicate<? super EObject> getPredicateWhenSelected() {
+ return PREDICATE_WHEN_SELECTED;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/BasicDifferenceGroupImpl.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/BasicDifferenceGroupImpl.java
index 9db1aa329..ff5af1fdc 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/BasicDifferenceGroupImpl.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/BasicDifferenceGroupImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2015 Obeo.
+ * Copyright (c) 2012, 2016 Obeo.
* 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
@@ -10,27 +10,18 @@
*******************************************************************************/
package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl;
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.instanceOf;
-import static com.google.common.base.Predicates.or;
import static com.google.common.collect.Collections2.filter;
import static com.google.common.collect.Iterators.any;
import static com.google.common.collect.Iterators.concat;
import static com.google.common.collect.Iterators.transform;
import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Sets.newLinkedHashSet;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.CONTAINMENT_REFERENCE_CHANGE;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasState;
-import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
@@ -43,32 +34,28 @@ import java.util.Set;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
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.DifferenceState;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.MatchResource;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.ResourceAttachmentChange;
-import org.eclipse.emf.compare.match.impl.NotLoadedFragmentMatch;
import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
import org.eclipse.emf.compare.provider.utils.IStyledString;
import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
-import org.eclipse.emf.compare.rcp.ui.internal.util.ResourceUIUtil;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.ConflictNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.DiffNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchResourceNode;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.extender.IDifferenceGroupExtender;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.swt.graphics.Image;
@@ -104,9 +91,6 @@ public class BasicDifferenceGroupImpl extends AdapterImpl implements IDifference
/** The list of children of this group. */
protected List<TreeNode> children;
- /** The list of already processed refined diffs. */
- protected Set<Diff> extensionDiffProcessed;
-
/** The comparison that is the parent of this group. */
private final Comparison comparison;
@@ -275,342 +259,180 @@ public class BasicDifferenceGroupImpl extends AdapterImpl implements IDifference
}
/**
- * Build the sub tree of the given {@link MatchResource}.
+ * {@inheritDoc}
*
- * @param matchResource
- * the given MatchResource.
- * @return the sub tree of the given MatchResource.
+ * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup#dispose()
*/
- protected TreeNode buildSubTree(MatchResource matchResource,
- Set<ResourceAttachmentChange> attachmentChanges) {
- TreeNode treeNode = wrap(matchResource);
- Collection<ResourceAttachmentChange> filteredChanges = filter(attachmentChanges, filter);
- for (ResourceAttachmentChange attachmentChange : filteredChanges) {
- treeNode.getChildren().add(wrap(attachmentChange));
+ public void dispose() {
+ if (children != null) {
+ unregisterCrossReferenceAdapter(children);
+ children = null;
}
- return treeNode;
}
/**
- * Build the sub tree of the given {@link Match}.
- *
- * @param parentMatch
- * the parent of the given Match.
- * @param match
- * the given Match.
- * @return the sub tree of the given Match.
+ * Builds the sub tree for this group.
*/
- public List<TreeNode> buildSubTree(Match parentMatch, Match match) {
- return buildSubTree(match, false, ChildrenSide.BOTH);
- }
-
- public List<TreeNode> buildContainmentSubTree(Match match) {
- return buildSubTree(match, true, ChildrenSide.BOTH);
+ public void buildSubTree() {
+ children = createChildren();
+ doBuildSubTrees();
+ customize(children);
+ registerCrossReferenceAdapter(children);
}
/**
- * Build the sub tree of the given {@link Match}.
- *
- * @param match
- * the given Match.
- * @param containment
- * true if the current level represents a containment diff, false otherwise.
- * @param side
- * the accepted side(s) for children of current level.
- * @return the sub tree of the given Match.
+ * Perform the creation of the sub-trees of the group.
*/
- protected List<TreeNode> buildSubTree(Match match, boolean containment, ChildrenSide side) {
- final List<TreeNode> ret = Lists.newArrayList();
- final Set<TreeNode> nodeChildren = newLinkedHashSet();
- final Set<Match> matchOfValues = newLinkedHashSet();
- final TreeNode matchTreeNode = wrap(match);
-
- if (!containment) {
- ret.add(matchTreeNode);
- }
-
- boolean hasDiff = false;
- for (Diff diff : filter(match.getDifferences(), and(filter, compatibleSide(side)))) {
- if (CONTAINMENT_REFERENCE_CHANGE.apply(diff)) {
- hasDiff = true;
- final TreeNode node;
- if (containment) {
- node = wrap(diff);
- ret.add(node);
- } else {
- node = buildSubTree(diff);
- nodeChildren.add(node);
- }
- Match matchOfValue = match.getComparison().getMatch(((ReferenceChange)diff).getValue());
- if (matchOfValue != null) {
- matchOfValues.add(matchOfValue);
- node.getChildren().addAll(buildSubTree(matchOfValue, true, DIFF_TO_SIDE.apply(diff)));
- }
- if (containment) {
- ret.addAll(manageRefines(diff, side));
- } else {
- nodeChildren.addAll(manageRefines(diff, side));
- }
- } else if (!(diff instanceof ResourceAttachmentChange)) {
- if (diff.getPrimeRefining() != null && extensionDiffProcessed.contains(diff)) {
- continue;
- }
- hasDiff = true;
- if (containment) {
- ret.add(wrap(diff));
- } else {
- nodeChildren.add(buildSubTree(diff));
- }
- }
- }
-
- Collection<TreeNode> toRemove = Lists.newArrayList();
- for (TreeNode treeNode : ret) {
- boolean hasNonEmptySubMatch = false;
- // SubMatches first
- for (Match subMatch : Sets.difference(newLinkedHashSet(match.getSubmatches()), matchOfValues)) {
- List<TreeNode> buildSubTree = buildSubTree(subMatch, containment, ChildrenSide.BOTH);
- if (!buildSubTree.isEmpty()) {
- hasNonEmptySubMatch = true;
- treeNode.getChildren().addAll(buildSubTree);
- }
- }
- // Differences last
- treeNode.getChildren().addAll(nodeChildren);
- if (!(containment || hasDiff || hasNonEmptySubMatch || filter.equals(Predicates.alwaysTrue()))) {
- toRemove.add(treeNode);
- } else if (!containment && isMatchWithOnlyResourceAttachmentChanges(match)) {
- toRemove.add(treeNode);
- } else if (isMatchWithProxyData(match)) {
- toRemove.add(treeNode);
- } else {
- for (IDifferenceGroupExtender ext : registry.getExtenders()) {
- if (ext.handle(treeNode)) {
- ext.addChildren(treeNode);
- }
- }
- }
- }
-
- ret.removeAll(toRemove);
-
- return ret;
+ protected void doBuildSubTrees() {
+ children.addAll(buildMatchTrees());
+ children.addAll(buildMatchResourceTrees());
}
/**
- * Check if the given match holds a proxy.
+ * This creates the root-level children of the group.
*
- * @param match
- * the given match
- * @return true if the given match holds a proxy, false otherwise.
+ * @return This default implementation returns a new ArrayList. It may be overridden by sub-classes.
*/
- private boolean isMatchWithProxyData(Match match) {
- boolean proxy = false;
- if (match.getLeft() != null) {
- if (match.getLeft().eIsProxy()) {
- proxy = true;
- }
- } else if (match.getRight() != null) {
- if (match.getRight().eIsProxy()) {
- proxy = true;
- }
- } else if (match.getOrigin() != null) {
- if (match.getOrigin().eIsProxy()) {
- proxy = true;
- }
- }
- return proxy;
+ protected List<TreeNode> createChildren() {
+ return newArrayList();
}
/**
- * Manage the addition of refines diffs of the given Diff.
+ * Compute a subTree for each root match of the comparison.
*
- * @param diff
- * the given Diff.
- * @param side
- * the accepted side(s) for children of current level.
- * @return the sub tree of refines diffs.
+ * @return the list of matchSubTrees
*/
- private List<TreeNode> manageRefines(Diff diff, ChildrenSide side) {
- final List<TreeNode> ret = Lists.newArrayList();
- final EList<Diff> refines = diff.getRefines();
- for (Diff refine : refines) {
- Diff mainDiff = refine.getPrimeRefining();
- if (mainDiff != null && mainDiff == diff && and(filter, compatibleSide(side)).apply(refine)) {
- TreeNode refineSubTree = buildSubTree(refine);
- ret.add(refineSubTree);
- extensionDiffProcessed.add(refine);
+ protected List<TreeNode> buildMatchTrees() {
+ final List<TreeNode> matchTrees = new ArrayList<TreeNode>();
+ for (Match match : getComparison().getMatches()) {
+ MatchNode matchNode = buildTree(match);
+ if (matchNode != null) {
+ matchTrees.add(matchNode);
}
}
- return ret;
+ return matchTrees;
}
/**
- * Build the sub tree for the given {@link Diff}.
+ * Compute a tree for the given match.
*
- * @param diff
- * the given diff.
- * @return the sub tree of the given diff.
+ * @param match
+ * The given match
+ * @return a list of subTree for this match, must not be <code>null</code>
*/
- private TreeNode buildSubTree(Diff diff) {
- TreeNode treeNode = wrap(diff);
- for (IDifferenceGroupExtender ext : registry.getExtenders()) {
- if (ext.handle(treeNode)) {
- ext.addChildren(treeNode);
- }
+ protected MatchNode buildTree(Match match) {
+ MatchNode result = null;
+ MatchNode matchNode = createMatchNode(match);
+ populateMatchNode(matchNode);
+ if (!matchNode.getChildren().isEmpty()) {
+ result = matchNode;
}
- return treeNode;
- }
-
- /**
- * Creates a TreeNode form the given EObject.
- *
- * @param data
- * the given EObject.
- * @return a TreeNode.
- */
- protected TreeNode wrap(EObject data) {
- TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
- treeNode.setData(data);
- treeNode.eAdapters().add(this);
- return treeNode;
+ return result;
}
/**
- * Checks if the given {@link Match} contains only differences of type {@link ResourceAttachmentChange}.
+ * Build the subtree for the given match.
*
- * @param match
- * the given Match.
- * @return true, if the given Match contains only differences of type ResourceAttachmentChange.
+ * @param matchNode
+ * The root matchNode
+ * @return the computed matchNode
*/
- private boolean isMatchWithOnlyResourceAttachmentChanges(Match match) {
- boolean ret = false;
- Iterable<Diff> allDifferences = match.getAllDifferences();
- if (Iterables.isEmpty(allDifferences)) {
- ret = false;
- } else if (Iterables.all(allDifferences, instanceOf(ResourceAttachmentChange.class))) {
- if (match.getSubmatches() == null || match.getSubmatches().isEmpty()) {
- ret = true;
+ protected void populateMatchNode(MatchNode matchNode) {
+ Match match = matchNode.getMatch();
+ Multimap<Match, Diff> diffsBySubMatch = LinkedHashMultimap.create();
+ for (Diff diff : filter(match.getDifferences(), filter)) {
+ // If a diff is part of a larger diff (is refined by), we don't want to add it to the tree. It
+ // will be added by the algorithm in a second step. This way we avoid duplication and all diffs
+ // that are part of a 'master' diff are grouped as children of this 'master' diff
+ if (mustDisplayAsDirectChildOfMatch(diff)) {
+ Match targetMatch = getTargetMatch(diff);
+ if (match == targetMatch) {
+ addDiffNode(matchNode, diff);
+ } else if (match.getSubmatches().contains(targetMatch)) {
+ diffsBySubMatch.put(targetMatch, diff);
+ } else if (targetMatch != null) {
+ MatchNode targetMatchNode = createMatchNode(targetMatch);
+ matchNode.addSubMatchNode(targetMatchNode);
+ addDiffNode(targetMatchNode, diff);
+ }
}
}
- return ret;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup#dispose()
- */
- public void dispose() {
- if (children != null) {
- unregisterCrossReferenceAdapter(children);
- children = null;
+ for (Match subMatch : match.getSubmatches()) {
+ MatchNode subMatchNode = createMatchNode(subMatch);
+ for (Diff subMatchDiff : diffsBySubMatch.get(subMatch)) {
+ addDiffNode(subMatchNode, subMatchDiff);
+ }
+ diffsBySubMatch.removeAll(subMatch);
+ populateMatchNode(subMatchNode);
+ if (!subMatchNode.getChildren().isEmpty()) {
+ matchNode.addSubMatchNode(subMatchNode);
+ }
}
}
/**
- * An enum that represents, for a given diff, the accepted side(s) for its children and provides utilty
- * methods to manage sides.
+ * Provide the Match that should directly contain the given diff. If the given diff should not be a direct
+ * child of a Match, the method must return <code>null</code>. For a given strategy, a diff should only be
+ * displayed in the same Match (i.e. the {@link DiffNode}s that represent the diff should always be
+ * children of the {@link MatchNode}s that represent the returned Match.
*
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 4.0
+ * @param diff
+ * The difference
+ * @return The Match that is a direct parent of the given diff, can be <code>null</code>.
*/
- protected enum ChildrenSide {
- /** Values: both sides, left side. */
- BOTH, LEFT, RIGHT;
-
- public static ChildrenSide getValueFrom(DifferenceSource source) {
- switch (source) {
- case LEFT:
- return LEFT;
- case RIGHT:
- return RIGHT;
- default:
- return BOTH;
+ protected Match getTargetMatch(Diff diff) {
+ if (mustDisplayAsDirectChildOfMatch(diff)) {
+ if (isContainmentRefChange(diff)) {
+ Match valueMatch = diff.getMatch().getComparison()
+ .getMatch(((ReferenceChange)diff).getValue());
+ return valueMatch; // This match may not be a sub-match because the child may have moved
+ } else if (isContainmentRefChange(diff.getPrimeRefining())) {
+ Match valueMatch = diff.getMatch().getComparison()
+ .getMatch(((ReferenceChange)diff.getPrimeRefining()).getValue());
+ return valueMatch; // This match may not be a sub-match because the child may have moved
}
+ return diff.getMatch();
}
+ return null;
}
/**
- * Get the accepted side(s) for children of a given Diff.
- */
- private static final Function<Diff, ChildrenSide> DIFF_TO_SIDE = new Function<Diff, ChildrenSide>() {
- public ChildrenSide apply(Diff diff) {
- final ChildrenSide side;
- if (diff != null) {
- final Conflict c = diff.getConflict();
- if (c != null && or(hasConflict(ConflictKind.PSEUDO),
- and(hasConflict(ConflictKind.REAL), ofKind(DifferenceKind.ADD))).apply(diff)) {
- side = ChildrenSide.getValueFrom(diff.getSource());
- } else {
- side = ChildrenSide.BOTH;
- }
- } else {
- side = ChildrenSide.BOTH;
- }
- return side;
- }
- };
-
- /**
- * This can be used to check that a given Diff is compatible with the given side.
+ * Does the given difference have to be displayed as direct child of a Match?
*
- * @param source
- * The side for which we accept the given Diff.
- * @return The created predicate.
+ * @param diff
+ * The diff
+ * @return <code>true</code> if the diff's node should be a child of a MatchNode.
*/
- private static Predicate<? super Diff> compatibleSide(final ChildrenSide side) {
- return new Predicate<Diff>() {
- public boolean apply(Diff input) {
- if (input != null && side != ChildrenSide.BOTH) {
- return side == ChildrenSide.getValueFrom(input.getSource());
- } else {
- return side == ChildrenSide.BOTH;
- }
- }
- };
+ protected boolean mustDisplayAsDirectChildOfMatch(Diff diff) {
+ return diff.getRefines().isEmpty();
}
/**
- * Builds the sub tree for this group.
+ * Is it a containment reference change?
+ *
+ * @param diff
+ * The diff
+ * @return <code>true</code> if the diff is a {@link ReferenceChange} whose {@link EReference} is a
+ * containment reference.
*/
- public void buildSubTree() {
- children = newArrayList();
- extensionDiffProcessed = newLinkedHashSet();
- children.addAll(buildMatchSubTrees());
- children.addAll(buildMatchResourceSubTrees());
- registerCrossReferenceAdapter(children);
- }
-
- protected List<TreeNode> buildMatchSubTrees() {
- final List<TreeNode> matchSubTrees = new ArrayList<TreeNode>();
-
- for (Match match : comparison.getMatches()) {
- List<? extends TreeNode> buildSubTree = buildSubTree((Match)null, match);
- if (buildSubTree != null) {
- matchSubTrees.addAll(buildSubTree);
- }
- }
-
- final List<TreeNode> rootNodes = addNotLoadedFragmentNodes(matchSubTrees);
-
- return rootNodes;
+ protected boolean isContainmentRefChange(Diff diff) {
+ return diff instanceof ReferenceChange && ((ReferenceChange)diff).getReference().isContainment();
}
- protected List<TreeNode> buildMatchResourceSubTrees() {
- final List<TreeNode> matchResourceSubTrees = new ArrayList<TreeNode>();
- if (comparison.getMatchedResources().isEmpty()) {
- return matchResourceSubTrees;
+ protected List<TreeNode> buildMatchResourceTrees() {
+ final List<TreeNode> matchResourceTrees = new ArrayList<TreeNode>();
+ if (getComparison().getMatchedResources().isEmpty()) {
+ return matchResourceTrees;
}
final Iterable<ResourceAttachmentChange> attachmentChanges = Iterables
- .filter(comparison.getDifferences(), ResourceAttachmentChange.class);
+ .filter(getComparison().getDifferences(), ResourceAttachmentChange.class);
final Multimap<String, ResourceAttachmentChange> uriToRAC = LinkedHashMultimap.create();
for (ResourceAttachmentChange attachmentChange : attachmentChanges) {
uriToRAC.put(attachmentChange.getResourceURI(), attachmentChange);
}
- for (MatchResource matchResource : comparison.getMatchedResources()) {
+ for (MatchResource matchResource : getComparison().getMatchedResources()) {
final Collection<ResourceAttachmentChange> leftRAC = uriToRAC.get(matchResource.getLeftURI());
final Collection<ResourceAttachmentChange> rightRAC = uriToRAC.get(matchResource.getRightURI());
final Collection<ResourceAttachmentChange> originRAC = uriToRAC.get(matchResource.getOriginURI());
@@ -619,177 +441,142 @@ public class BasicDifferenceGroupImpl extends AdapterImpl implements IDifference
racForMatchResource.addAll(rightRAC);
racForMatchResource.addAll(originRAC);
- TreeNode buildSubTree = buildSubTree(matchResource, racForMatchResource);
- if (buildSubTree != null) {
- matchResourceSubTrees.add(buildSubTree);
+ MatchResourceNode matchNode = buildSubTree(matchResource, racForMatchResource);
+ if (matchNode != null) {
+ matchResourceTrees.add(matchNode);
}
}
- return matchResourceSubTrees;
+ return matchResourceTrees;
}
/**
- * When a model is split into fragments, and only some of them have changes, the structure merge viewer
- * (SMV) and the content merge viewers (CMV) display the models involved in the comparison but don’t
- * display the fragments that have no changes.
- * <p>
- * If a change (x) is detected in a fragment (B), and this fragment is a child of another fragment (A)
- * that has no changes, then (A) won't appear in the SMV and the CMV's. As a result, users will think (B)
- * is the root of the global model.
- * </p>
- * <p>
- * To avoid this, the idea is to display intermediate node(s) (a.k.a NotLoadedFragmentNodes) in order to
- * show to users that it exists something (fragments, i.e. a parts of models) between/above the changes.
- * </p>
- * This method add these NotLoadedFragmentNodes in the given list of root TreeNodes.
+ * Build the sub tree of the given {@link MatchResource}.
*
- * @param rootNodes
- * the given list of root TreeNodes.
- * @return a new list of root TreeNodes, completed with NotLoadedFragmentNodes if needed.
+ * @param matchResource
+ * the given MatchResource.
+ * @return the sub tree of the given MatchResource.
*/
- private List<TreeNode> addNotLoadedFragmentNodes(List<TreeNode> rootNodes) {
- final List<TreeNode> newRootNodes = new ArrayList<TreeNode>(rootNodes);
- for (TreeNode treeNode : rootNodes) {
- EObject data = TREE_NODE_DATA.apply(treeNode);
- if (data instanceof Match) {
- URI uri = ResourceUIUtil.getDataURI((Match)data);
- if (ResourceUIUtil.isFragment(uri)) {
- newRootNodes.remove(treeNode);
- TreeNode notLoadedFragment = addNotLoadedFragment(rootNodes, treeNode, (Match)data, uri);
- if (notLoadedFragment != null) {
- newRootNodes.add(notLoadedFragment);
- }
- }
- }
- }
- // if several root nodes are NotLoadedFragment nodes, add new parent node for these
- // NotLoadedFragmentNodes.
- if (ResourceUIUtil.containsNotLoadedFragmentNodes(newRootNodes)) {
- Collection<TreeNode> nodes = encapsulateNotLoadedFragmentNodes(newRootNodes);
- newRootNodes.clear();
- newRootNodes.addAll(nodes);
+ protected MatchResourceNode buildSubTree(MatchResource matchResource,
+ Set<ResourceAttachmentChange> attachmentChanges) {
+ MatchResourceNode matchResourceNode = createMatchResourceNode(matchResource);
+ Collection<ResourceAttachmentChange> filteredChanges = filter(attachmentChanges, filter);
+ for (ResourceAttachmentChange attachmentChange : filteredChanges) {
+ DiffNode diffNode = createDiffNode(attachmentChange);
+ matchResourceNode.addDiffNode(diffNode);
}
+ return matchResourceNode;
+ }
+
+ /**
+ * Add the diff in the given match. This method handles refined diffs and allows to customize the result.
+ *
+ * @param matchNode
+ * The given match node
+ * @param diff
+ * The diff to add
+ */
+ protected void addDiffNode(MatchNode matchNode, Diff diff) {
+ DiffNode diffNode = createDiffNode(diff);
+ handleRefiningDiffs(diffNode);
+ matchNode.addDiffNode(diffNode);
+ }
- return newRootNodes;
+ /**
+ * Create a diff node.
+ *
+ * @param diff
+ * The given diff
+ * @return the DiffNode
+ */
+ protected DiffNode createDiffNode(Diff diff) {
+ DiffNode diffNode = new DiffNode(diff);
+ diffNode.eAdapters().add(this);
+ return diffNode;
}
/**
- * Encapsulate the given TreeNode under a new NotLoadedFragmentNode.
+ * Create a match node.
*
- * @param rootNodes
- * the given list of root TreeNodes.
- * @param treeNode
- * the given TreeNode.
* @param match
- * the match associated to the given TreeNode.
- * @param uri
- * the data resource's URI of the given match.
- * @return
+ * The given match
+ * @return the MatchNode
*/
- private TreeNode addNotLoadedFragment(final List<TreeNode> rootNodes, TreeNode treeNode, Match match,
- URI uri) {
- TreeNode newRootNode = null;
- TreeNode notLoadedFragmentNode = createNotLoadedFragmentMatchNode(treeNode, match);
- if (ResourceUIUtil.isFirstLevelFragment(uri)) {
- URI rootURI = ResourceUIUtil.getRootResourceURI(uri);
- if (rootURI != null) {
- // if root uri matches a tree node's data resource, the current treeNode has to be
- // moved under this tree node.
- TreeNode realParent = ResourceUIUtil.getTreeNodeFromURI(rootNodes, rootURI);
- if (realParent != null) {
- realParent.getChildren().add(notLoadedFragmentNode);
- } else {
- newRootNode = notLoadedFragmentNode;
- }
- }
- } else { // Get the first loaded parent object
- ResourceSet rs = ResourceUIUtil.getDataResourceSet(match);
- EObject eObject = ResourceUIUtil.getEObjectParent(rs, uri);
- if (eObject != null) {
- Match newParentMatch = getComparison().getMatch(eObject);
- TreeNode newParentNode = ResourceUIUtil.getTreeNode(rootNodes, newParentMatch);
- if (newParentNode != null) {
- EList<TreeNode> newParentNodeChildren = newParentNode.getChildren();
- newParentNodeChildren.add(notLoadedFragmentNode);
- setNotLoadedFragmentNodesName(newParentNodeChildren);
- } else {
- newRootNode = notLoadedFragmentNode;
- }
- } else {
- newRootNode = notLoadedFragmentNode;
- }
- }
- return newRootNode;
+ protected MatchNode createMatchNode(Match match) {
+ MatchNode matchNode = new MatchNode(match);
+ matchNode.eAdapters().add(this);
+ return matchNode;
}
/**
- * If the given list of nodes contains at least two nodes with NotLoadedFragmentMatches, then it set the
- * name of these NotLoadedFragmentMatches.
+ * Create a conflict node.
*
- * @param nodes
- * the given list of nodes.
+ * @param conflict
+ * The given conflict
+ * @return the ConflictNode
*/
- private void setNotLoadedFragmentNodesName(Collection<TreeNode> nodes) {
- if (ResourceUIUtil.containsNotLoadedFragmentNodes(nodes)) {
- for (TreeNode node : nodes) {
- EObject data = TREE_NODE_DATA.apply(node);
- if (data instanceof NotLoadedFragmentMatch) {
- ((NotLoadedFragmentMatch)data)
- .setName(ResourceUIUtil.getResourceName((NotLoadedFragmentMatch)data));
- }
- }
- }
+ protected ConflictNode createConflictNode(Conflict conflict) {
+ ConflictNode conflictNode = new ConflictNode(conflict);
+ conflictNode.eAdapters().add(this);
+ return conflictNode;
}
/**
- * Creates a TreeNode that holds a {@link org.eclipse.emf.compare.match.impl.NotLoadedFragmentMatch}. The
- * holding NotLoadedFragmentMatch will be created by this method and will contains the given Match as a
- * child. The newly created TreeNode will be the parent of the given TreeNode. The given match must
- * correspond to the given TreeNode's data.
+ * Create a matchResource node.
*
- * @param node
- * the child of the newly created TreeNode.
- * @param match
- * the match that will be the child of the newly created NotLoadedFragmentMatch.
- * @return the newly created TreeNode.
+ * @param matchResource
+ * The given matchResource
+ * @return the MatchResourceNode
*/
- private TreeNode createNotLoadedFragmentMatchNode(TreeNode node, Match match) {
- TreeNode notLoadedFragmentNode = TreeFactory.eINSTANCE.createTreeNode();
- NotLoadedFragmentMatch notLoadedFragmentMatch = new NotLoadedFragmentMatch(match);
- notLoadedFragmentNode.setData(notLoadedFragmentMatch);
- notLoadedFragmentNode.eAdapters().add(this);
- notLoadedFragmentNode.getChildren().add(node);
- return notLoadedFragmentNode;
+ protected MatchResourceNode createMatchResourceNode(MatchResource matchResource) {
+ MatchResourceNode matchResourceNode = new MatchResourceNode(matchResource);
+ matchResourceNode.eAdapters().add(this);
+ return matchResourceNode;
}
/**
- * For the given list of TreeNodes, encapsulates under a new TreeNode container all TreeNode holding
- * NotLoadingFragmentMatches.
+ * Walk the given trees and customize each node in the tree, starting by the deeper nodes all the way up
+ * to the root nodes. This method calls itself recursively.
*
* @param nodes
- * the initial TreeNodes.
- * @return the modified TreeNodes.
+ * The list of nodes to customize.
*/
- private Collection<TreeNode> encapsulateNotLoadedFragmentNodes(Collection<TreeNode> nodes) {
- final Collection<TreeNode> newNodes = Lists.newArrayList(nodes);
- final Collection<TreeNode> fragmentNodes = Lists.newArrayList();
- TreeNode notLoadedFragmentNode = TreeFactory.eINSTANCE.createTreeNode();
- Collection<Match> matches = new ArrayList<Match>();
+ protected void customize(List<? extends TreeNode> nodes) {
for (TreeNode node : nodes) {
- EObject data = TREE_NODE_DATA.apply(node);
- if (data instanceof NotLoadedFragmentMatch) {
- matches.add((Match)data);
- ((NotLoadedFragmentMatch)data)
- .setName(ResourceUIUtil.getResourceName((NotLoadedFragmentMatch)data));
- newNodes.remove(node);
- fragmentNodes.add(node);
+ customize(node.getChildren());
+ customize(node);
+ }
+ }
+
+ /**
+ * Allow extenders to customize a TreeNode.
+ *
+ * @param treeNode
+ * the TreeNode to customize.
+ */
+ protected void customize(TreeNode treeNode) {
+ for (IDifferenceGroupExtender ext : registry.getExtenders()) {
+ if (ext.handle(treeNode)) {
+ ext.addChildren(treeNode);
}
}
- NotLoadedFragmentMatch notLoadedFragmentMatch = new NotLoadedFragmentMatch(matches);
- notLoadedFragmentNode.setData(notLoadedFragmentMatch);
- notLoadedFragmentNode.eAdapters().add(this);
- notLoadedFragmentNode.getChildren().addAll(fragmentNodes);
- newNodes.add(notLoadedFragmentNode);
- return newNodes;
}
+
+ /**
+ * Handle the diffs that refine the given diff. Refining diffs are added as children of the given diff,
+ * and so on recursively.
+ *
+ * @param diffNode
+ * The diff node to handle, which is not necessarily a child of a MatchNode since this method
+ * is called recursively.
+ */
+ protected void handleRefiningDiffs(DiffNode diffNode) {
+ Diff diff = diffNode.getDiff();
+ for (Diff refiningDiff : diff.getRefinedBy()) {
+ DiffNode refinedDiffNode = createDiffNode(refiningDiff);
+ diffNode.addRefinedDiffNode(refinedDiffNode);
+ handleRefiningDiffs(refinedDiffNode);
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ByResourceGroupProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ByResourceGroupProvider.java
index 4ee81db93..a08a901d8 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ByResourceGroupProvider.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ByResourceGroupProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
+ * Copyright (c) 2013, 2016 Obeo.
* 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
@@ -24,6 +24,9 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.MatchResource;
import org.eclipse.emf.compare.ResourceAttachmentChange;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.DiffNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchResourceNode;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.AbstractDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.ecore.EObject;
@@ -98,7 +101,7 @@ public class ByResourceGroupProvider extends AbstractDifferenceGroupProvider {
/** {@inheritDoc} */
@Override
- protected List<TreeNode> buildMatchSubTrees() {
+ protected List<TreeNode> buildMatchTrees() {
// All of our nodes will be under MatchResources for this group.
return new ArrayList<TreeNode>();
}
@@ -110,23 +113,26 @@ public class ByResourceGroupProvider extends AbstractDifferenceGroupProvider {
* Set)
*/
@Override
- protected TreeNode buildSubTree(MatchResource matchResource,
+ protected MatchResourceNode buildSubTree(MatchResource matchResource,
Set<ResourceAttachmentChange> attachmentChanges) {
- TreeNode ret = wrap(matchResource);
+ MatchResourceNode matchResourceNode = createMatchResourceNode(matchResource);
for (ResourceAttachmentChange attachmentChange : attachmentChanges) {
- ret.getChildren().add(wrap(attachmentChange));
+ DiffNode diffNode = createDiffNode(attachmentChange);
+ matchResourceNode.addDiffNode(diffNode);
}
for (Match match : roots) {
if (isUnderResourceWithURI(match.getLeft(), matchResource.getLeftURI())
|| isUnderResourceWithURI(match.getRight(), matchResource.getRightURI())
|| isUnderResourceWithURI(match.getOrigin(), matchResource.getOriginURI())) {
- ret.getChildren().addAll(buildSubTree(match, false, ChildrenSide.BOTH));
+ MatchNode matchNode = createMatchNode(match);
+ populateMatchNode(matchNode);
+ matchResourceNode.addMatchNode(matchNode);
}
}
- return ret;
+ return matchResourceNode;
}
/**
@@ -155,7 +161,7 @@ public class ByResourceGroupProvider extends AbstractDifferenceGroupProvider {
@Override
protected Collection<? extends IDifferenceGroup> buildGroups(Comparison comparison2) {
ResourceGroup group = new ResourceGroup(comparison2, getCrossReferenceAdapter());
- ((BasicDifferenceGroupImpl)group).buildSubTree();
+ group.buildSubTree();
return ImmutableList.of(group);
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ConflictNodeBuilder.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ConflictNodeBuilder.java
new file mode 100644
index 000000000..9ede33baa
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ConflictNodeBuilder.java
@@ -0,0 +1,90 @@
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl;
+
+import com.google.common.collect.Lists;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.ThreeWayComparisonGroupProvider.ConflictsGroupImpl;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.ConflictNode;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.MatchNode;
+import org.eclipse.emf.ecore.EObject;
+
+public class ConflictNodeBuilder {
+
+ private final Conflict conflict;
+
+ private final ConflictsGroupImpl group;
+
+ private final Map<Match, MatchNode> matchNodes;
+
+ public ConflictNodeBuilder(Conflict conflict, ConflictsGroupImpl group) {
+ this.conflict = conflict;
+ this.group = group;
+ matchNodes = new LinkedHashMap<Match, MatchNode>();
+ }
+
+ /**
+ * Build the node for the conflict.
+ *
+ * @return The node of the conflict, complete with all its children.
+ */
+ public ConflictNode buildNode() {
+ ConflictNode conflictNode = group.createConflictNode(conflict);
+ for (Diff diff : conflict.getDifferences()) {
+ Match match = group.getTargetMatch(diff);
+ if (match != null) {
+ MatchNode matchNode = ensureMatchNode(match, conflictNode);
+ group.addDiffNode(matchNode, diff);
+ }
+ }
+ List<Match> nonRootMatches = Lists.newArrayListWithCapacity(matchNodes.size());
+ outer: for (Match match : matchNodes.keySet()) {
+ EObject container = match.eContainer();
+ while (container instanceof Match) {
+ if (matchNodes.containsKey(container)) {
+ nonRootMatches.add(match);
+ continue outer;
+ }
+ container = container.eContainer();
+ }
+ }
+ for (Match match : nonRootMatches) {
+ MatchNode matchNode = matchNodes.get(match);
+ EObject container = match.eContainer();
+ MatchNode childNode = matchNode;
+ boolean stop = false;
+ while (container instanceof Match && !stop) {
+ MatchNode hierarchyNode;
+ if (matchNodes.containsKey(container)) {
+ hierarchyNode = matchNodes.get(container);
+ stop = true;
+ } else {
+ hierarchyNode = group.createMatchNode((Match)container);
+ matchNodes.put((Match)container, hierarchyNode);
+ }
+ hierarchyNode.addSubMatchNode(childNode);
+ childNode = hierarchyNode;
+ container = container.eContainer();
+ }
+ }
+ return conflictNode;
+ }
+
+ private MatchNode ensureMatchNode(Match match, ConflictNode conflictNode) {
+ MatchNode node;
+ if (matchNodes.containsKey(match)) {
+ node = matchNodes.get(match);
+ } else {
+ node = group.createMatchNode(match);
+ conflictNode.addConflictingTree(node);
+ matchNodes.put(match, node);
+ }
+ return node;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/KindGroupProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/KindGroupProvider.java
index efbfce9e5..3e68d2a1e 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/KindGroupProvider.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/KindGroupProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
+ * Copyright (c) 2012, 2016 Obeo.
* 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
@@ -40,26 +40,26 @@ public class KindGroupProvider extends AbstractDifferenceGroupProvider {
*/
@Override
protected Collection<? extends IDifferenceGroup> buildGroups(Comparison comparison2) {
- final IDifferenceGroup additions = new BasicDifferenceGroupImpl(getComparison(),
+ final BasicDifferenceGroupImpl additions = new BasicDifferenceGroupImpl(getComparison(),
ofKind(DifferenceKind.ADD),
EMFCompareRCPUIMessages.getString("KindGroupProvider.addition.label"), //$NON-NLS-1$
getCrossReferenceAdapter());
- ((BasicDifferenceGroupImpl)additions).buildSubTree();
- final IDifferenceGroup deletions = new BasicDifferenceGroupImpl(getComparison(),
+ additions.buildSubTree();
+ final BasicDifferenceGroupImpl deletions = new BasicDifferenceGroupImpl(getComparison(),
ofKind(DifferenceKind.DELETE),
EMFCompareRCPUIMessages.getString("KindGroupProvider.deletion.label"), //$NON-NLS-1$
getCrossReferenceAdapter());
- ((BasicDifferenceGroupImpl)deletions).buildSubTree();
- final IDifferenceGroup changes = new BasicDifferenceGroupImpl(getComparison(),
+ deletions.buildSubTree();
+ final BasicDifferenceGroupImpl changes = new BasicDifferenceGroupImpl(getComparison(),
ofKind(DifferenceKind.CHANGE),
EMFCompareRCPUIMessages.getString("KindGroupProvider.change.label"), //$NON-NLS-1$
getCrossReferenceAdapter());
- ((BasicDifferenceGroupImpl)changes).buildSubTree();
- final IDifferenceGroup moves = new BasicDifferenceGroupImpl(getComparison(),
+ changes.buildSubTree();
+ final BasicDifferenceGroupImpl moves = new BasicDifferenceGroupImpl(getComparison(),
ofKind(DifferenceKind.MOVE),
EMFCompareRCPUIMessages.getString("KindGroupProvider.move.label"), //$NON-NLS-1$
getCrossReferenceAdapter());
- ((BasicDifferenceGroupImpl)moves).buildSubTree();
+ moves.buildSubTree();
Collection<IDifferenceGroup> groups = Lists.newArrayList();
if (!additions.getChildren().isEmpty()) {
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ThreeWayComparisonGroupProvider.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ThreeWayComparisonGroupProvider.java
index ab1509628..7eec360ef 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ThreeWayComparisonGroupProvider.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/ThreeWayComparisonGroupProvider.java
@@ -17,8 +17,6 @@ import static com.google.common.collect.Iterables.any;
import static com.google.common.collect.Iterators.concat;
import static com.google.common.collect.Iterators.filter;
import static com.google.common.collect.Iterators.transform;
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Sets.newLinkedHashSet;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasState;
@@ -27,12 +25,10 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
-import com.google.common.collect.Sets.SetView;
import com.google.common.collect.UnmodifiableIterator;
import java.util.Collection;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.compare.Comparison;
@@ -41,22 +37,19 @@ import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
-import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.internal.utils.ComparisonUtil;
import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
import org.eclipse.emf.compare.provider.utils.IStyledString;
import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.SideLabelProvider;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes.ConflictNode;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.AbstractDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.tree.TreeNode;
/**
* This implementation of a
@@ -101,6 +94,30 @@ public class ThreeWayComparisonGroupProvider extends AbstractDifferenceGroupProv
}
/**
+ * In conflicts, a special case must be handled for refining diffs: If they are not part of the same
+ * conflict then they should not be in the same group as the refined diff.
+ *
+ * @param diff
+ * The difference
+ * @return <code>true</code> if the diff refines nothing or if its conflict does not contain all the
+ * diffs it refines.
+ */
+ @Override
+ protected boolean mustDisplayAsDirectChildOfMatch(Diff diff) {
+ return diff.getRefines().isEmpty() || (diff.getConflict() != null
+ && !diff.getConflict().getDifferences().containsAll(diff.getRefines()));
+ }
+
+ @Override
+ protected void doBuildSubTrees() {
+ for (Conflict conflict : getComparison().getConflicts()) {
+ ConflictNodeBuilder builder = new ConflictNodeBuilder(conflict, this);
+ ConflictNode conflictNode = builder.buildNode();
+ children.add(conflictNode);
+ }
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl#getStyledName()
@@ -120,179 +137,6 @@ public class ThreeWayComparisonGroupProvider extends AbstractDifferenceGroupProv
ret.append(getName());
return ret;
}
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl#buildSubTree()
- */
- @Override
- public synchronized void buildSubTree() {
- children = newArrayList();
- extensionDiffProcessed = newLinkedHashSet();
- for (Conflict conflict : getComparison().getConflicts()) {
- TreeNode buildSubTree = buildSubTree(conflict);
- if (buildSubTree != null) {
- children.add(buildSubTree);
- }
- }
- registerCrossReferenceAdapter(children);
- }
-
- /**
- * Build sub tree for the given Conflict.
- *
- * @param conflict
- * the given Conflict.
- * @return the sub tree for the given Conflict.
- */
- protected TreeNode buildSubTree(Conflict conflict) {
- TreeNode ret = wrap(conflict);
-
- for (Match match : getComparison().getMatches()) {
- buildSubTree(ret, conflict, match, Sets.<Match> newLinkedHashSet());
- }
-
- return ret;
-
- }
-
- /**
- * Build sub tree for the given Match.
- *
- * @param parentNode
- * the parent node of the given match.
- * @param conflict
- * the conflict of the tree.
- * @param match
- * the given match.
- * @param alreadyProcessedContainedMatches
- * already processed matches that are contained in the given <code>match</code>.
- */
- protected void buildSubTree(TreeNode parentNode, Conflict conflict, Match match,
- Collection<Match> alreadyProcessedContainedMatches) {
- buildSubTree(parentNode, conflict, match, alreadyProcessedContainedMatches,
- Sets.<Match> newHashSet());
- }
-
- /**
- * Build sub tree for the given Match.
- *
- * @param parentNode
- * the parent node of the given match.
- * @param conflict
- * the conflict of the tree.
- * @param match
- * the given match.
- * @param alreadyProcessedContainedMatches
- * already processed matches that are contained in the given <code>match</code>.
- * @param alreadyProcessedMatches
- * already processed matches.
- */
- private void buildSubTree(TreeNode parentNode, Conflict conflict, Match match,
- Collection<Match> alreadyProcessedContainedMatches,
- Collection<Match> alreadyProcessedMatches) {
- // Use a LinkedHashSet for the first argument of Sets.intersection, in order to keep the order of
- // differences.
- SetView<Diff> setView = Sets.intersection(Sets.newLinkedHashSet(match.getDifferences()),
- Sets.newHashSet(conflict.getDifferences()));
- for (Diff diff : setView) {
- if (!isParentPseudoConflictFromOtherSide(diff, parentNode.getData())) {
- TreeNode diffNode = wrap(diff);
- parentNode.getChildren().add(diffNode);
- if (isContainment(diff)) {
- final Match diffMatch = ComparisonUtil.getComparison(diff)
- .getMatch(((ReferenceChange)diff).getValue());
- if (diffMatch != null && !alreadyProcessedContainedMatches.contains(diffMatch)) {
- // we don't want callers deeper in the tree to modify the sets of already
- // processed contained matches
- LinkedHashSet<Match> updatedProcessedContainedMatches = Sets
- .newLinkedHashSet(alreadyProcessedContainedMatches);
- updatedProcessedContainedMatches.add(diffMatch);
- buildSubTree(diffNode, conflict, diffMatch, updatedProcessedContainedMatches);
- }
- } else {
- alreadyProcessedMatches.add(match);
- for (Diff refinedBy : diff.getRefinedBy()) {
- Match refinedByMatch = refinedBy.getMatch();
- if (alreadyProcessedMatches.add(refinedByMatch)) {
- buildSubTree(diffNode, conflict, refinedByMatch,
- alreadyProcessedContainedMatches, alreadyProcessedMatches);
- }
- }
- }
- }
- }
- for (Match subMatch : match.getSubmatches()) {
- if (!isMatchOfConflictContainmentDiff(conflict, subMatch)) {
- buildSubTree(parentNode, conflict, subMatch, alreadyProcessedContainedMatches,
- alreadyProcessedMatches);
- alreadyProcessedMatches.add(subMatch);
- }
- }
- }
-
- /**
- * Checks if the parent of the given diff is a pseudo conflict with a different side than the given
- * diff.
- *
- * @param diff
- * the given diff.
- * @param parent
- * the parent of the given duff.
- * @return true if the parent of the given diff is a pseudo conflict with a different side than the
- * given diff, false otherwise.
- */
- private boolean isParentPseudoConflictFromOtherSide(Diff diff, EObject parent) {
- boolean ret = false;
- if (parent instanceof Diff) {
- Conflict conflict = ((Diff)parent).getConflict();
- if (conflict != null) {
- if (ConflictKind.PSEUDO == conflict.getKind()) {
- ret = !fromSide(((Diff)parent).getSource()).apply(diff);
- }
- }
- }
- return ret;
- }
-
- /**
- * Checks if the given match is a match of one of the containment diffs of the given Conflict.
- *
- * @param conflict
- * the given conflict.
- * @param subMatch
- * the given match.
- * @return true, if the given match is a match of one of the containment diffs of the given Conflict,
- * false otherwise.
- */
- protected boolean isMatchOfConflictContainmentDiff(Conflict conflict, Match subMatch) {
- if (subMatch != null) {
- for (Diff diff : conflict.getDifferences()) {
- if (isContainment(diff)) {
- final Match realMatch = diff.getMatch().getComparison()
- .getMatch(((ReferenceChange)diff).getValue());
- if (subMatch.equals(realMatch)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Checks whether the given diff corresponds to a containment change. This holds true for differences
- * on containment references' values.
- *
- * @param diff
- * The diff to consider.
- * @return <code>true</code> if the given {@code diff} is to be considered a containment change,
- * <code>false</code> otherwise.
- */
- private boolean isContainment(Diff diff) {
- return diff instanceof ReferenceChange && ((ReferenceChange)diff).getReference().isContainment();
- }
}
/**
@@ -314,7 +158,7 @@ public class ThreeWayComparisonGroupProvider extends AbstractDifferenceGroupProv
rightLabel = EMFCompareRCPUIMessages.getString("ThreeWayComparisonGroupProvider.right.label"); //$NON-NLS-1$
}
- final BasicDifferenceGroupImpl conflicts = new ConflictsGroupImpl(getComparison(),
+ final ConflictsGroupImpl conflicts = new ConflictsGroupImpl(getComparison(),
hasConflict(ConflictKind.REAL, ConflictKind.PSEUDO),
EMFCompareRCPUIMessages.getString("ThreeWayComparisonGroupProvider.conflicts.label"), //$NON-NLS-1$
getCrossReferenceAdapter());
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/ConflictNode.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/ConflictNode.java
new file mode 100644
index 000000000..8b305bdfc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/ConflictNode.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes;
+
+import com.google.common.collect.Iterables;
+
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.edit.tree.impl.TreeNodeImpl;
+
+/**
+ * This class is wrapper for TreeNode used to represent a conflict TreeNode.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 4.3
+ */
+public class ConflictNode extends TreeNodeImpl {
+
+ /**
+ * Constructor.
+ *
+ * @param conflict
+ * The conflict represented by this TreeNode
+ */
+ public ConflictNode(Conflict conflict) {
+ setData(conflict);
+ }
+
+ /**
+ * Add the given MatchNode to the children of this ConflictNode.
+ *
+ * @param matchNode
+ * The MatchNode to add
+ * @return <code>true</code> if the MatchNode has been added
+ */
+ public boolean addConflictingTree(MatchNode matchNode) {
+ return getChildren().add(matchNode);
+ }
+
+ /**
+ * Remove the given MatchNode of the children of this ConflictNode.
+ *
+ * @param matchNode
+ * The MatchNode to remove
+ * @return <code>true</code> if the MatchNode has been removed
+ */
+ public boolean removeConflictingTree(MatchNode matchNode) {
+ return getChildren().remove(matchNode);
+ }
+
+ /**
+ * Getter for the conflict represented by this TreeNode.
+ *
+ * @return the conflict
+ */
+ public Conflict getConflict() {
+ return (Conflict)getData();
+ }
+
+ /**
+ * Get all the match trees that are part of the conflict
+ *
+ * @return an iterable of all MatchNode that are part of the conflict
+ */
+ public Iterable<MatchNode> getConflictingTrees() {
+ return Iterables.filter(getChildren(), MatchNode.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/DiffNode.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/DiffNode.java
new file mode 100644
index 000000000..78b151053
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/DiffNode.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes;
+
+import com.google.common.collect.Iterables;
+
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.edit.tree.impl.TreeNodeImpl;
+
+/**
+ * This class is wrapper for TreeNode used to represent a diff TreeNode.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 4.3
+ */
+public class DiffNode extends TreeNodeImpl {
+
+ /**
+ * Constructor.
+ *
+ * @param diff
+ * The diff represented by this TreeNode
+ */
+ public DiffNode(Diff diff) {
+ setData(diff);
+ }
+
+ /**
+ * Add the given DiffNode to the children of this DiffNode. This is intended to be used only for refined
+ * diffs.
+ *
+ * @param diffNode
+ * The DiffNode to add
+ * @return <code>true</code> if the DiffNode has been added
+ */
+ public boolean addRefinedDiffNode(DiffNode diffNode) {
+ return getChildren().add(diffNode);
+ }
+
+ /**
+ * Remove the given DiffNode of the children of this DiffNode. This is intended to be used only for
+ * refined diffs.
+ *
+ * @param diffNode
+ * The DiffNode to remove
+ * @return <code>true</code> if the DiffNode has been removed
+ */
+ public boolean removeRefinedDiffNode(DiffNode diffNode) {
+ return getChildren().remove(diffNode);
+ }
+
+ /**
+ * Getter for the diff represented by this TreeNode.
+ *
+ * @return the diff
+ */
+ public Diff getDiff() {
+ return (Diff)getData();
+ }
+
+ /**
+ * Get all the refined DiffNode that are part of this DiffNode.
+ *
+ * @return an iterable of all refined DiffNode of this diff
+ */
+ public Iterable<DiffNode> getRefinedDiffs() {
+ return Iterables.filter(getChildren(), DiffNode.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchNode.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchNode.java
new file mode 100644
index 000000000..f6b41f9aa
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchNode.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes;
+
+import com.google.common.collect.Iterables;
+
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.edit.tree.impl.TreeNodeImpl;
+
+/**
+ * This class is wrapper for TreeNode used to represent a match TreeNode.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 4.3
+ */
+public class MatchNode extends TreeNodeImpl {
+
+ /**
+ * Constructor.
+ *
+ * @param match
+ * The match represented by this TreeNode
+ */
+ public MatchNode(Match match) {
+ setData(match);
+ }
+
+ /**
+ * Add the given MatchNode to the children of this MatchNode.
+ *
+ * @param matchNode
+ * The MatchNode to add
+ * @return <code>true</code> if the MatchNode has been added
+ */
+ public boolean addSubMatchNode(MatchNode matchNode) {
+ return getChildren().add(matchNode);
+ }
+
+ /**
+ * Add the given DiffNode to the children of this MatchNode.
+ *
+ * @param diffNode
+ * The DiffNode to add
+ * @return <code>true</code> if the DiffNode has been added
+ */
+ public boolean addDiffNode(DiffNode diffNode) {
+ return getChildren().add(diffNode);
+ }
+
+ /**
+ * Remove the given MatchNode of the children of this MatchNode.
+ *
+ * @param matchNode
+ * The MatchNode to remove
+ * @return <code>true</code> if the MatchNode has been removed
+ */
+ public boolean removeSubMatchNode(MatchNode matchNode) {
+ return getChildren().remove(matchNode);
+ }
+
+ /**
+ * Remove the given DiffNode of the children of this MatchNode.
+ *
+ * @param diffNode
+ * The DiffNode to remove
+ * @return <code>true</code> if the DiffNode has been removed
+ */
+ public boolean removeDiffNode(DiffNode diffNode) {
+ return getChildren().remove(diffNode);
+ }
+
+ /**
+ * Getter for the match represented by this TreeNode.
+ *
+ * @return the match
+ */
+ public Match getMatch() {
+ return (Match)getData();
+ }
+
+ /**
+ * Get all the match trees that are submatches of the match
+ *
+ * @return an iterable of all submatches
+ */
+ public Iterable<MatchNode> getSubMatchNodes() {
+ return Iterables.filter(getChildren(), MatchNode.class);
+ }
+
+ /**
+ * Get all the diffs that are part of the match
+ *
+ * @return an iterable of all directly contained diffs
+ */
+ public Iterable<DiffNode> getDiffNodes() {
+ return Iterables.filter(getChildren(), DiffNode.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchResourceNode.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchResourceNode.java
new file mode 100644
index 000000000..268d308fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/nodes/MatchResourceNode.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.nodes;
+
+import com.google.common.collect.Iterables;
+
+import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.edit.tree.impl.TreeNodeImpl;
+
+/**
+ * This class is wrapper for TreeNode used to represent a match resource TreeNode.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 4.3
+ */
+public class MatchResourceNode extends TreeNodeImpl {
+
+ /**
+ * Constructor.
+ *
+ * @param matchResource
+ * The matchResource represented by this TreeNode
+ */
+ public MatchResourceNode(MatchResource matchResource) {
+ setData(matchResource);
+ }
+
+ /**
+ * Add the given DiffNode to the direct children of this MatchResourceNode.
+ *
+ * @param diffNode
+ * The DiffNode to add
+ * @return <code>true</code> if the MatchNode has been added
+ */
+ public boolean addDiffNode(DiffNode diffNode) {
+ return getChildren().add(diffNode);
+ }
+
+ /**
+ * Add the given MatchNode to the children of this MatchResourceNode.
+ *
+ * @param matchNode
+ * The MatchNode to add
+ * @return <code>true</code> if the MatchNode has been added
+ */
+ public boolean addMatchNode(MatchNode matchNode) {
+ return getChildren().add(matchNode);
+ }
+
+ /**
+ * Remove the given DiffNode of the direct children of this MatchResourceNode.
+ *
+ * @param diffNode
+ * The DiffNode to remove
+ * @return <code>true</code> if the DiffNode has been removed
+ */
+ public boolean removeDiffNode(DiffNode diffNode) {
+ return getChildren().remove(diffNode);
+ }
+
+ /**
+ * Remove the given MatchNode of the children of this MatchResourceNode.
+ *
+ * @param matchNode
+ * The MatchNode to remove
+ * @return <code>true</code> if the MatchNode has been removed
+ */
+ public boolean removeMatchNode(MatchNode matchNode) {
+ return getChildren().remove(matchNode);
+ }
+
+ /**
+ * Getter for the match resource represented by this TreeNode.
+ *
+ * @return the matchResource
+ */
+ public MatchResource getMatchResource() {
+ return (MatchResource)getData();
+ }
+
+ /**
+ * Get all the match trees that are part of the MatchResource
+ *
+ * @return an iterable of all MatchNode that are part of the MatchResource
+ */
+ public Iterable<MatchNode> getMatches() {
+ return Iterables.filter(getChildren(), MatchNode.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java
index 636eb96c2..3b0db0519 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java
@@ -26,9 +26,7 @@ import org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.EmptyMatchedResourcesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.IdenticalElementsFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.PseudoConflictsFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
@@ -42,6 +40,7 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -59,9 +58,7 @@ public class UMLDifferencesOrderTest extends AbstractDifferenceOrderTest {
public void before() throws IOException {
super.before();
getFilter().removeFilter(new CascadingDifferencesFilter());
- getFilter().removeFilter(new PseudoConflictsFilter());
- getFilter().removeFilter(new EmptyMatchedResourcesFilter());
- getFilter().removeFilter(new IdenticalElementsFilter());
+ getFilter().removeFilter(new TechnicalitiesFilter());
expectedResult = new ExpectedResultData();
}
@@ -94,6 +91,7 @@ public class UMLDifferencesOrderTest extends AbstractDifferenceOrderTest {
*
* @throws IOException
*/
+ @Ignore("Refining diffs are displayed insinde refined diffs in an order that's not stable.")
@Test
public void testDiffOrder() throws IOException {
UMLRefinedElementsFilter umlRefineFilter = new UMLRefinedElementsFilter();
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithUMLRefineElementFilter.nodes b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithUMLRefineElementFilter.nodes
index 9b5296ff5..9f04cfd0a 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithUMLRefineElementFilter.nodes
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithUMLRefineElementFilter.nodes
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes">
<nodes:Node xmi:id="_CgJ7IOvwEeOe_vfK-oM2bA" name="&lt;Model> model">
- <containmentRef1 xmi:id="_CgR28OvwEeOe_vfK-oM2bA" name="&lt;Package> OldHoldingPackage"/>
<containmentRef1 xmi:id="_CgR28evwEeOe_vfK-oM2bA" name="&lt;Package> NewHoldingPackage">
- <containmentRef1 xmi:id="_CgR28uvwEeOe_vfK-oM2bA" name="&lt;Class> MovingNode [packagedElement move]"/>
+ <containmentRef1 xmi:id="_CgR28uvwEeOe_vfK-oM2bA" name="&lt;Class> MovingNode">
+ <containmentRef1 xmi:id="_CgR28uvwEeOe_vfK-oM2bB" name="&lt;Class> MovingNode [packagedElement move]"/>
+ </containmentRef1>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_CgR2--vwEeOe_vfK-oM2bA" name="&lt;Association> A_associationSource_associationOldTarget_1">
+ <containmentRef1 xmi:id="_CgR2--vwEeOe_vfK-oM2bB" name="&lt;Association> A_associationSource_associationOl... [packagedElement delete]"/>
</containmentRef1>
- <containmentRef1 xmi:id="_CgR28-vwEeOe_vfK-oM2bA" name="&lt;Class> AssociationOldTarget"/>
- <containmentRef1 xmi:id="_CgR29OvwEeOe_vfK-oM2bA" name="&lt;Class> AssociationNewTarget"/>
<containmentRef1 xmi:id="_CgR29evwEeOe_vfK-oM2bA" name="&lt;Class> ChangingNameNode_NewName">
<containmentRef1 xmi:id="_CgR29uvwEeOe_vfK-oM2bA" name="ChangingNameNode_NewName [name changed]"/>
</containmentRef1>
@@ -14,12 +16,16 @@
<containmentRef1 xmi:id="_CgR2-OvwEeOe_vfK-oM2bA" name="PseudoConflictingNode [name changed]"/>
<containmentRef1 xmi:id="_CgR2-evwEeOe_vfK-oM2bA" name="PseudoConflictingNode [name changed]"/>
</containmentRef1>
- <containmentRef1 xmi:id="_CgR2-uvwEeOe_vfK-oM2bA" name="&lt;Class> NewNode [packagedElement add]"/>
- <containmentRef1 xmi:id="_CgR2--vwEeOe_vfK-oM2bA" name="&lt;Association> A_associationSource_associationOl... [packagedElement delete]"/>
- <containmentRef1 xmi:id="_CgR2_OvwEeOe_vfK-oM2bA" name="&lt;Class> NodeToDelete [packagedElement delete]"/>
- <containmentRef1 xmi:id="_CgR2_evwEeOe_vfK-oM2bA" name="&lt;Class> ConflictingNode [packagedElement delete]">
+ <containmentRef1 xmi:id="_CgR2_OvwEeOe_vfK-oM2bA" name="&lt;Class> NodeToDelete">
+ <containmentRef1 xmi:id="_CgR2_OvwEeOe_vfK-oM2bB" name="&lt;Class> NodeToDelete [packagedElement delete]"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_CgR2_evwEeOe_vfK-oM2bA" name="&lt;Class> ConflictingNode">
+ <containmentRef1 xmi:id="_CgR2_evwEeOe_vfK-oM2bB" name="&lt;Class> ConflictingNode [packagedElement delete]"/>
<containmentRef1 xmi:id="_CgR2_uvwEeOe_vfK-oM2bA" name="ConflictingNode_ConflictingName [name set]"/>
</containmentRef1>
+ <containmentRef1 xmi:id="_CgR2-uvwEeOe_vfK-oM2bA" name="&lt;Class> NewNode">
+ <containmentRef1 xmi:id="_CgR2-uvwEeOe_vfK-oM2bA" name="&lt;Class> NewNode [packagedElement add]"/>
+ </containmentRef1>
</nodes:Node>
<nodes:Node xmi:id="_CgU6QOvwEeOe_vfK-oM2bA" name="left.uml &lt;-> right.uml (origin.uml)"/>
</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithoutUMLRefineElementFilter.nodes b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithoutUMLRefineElementFilter.nodes
index eb170b378..9e27ee10e 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithoutUMLRefineElementFilter.nodes
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/data/a1/expectedResultWithoutUMLRefineElementFilter.nodes
@@ -1,107 +1,54 @@
<?xml version="1.0" encoding="ASCII"?>
-<xmi:XMI xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes">
- <nodes:Node
- xmi:id="_CiZ94OvwEeOe_vfK-oM2bA"
- name="&lt;Model> model">
- <containmentRef1
- xmi:id="_CiZ94evwEeOe_vfK-oM2bA"
- name="&lt;Package> OldHoldingPackage"/>
- <containmentRef1
- xmi:id="_CiZ94uvwEeOe_vfK-oM2bA"
- name="&lt;Package> NewHoldingPackage">
- <containmentRef1
- xmi:id="_CiZ94-vwEeOe_vfK-oM2bA"
- name="&lt;Class> MovingNode [packagedElement move]"/>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes">
+ <nodes:Node xmi:id="_p_Iq0FlqEeaOcaiTMa7_Pg" name="&lt;Model> model">
+ <containmentRef1 xmi:id="_p_Iq0VlqEeaOcaiTMa7_Pg" name="&lt;Package> NewHoldingPackage">
+ <containmentRef1 xmi:id="_p_Iq0llqEeaOcaiTMa7_Pg" name="&lt;Class> MovingNode">
+ <containmentRef1 xmi:id="_p_Iq01lqEeaOcaiTMa7_Pg" name="&lt;Class> MovingNode [packagedElement move]"/>
+ </containmentRef1>
</containmentRef1>
- <containmentRef1
- xmi:id="_CiZ95OvwEeOe_vfK-oM2bA"
- name="&lt;Class> AssociationSource">
- <containmentRef1
- xmi:id="_CiZ95evwEeOe_vfK-oM2bA"
- name="&lt;Property> associationOldTarget : AssociationOl... [ownedAttribute delete]">
- <containmentRef1
- xmi:id="_CiZ95uvwEeOe_vfK-oM2bA"
- name="&lt;Class> AssociationOldTarget [type unset]"/>
- <containmentRef1
- xmi:id="_CiZ95-vwEeOe_vfK-oM2bA"
- name="&lt;Literal Integer> 1 [lowerValue delete]"/>
- <containmentRef1
- xmi:id="_CiZ96OvwEeOe_vfK-oM2bA"
- name="&lt;Literal Unlimited Natural> 1 [upperValue delete]"/>
- <containmentRef1
- xmi:id="_CiZ96evwEeOe_vfK-oM2bA"
- name="&lt;Association> A_associationSource_associationOl... [association unset]"/>
+ <containmentRef1 xmi:id="_p_Iq1FlqEeaOcaiTMa7_Pg" name="&lt;Association> A_associationSource_associationOldTarget_1">
+ <containmentRef1 xmi:id="_p_Iq1VlqEeaOcaiTMa7_Pg" name="&lt;Association> A_associationSource_associationOl... [packagedElement delete]">
+ <containmentRef1 xmi:id="_p_Iq1llqEeaOcaiTMa7_Pg" name="&lt;Association> A_associationSource_associationOl... [association unset]"/>
+ <containmentRef1 xmi:id="_p_Iq11lqEeaOcaiTMa7_Pg" name="&lt;Class> AssociationOldTarget [type unset]"/>
+ <containmentRef1 xmi:id="_p_Iq2FlqEeaOcaiTMa7_Pg" name="&lt;Property> associationOldTarget : AssociationOl... [ownedAttribute delete]"/>
+ <containmentRef1 xmi:id="_p_Iq2VlqEeaOcaiTMa7_Pg" name="&lt;Property> associationOldTarget : AssociationOl... [memberEnd delete]"/>
+ <containmentRef1 xmi:id="_p_Iq2llqEeaOcaiTMa7_Pg" name="&lt;Association> A_associationSource_associationOl... [association unset]"/>
+ <containmentRef1 xmi:id="_p_Iq21lqEeaOcaiTMa7_Pg" name="&lt;Association> A_associationSource_associationOl... [packagedElement delete]"/>
+ <containmentRef1 xmi:id="_p_Iq3FlqEeaOcaiTMa7_Pg" name="&lt;Class> AssociationSource [type unset]"/>
+ <containmentRef1 xmi:id="_p_Iq3VlqEeaOcaiTMa7_Pg" name="&lt;Property> associationSource : AssociationSource [memberEnd delete]"/>
+ <containmentRef1 xmi:id="_p_Iq3llqEeaOcaiTMa7_Pg" name="&lt;Property> associationSource : AssociationSource [ownedEnd delete]"/>
+ <containmentRef1 xmi:id="_p_Iq31lqEeaOcaiTMa7_Pg" name="&lt;Property> associationSource : AssociationSource [navigableOwnedEnd delete]"/>
+ <containmentRef1 xmi:id="_p_Iq4FlqEeaOcaiTMa7_Pg" name="&lt;Literal Integer> 1 [lowerValue delete]">
+ <containmentRef1 xmi:id="_p_JR4FlqEeaOcaiTMa7_Pg" name="&lt;Literal Integer> 1 [lowerValue delete]"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_p_JR4VlqEeaOcaiTMa7_Pg" name="&lt;Literal Unlimited Natural> 1 [upperValue delete]">
+ <containmentRef1 xmi:id="_p_JR4llqEeaOcaiTMa7_Pg" name="&lt;Literal Unlimited Natural> 1 [upperValue delete]"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_p_JR41lqEeaOcaiTMa7_Pg" name="&lt;Literal Integer> 1 [lowerValue delete]">
+ <containmentRef1 xmi:id="_p_JR5FlqEeaOcaiTMa7_Pg" name="&lt;Literal Integer> 1 [lowerValue delete]"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_p_JR5VlqEeaOcaiTMa7_Pg" name="&lt;Literal Unlimited Natural> 1 [upperValue delete]">
+ <containmentRef1 xmi:id="_p_JR5llqEeaOcaiTMa7_Pg" name="&lt;Literal Unlimited Natural> 1 [upperValue delete]"/>
+ </containmentRef1>
</containmentRef1>
</containmentRef1>
- <containmentRef1
- xmi:id="_CiZ96uvwEeOe_vfK-oM2bA"
- name="&lt;Class> AssociationOldTarget"/>
- <containmentRef1
- xmi:id="_Ciak8OvwEeOe_vfK-oM2bA"
- name="&lt;Class> AssociationNewTarget"/>
- <containmentRef1
- xmi:id="_Ciak8evwEeOe_vfK-oM2bA"
- name="&lt;Class> ChangingNameNode_NewName">
- <containmentRef1
- xmi:id="_Ciak8uvwEeOe_vfK-oM2bA"
- name="ChangingNameNode_NewName [name changed]"/>
+ <containmentRef1 xmi:id="_p_JR51lqEeaOcaiTMa7_Pg" name="&lt;Class> ChangingNameNode_NewName">
+ <containmentRef1 xmi:id="_p_JR6FlqEeaOcaiTMa7_Pg" name="ChangingNameNode_NewName [name changed]"/>
</containmentRef1>
- <containmentRef1
- xmi:id="_Ciak8-vwEeOe_vfK-oM2bA"
- name="&lt;Class> PseudoConflictingNode_NewName">
- <containmentRef1
- xmi:id="_Ciak9OvwEeOe_vfK-oM2bA"
- name="PseudoConflictingNode [name changed]"/>
- <containmentRef1
- xmi:id="_Ciak9evwEeOe_vfK-oM2bA"
- name="PseudoConflictingNode [name changed]"/>
+ <containmentRef1 xmi:id="_p_JR6VlqEeaOcaiTMa7_Pg" name="&lt;Class> PseudoConflictingNode_NewName">
+ <containmentRef1 xmi:id="_p_JR6llqEeaOcaiTMa7_Pg" name="PseudoConflictingNode [name changed]"/>
+ <containmentRef1 xmi:id="_p_JR61lqEeaOcaiTMa7_Pg" name="PseudoConflictingNode [name changed]"/>
</containmentRef1>
- <containmentRef1
- xmi:id="_Ciak9uvwEeOe_vfK-oM2bA"
- name="&lt;Class> NewNode [packagedElement add]"/>
- <containmentRef1
- xmi:id="_Ciak9-vwEeOe_vfK-oM2bA"
- name="&lt;Association> A_associationSource_associationOl... [packagedElement delete]">
- <containmentRef1
- xmi:id="_Ciak-OvwEeOe_vfK-oM2bA"
- name="&lt;Property> associationSource : AssociationSource [memberEnd delete]"/>
- <containmentRef1
- xmi:id="_Ciak-evwEeOe_vfK-oM2bA"
- name="&lt;Property> associationOldTarget : AssociationOl... [memberEnd delete]"/>
- <containmentRef1
- xmi:id="_Ciak-uvwEeOe_vfK-oM2bA"
- name="&lt;Property> associationSource : AssociationSource [ownedEnd delete]">
- <containmentRef1
- xmi:id="_Ciak--vwEeOe_vfK-oM2bA"
- name="&lt;Class> AssociationSource [type unset]"/>
- <containmentRef1
- xmi:id="_Ciak_OvwEeOe_vfK-oM2bA"
- name="&lt;Literal Integer> 1 [lowerValue delete]"/>
- <containmentRef1
- xmi:id="_Ciak_evwEeOe_vfK-oM2bA"
- name="&lt;Literal Unlimited Natural> 1 [upperValue delete]"/>
- <containmentRef1
- xmi:id="_Ciak_uvwEeOe_vfK-oM2bA"
- name="&lt;Association> A_associationSource_associationOl... [association unset]"/>
- </containmentRef1>
- <containmentRef1
- xmi:id="_Ciak_-vwEeOe_vfK-oM2bA"
- name="&lt;Property> associationSource : AssociationSource [navigableOwnedEnd delete]"/>
+ <containmentRef1 xmi:id="_p_JR7FlqEeaOcaiTMa7_Pg" name="&lt;Class> NodeToDelete">
+ <containmentRef1 xmi:id="_p_JR7VlqEeaOcaiTMa7_Pg" name="&lt;Class> NodeToDelete [packagedElement delete]"/>
+ </containmentRef1>
+ <containmentRef1 xmi:id="_p_JR7llqEeaOcaiTMa7_Pg" name="&lt;Class> ConflictingNode">
+ <containmentRef1 xmi:id="_p_JR71lqEeaOcaiTMa7_Pg" name="&lt;Class> ConflictingNode [packagedElement delete]"/>
+ <containmentRef1 xmi:id="_p_JR8FlqEeaOcaiTMa7_Pg" name="ConflictingNode_ConflictingName [name set]"/>
</containmentRef1>
- <containmentRef1
- xmi:id="_CialAOvwEeOe_vfK-oM2bA"
- name="&lt;Class> NodeToDelete [packagedElement delete]"/>
- <containmentRef1
- xmi:id="_CialAevwEeOe_vfK-oM2bA"
- name="&lt;Class> ConflictingNode [packagedElement delete]">
- <containmentRef1
- xmi:id="_CialAuvwEeOe_vfK-oM2bA"
- name="ConflictingNode_ConflictingName [name set]"/>
+ <containmentRef1 xmi:id="_p_JR8VlqEeaOcaiTMa7_Pg" name="&lt;Class> NewNode">
+ <containmentRef1 xmi:id="_p_JR8llqEeaOcaiTMa7_Pg" name="&lt;Class> NewNode [packagedElement add]"/>
</containmentRef1>
</nodes:Node>
- <nodes:Node
- xmi:id="_CialA-vwEeOe_vfK-oM2bA"
- name="left.uml &lt;-> right.uml (origin.uml)"/>
+ <nodes:Node xmi:id="_p_LHEFlqEeaOcaiTMa7_Pg" name="left.uml &lt;-> right.uml (origin.uml)"/>
</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/DynamicProfileIntegrationDisplayTest.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/DynamicProfileIntegrationDisplayTest.java
index 66e3a0df4..2ae8c8716 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/DynamicProfileIntegrationDisplayTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/DynamicProfileIntegrationDisplayTest.java
@@ -28,8 +28,7 @@ import org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.EmptyMatchedResourcesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.IdenticalElementsFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
@@ -121,8 +120,7 @@ public class DynamicProfileIntegrationDisplayTest extends AbstractDifferenceOrde
@Test
public void testDynamicProfileElementDisplay() throws IOException {
getFilter().addFilter(new UMLRefinedElementsFilter());
- getFilter().addFilter(new EmptyMatchedResourcesFilter());
- getFilter().addFilter(new IdenticalElementsFilter());
+ getFilter().addFilter(new TechnicalitiesFilter());
getFilter().addFilter(new CascadingDifferencesFilter());
IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(), alwaysTrue(),
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/StaticProfileIntegrationDisplayTest.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/StaticProfileIntegrationDisplayTest.java
index 472204871..fdaa70fab 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/StaticProfileIntegrationDisplayTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/StaticProfileIntegrationDisplayTest.java
@@ -27,8 +27,7 @@ import org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.EmptyMatchedResourcesFilter;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.IdenticalElementsFilter;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.TechnicalitiesFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.BasicDifferenceGroupImpl;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
@@ -101,8 +100,7 @@ public class StaticProfileIntegrationDisplayTest extends AbstractDifferenceOrder
@Test
public void testStaticProfileDisplay() throws IOException {
getFilter().addFilter(new UMLRefinedElementsFilter());
- getFilter().addFilter(new EmptyMatchedResourcesFilter());
- getFilter().addFilter(new IdenticalElementsFilter());
+ getFilter().addFilter(new TechnicalitiesFilter());
getFilter().addFilter(new CascadingDifferencesFilter());
IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(), alwaysTrue(),
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/dynamic/expectedResult.nodes b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/dynamic/expectedResult.nodes
index 7833647d2..fcdae35f4 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/dynamic/expectedResult.nodes
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/dynamic/expectedResult.nodes
@@ -1,23 +1,25 @@
-<?xml version="1.0" encoding="ASCII"?>
-<nodes:NodeSingleValueAttribute xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_ZXd1sAEbEeSEjKYb5Aambw" name="&lt;Model> model" singleValuedAttribute="Model.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC8AEbEeSEjKYb5Aambw" name="&lt;Class> NormalClass" singleValuedAttribute="Class.gif,VisibilityKind_protected.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC8QEbEeSEjKYb5Aambw" name="&lt;Property> newProperty [ownedAttribute add]" singleValuedAttribute="Property.gif,add_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC8gEbEeSEjKYb5Aambw" name="protected [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC8wEbEeSEjKYb5Aambw" name="true [isLeaf changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC9AEbEeSEjKYb5Aambw" name="&lt;ACliche> ACliche_Element" singleValuedAttribute="eclipse_luna.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC9QEbEeSEjKYb5Aambw" name="&lt;ACliche2> ACliche2_Element [singleValuedReference changed]" singleValuedAttribute="Class.gif,VisibilityKind_package.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC9gEbEeSEjKYb5Aambw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference delete]" singleValuedAttribute="Class.gif,del_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC9wEbEeSEjKYb5Aambw" name="cliche attribute value [New] [singleValuedAttribute changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC-AEbEeSEjKYb5Aambw" name="Value3 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC-QEbEeSEjKYb5Aambw" name="&lt;ACliche2> ACliche2_Element" singleValuedAttribute="Class.gif,VisibilityKind_package.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC-gEbEeSEjKYb5Aambw" name="package [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC-wEbEeSEjKYb5Aambw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference add]" singleValuedAttribute="Class.gif,VisibilityKind_private.gif,add_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC_AEbEeSEjKYb5Aambw" name="Setting of value [singleValuedAttribute set]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC_QEbEeSEjKYb5Aambw" name="Value1 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC_gEbEeSEjKYb5Aambw" name="&lt;ACliche3> ACliche3_Element" singleValuedAttribute="Class.gif,VisibilityKind_private.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_ZXqC_wEbEeSEjKYb5Aambw" name="private [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- </containmentRef1>
-</nodes:NodeSingleValueAttribute>
+<?xml version="1.0" encoding="ASCII"?>
+<nodes:NodeSingleValueAttribute xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_F2U9sFl3EeaigaO7rTdRnw" name="&lt;Model> model" singleValuedAttribute="Model.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkwFl3EeaigaO7rTdRnw" name="&lt;Class> NormalClass" singleValuedAttribute="Class.gif,VisibilityKind_protected.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkwVl3EeaigaO7rTdRnw" name="protected [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkwll3EeaigaO7rTdRnw" name="true [isLeaf changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkw1l3EeaigaO7rTdRnw" name="&lt;Property> newProperty" singleValuedAttribute="Property.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkxFl3EeaigaO7rTdRnw" name="&lt;Property> newProperty [ownedAttribute add]" singleValuedAttribute="Property.gif,add_ov.gif"/>
+ </containmentRef1>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkxVl3EeaigaO7rTdRnw" name="&lt;ACliche> ACliche_Element" singleValuedAttribute="eclipse_luna.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkxll3EeaigaO7rTdRnw" name="&lt;ACliche2> ACliche2_Element [singleValuedReference changed]" singleValuedAttribute="Class.gif,VisibilityKind_package.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkx1l3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference delete]" singleValuedAttribute="Class.gif,del_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkyFl3EeaigaO7rTdRnw" name="cliche attribute value [New] [singleValuedAttribute changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkyVl3EeaigaO7rTdRnw" name="Value3 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkyll3EeaigaO7rTdRnw" name="&lt;ACliche2> ACliche2_Element" singleValuedAttribute="Class.gif,VisibilityKind_package.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vky1l3EeaigaO7rTdRnw" name="package [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkzFl3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference add]" singleValuedAttribute="Class.gif,VisibilityKind_private.gif,add_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2VkzVl3EeaigaO7rTdRnw" name="Setting of value [singleValuedAttribute set]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkzll3EeaigaO7rTdRnw" name="Value1 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vkz1l3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element" singleValuedAttribute="Class.gif,VisibilityKind_private.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F2Vk0Fl3EeaigaO7rTdRnw" name="private [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ </containmentRef1>
+</nodes:NodeSingleValueAttribute>
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/static_/expectedResult.nodes b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/static_/expectedResult.nodes
index 70267aee7..da238a22b 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/static_/expectedResult.nodes
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/profile/data/static_/expectedResult.nodes
@@ -1,23 +1,25 @@
-<?xml version="1.0" encoding="ASCII"?>
-<nodes:NodeSingleValueAttribute xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_Wfl-wAEdEeSL9_utQEgyiQ" name="&lt;Model> model" singleValuedAttribute="Model.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjMAEdEeSL9_utQEgyiQ" name="&lt;Class> NormalClass" singleValuedAttribute="Class.gif,VisibilityKind_protected.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjMQEdEeSL9_utQEgyiQ" name="&lt;Property> newProperty [ownedAttribute add]" singleValuedAttribute="Property.gif,add_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjMgEdEeSL9_utQEgyiQ" name="protected [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjMwEdEeSL9_utQEgyiQ" name="true [isLeaf changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjNAEdEeSL9_utQEgyiQ" name="&lt;ACliche> ACliche_Element" singleValuedAttribute="eclipse_luna.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjNQEdEeSL9_utQEgyiQ" name="&lt;ACliche2> ACliche2_Element [singleValuedReference changed]" singleValuedAttribute="eclipse_kepler.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjNgEdEeSL9_utQEgyiQ" name="&lt;ACliche3> ACliche3_Element [manyValuedReference delete]" singleValuedAttribute="ACliche3.gif,del_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjNwEdEeSL9_utQEgyiQ" name="cliche attribute value [New] [singleValuedAttribute changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjOAEdEeSL9_utQEgyiQ" name="Value3 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjOQEdEeSL9_utQEgyiQ" name="&lt;ACliche2> ACliche2_Element" singleValuedAttribute="eclipse_kepler.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjOgEdEeSL9_utQEgyiQ" name="package [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjOwEdEeSL9_utQEgyiQ" name="&lt;ACliche3> ACliche3_Element [manyValuedReference add]" singleValuedAttribute="ACliche3.gif,add_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjPAEdEeSL9_utQEgyiQ" name="Setting of value [singleValuedAttribute set]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjPQEdEeSL9_utQEgyiQ" name="Value1 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
- </containmentRef1>
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjPgEdEeSL9_utQEgyiQ" name="&lt;ACliche3> ACliche3_Element" singleValuedAttribute="ACliche3.gif,match_ov.gif">
- <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_WgHjPwEdEeSL9_utQEgyiQ" name="private [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
- </containmentRef1>
-</nodes:NodeSingleValueAttribute>
+<?xml version="1.0" encoding="ASCII"?>
+<nodes:NodeSingleValueAttribute xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes" xmi:id="_F5_VsFl3EeaigaO7rTdRnw" name="&lt;Model> model" singleValuedAttribute="Model.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VsVl3EeaigaO7rTdRnw" name="&lt;Class> NormalClass" singleValuedAttribute="Class.gif,VisibilityKind_protected.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vsll3EeaigaO7rTdRnw" name="protected [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vs1l3EeaigaO7rTdRnw" name="true [isLeaf changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VtFl3EeaigaO7rTdRnw" name="&lt;Property> newProperty" singleValuedAttribute="Property.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VtVl3EeaigaO7rTdRnw" name="&lt;Property> newProperty [ownedAttribute add]" singleValuedAttribute="Property.gif,add_ov.gif"/>
+ </containmentRef1>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vtll3EeaigaO7rTdRnw" name="&lt;ACliche> ACliche_Element" singleValuedAttribute="eclipse_luna.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vt1l3EeaigaO7rTdRnw" name="&lt;ACliche2> ACliche2_Element [singleValuedReference changed]" singleValuedAttribute="eclipse_kepler.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VuFl3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference delete]" singleValuedAttribute="ACliche3.gif,del_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VuVl3EeaigaO7rTdRnw" name="cliche attribute value [New] [singleValuedAttribute changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vull3EeaigaO7rTdRnw" name="Value3 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vu1l3EeaigaO7rTdRnw" name="&lt;ACliche2> ACliche2_Element" singleValuedAttribute="eclipse_kepler.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VvFl3EeaigaO7rTdRnw" name="package [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VvVl3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element [manyValuedReference add]" singleValuedAttribute="ACliche3.gif,add_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vvll3EeaigaO7rTdRnw" name="Setting of value [singleValuedAttribute set]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_Vv1l3EeaigaO7rTdRnw" name="Value1 [manyValuedAttribute add]" singleValuedAttribute="AttributeChange.gif,add_ov.gif"/>
+ </containmentRef1>
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VwFl3EeaigaO7rTdRnw" name="&lt;ACliche3> ACliche3_Element" singleValuedAttribute="ACliche3.gif,match_ov.gif">
+ <containmentRef1 xsi:type="nodes:NodeSingleValueAttribute" xmi:id="_F5_VwVl3EeaigaO7rTdRnw" name="private [visibility changed]" singleValuedAttribute="AttributeChange.gif,chg_ov.gif"/>
+ </containmentRef1>
+</nodes:NodeSingleValueAttribute>
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/structuremergeviewer/filters/UMLRefinedElementsFilter.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/structuremergeviewer/filters/UMLRefinedElementsFilter.java
index ac77b6cfc..29a188a4f 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/structuremergeviewer/filters/UMLRefinedElementsFilter.java
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/structuremergeviewer/filters/UMLRefinedElementsFilter.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.uml2.rcp.ui.internal.structuremergeviewer.filter
import static com.google.common.base.Predicates.instanceOf;
import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import org.eclipse.emf.compare.Comparison;
@@ -101,6 +102,6 @@ public class UMLRefinedElementsFilter extends AbstractDifferenceFilter {
*/
@Override
public Predicate<? super EObject> getPredicateWhenUnselected() {
- return PREDICATE_WHEN_UNSELECTED;
+ return Predicates.alwaysFalse();
}
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/MatchUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/MatchUtil.java
index 0a109ea8b..6dffad702 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/MatchUtil.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/MatchUtil.java
@@ -266,4 +266,28 @@ public final class MatchUtil {
return customSwitch.doSwitch(input);
}
+ /**
+ * Get the object matched by a Match on a given side.
+ *
+ * @param m
+ * The match, must not be <code>null</code>
+ * @param side
+ * The side for which we want the matched value, use <code>null</code> for ORIGIN.
+ * @return The value matched by this match on the given side.
+ * @since 3.4
+ */
+ public static EObject getMatchedObject(Match m, DifferenceSource side) {
+ if (side == null) {
+ return m.getOrigin();
+ }
+ switch (side) {
+ case LEFT:
+ return m.getLeft();
+ case RIGHT:
+ return m.getRight();
+ default:
+ throw new IllegalArgumentException("Value " + side + " is not a valid DifferenceSource."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
}

Back to the top