Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/META-INF/MANIFEST.MF3
-rw-r--r--performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java2
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests.git/src/org/eclipse/emf/compare/diagram/papyrus/tests/resourceattachmentchange/move/AbstractResourceAttachmentChangeMoveTests.java3
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/comparison/DiagramTooltipProviderTest.java130
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/groups/PapyrusDifferencesOrderTest.java59
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java3
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java117
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/contentmergeviewer/notloadedfragment/NotLoadedFragmentItemTest.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/GraphResolutionTest.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverGraphTest.java22
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverWithCustomDependencyProviderTest.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/AbstractTestUITreeNodeItemProviderAdapter.java31
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MergeActionTest.java24
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MockMergeAction.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/PseudoConflictsMergeActionTest.java39
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TestBug470503.java17
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/TooltipProviderTest.java74
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/notloadedfragment/NotLoadedFragmentNodeTest.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java3
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java14
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFResourceMappingMerger.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DefaultResolutionContext.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DependencyGraphUpdater.java6
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/IResolutionContext.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyLocalResolver.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyProvider.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ThreadedModelResolver.java46
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/registry/ModelResolverDescriptor.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java27
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllNonConflictingAction.java11
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeContainedNonConflictingAction.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeNonConflictingRunnable.java6
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/TestBasicDifferenceGroupImpl.java2
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/AbstractTestTreeNodeItemProviderAdapter.java7
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/EMFCompareRCPUIPlugin.java17
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java6
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/item/impl/MergeViewerItem.java4
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeItemProviderAdapterFactorySpec.java12
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeNodeItemProviderSpec.java22
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/ResourceUIUtil.java31
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java42
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/graph/IGraphConsumer.java46
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties6
-rw-r--r--plugins/org.eclipse.emf.compare.specifications/src/3.2.0-release.mediawiki30
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/utils/GraphTest.java33
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/src/org/eclipse/emf/compare/uml2/ide/ui/tests/comparison/tooltip/UMLTooltipProviderTest.java82
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/AbstractDifferenceOrderTest.java2
-rw-r--r--plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/UMLDifferencesOrderTest.java8
-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/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraph.java246
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraphView.java151
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/PruningIterator.java (renamed from plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/PruningIterator.java)5
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java7
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java4
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ReadOnlyGraph.java109
64 files changed, 1084 insertions, 602 deletions
diff --git a/performance/org.eclipse.emf.compare.tests.performance/META-INF/MANIFEST.MF b/performance/org.eclipse.emf.compare.tests.performance/META-INF/MANIFEST.MF
index 788ca9f31..902691258 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/META-INF/MANIFEST.MF
+++ b/performance/org.eclipse.emf.compare.tests.performance/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface,
org.eclipse.egit.core,
org.eclipse.jgit,
- org.eclipse.team.core
+ org.eclipse.team.core,
+ org.eclipse.emf.compare.rcp;bundle-version="2.4.0"
Import-Package: com.google.common.base;version="[11.0.0,16.0.0)",
com.google.common.collect;version="[11.0.0,16.0.0)",
com.google.common.io;version="[11.0.0,16.0.0)"
diff --git a/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java b/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
index 71f3dc960..753e54ae5 100644
--- a/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
+++ b/performance/org.eclipse.emf.compare.tests.performance/src/data/models/DataGit.java
@@ -57,6 +57,7 @@ import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.match.DefaultMatchEngine;
import org.eclipse.emf.compare.match.IMatchEngine;
import org.eclipse.emf.compare.postprocessor.IPostProcessor;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.req.DefaultReqEngine;
import org.eclipse.emf.compare.req.IReqEngine;
import org.eclipse.emf.compare.scope.IComparisonScope;
@@ -161,6 +162,7 @@ public class DataGit {
final ITypedElement right = new StorageTypedElement(remoteProvider.getStorage(m), fullPath);
final ITypedElement origin = new StorageTypedElement(ancestorProvider.getStorage(m), fullPath);
final ThreadedModelResolver resolver = new ThreadedModelResolver();
+ EMFCompareRCPPlugin.getDefault().register(resolver);
resolver.initialize();
final ComparisonScopeBuilder scopeBuilder = new ComparisonScopeBuilder(resolver,
new IdenticalResourceMinimizer(), storageAccessor);
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests.git/src/org/eclipse/emf/compare/diagram/papyrus/tests/resourceattachmentchange/move/AbstractResourceAttachmentChangeMoveTests.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests.git/src/org/eclipse/emf/compare/diagram/papyrus/tests/resourceattachmentchange/move/AbstractResourceAttachmentChangeMoveTests.java
index 5183289da..48a6e8ce8 100644
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests.git/src/org/eclipse/emf/compare/diagram/papyrus/tests/resourceattachmentchange/move/AbstractResourceAttachmentChangeMoveTests.java
+++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests.git/src/org/eclipse/emf/compare/diagram/papyrus/tests/resourceattachmentchange/move/AbstractResourceAttachmentChangeMoveTests.java
@@ -43,6 +43,8 @@ import org.eclipse.emf.compare.ide.ui.logical.IStorageProvider;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
+import org.eclipse.emf.compare.internal.utils.Graph;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -189,6 +191,7 @@ public class AbstractResourceAttachmentChangeMoveTests extends CompareTestCase {
final ITypedElement right = new StorageTypedElement(remoteProvider.getStorage(monitor), fullPath);
final ITypedElement origin = new StorageTypedElement(ancestorProvider.getStorage(monitor), fullPath);
final ThreadedModelResolver resolver = new ThreadedModelResolver();
+ resolver.setGraph(new Graph<URI>());
resolver.initialize();
final ComparisonScopeBuilder scopeBuilder = new ComparisonScopeBuilder(resolver,
new IdenticalResourceMinimizer(), storageAccessor);
diff --git a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/comparison/DiagramTooltipProviderTest.java b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/comparison/DiagramTooltipProviderTest.java
index 663d297f2..6da9004ff 100644
--- a/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/comparison/DiagramTooltipProviderTest.java
+++ b/plugins/org.eclipse.emf.compare.diagram.papyrus.tests/src/org/eclipse/emf/compare/diagram/papyrus/tests/comparison/DiagramTooltipProviderTest.java
@@ -18,6 +18,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.Collection;
@@ -43,7 +44,8 @@ import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.provider.TooltipLabelAdapterFactory;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
@@ -55,9 +57,7 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
@SuppressWarnings("nls")
@@ -75,28 +75,27 @@ public class DiagramTooltipProviderTest extends AbstractTest {
private TreeNode moveEdge;
- @BeforeClass
- public static void beforeClass() {
+ private EventBus eventBus;
+
+ private TreeItemProviderAdapterFactorySpec treeItemProviderAdapterFactorySpec;
+
+ @SuppressWarnings("restriction")
+ @Before
+ public void setup() throws Exception {
+
final Collection<AdapterFactory> factories = Lists.newArrayList();
factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
+ eventBus = new EventBus();
+ treeItemProviderAdapterFactorySpec = new TreeItemProviderAdapterFactorySpec(
+ new StructureMergeViewerFilter(eventBus));
+ factories.add(treeItemProviderAdapterFactorySpec);
factories.add(new EcoreItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
factories.add(new TooltipLabelAdapterFactory());
composedAdapterFactory = new ComposedAdapterFactory(factories);
- }
-
- @AfterClass
- public static void afterClass() {
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(null);
- }
- @SuppressWarnings("restriction")
- @Before
- public void setup() throws Exception {
-
- TreeItemProviderAdapterFactorySpec treeItemProviderAdapterFactorySpec = new TreeItemProviderAdapterFactorySpec();
- itemProvider = (TreeNodeItemProviderSpec)treeItemProviderAdapterFactorySpec.createTreeNodeAdapter();
+ itemProvider = (TreeNodeItemProviderSpec) treeItemProviderAdapterFactorySpec
+ .createTreeNodeAdapter();
mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
final Resource origin = input.getOrigin();
@@ -107,7 +106,8 @@ public class DiagramTooltipProviderTest extends AbstractTest {
Comparison comparison = buildComparison(left, right, origin);
EList<Diff> differences = comparison.getDifferences();
- Iterator<EdgeChange> iterator = Iterables.filter(differences, EdgeChange.class).iterator();
+ Iterator<EdgeChange> iterator = Iterables.filter(differences,
+ EdgeChange.class).iterator();
assertTrue(iterator.hasNext());
final EdgeChange diff = iterator.next();
assertFalse(iterator.hasNext());
@@ -117,7 +117,7 @@ public class DiagramTooltipProviderTest extends AbstractTest {
Predicate<EObject> predicate = new Predicate<EObject>() {
public boolean apply(EObject input) {
if (input instanceof TreeNode) {
- TreeNode node = (TreeNode)input;
+ TreeNode node = (TreeNode) input;
if (node.getData() == diff) {
return true;
}
@@ -126,10 +126,10 @@ public class DiagramTooltipProviderTest extends AbstractTest {
}
};
for (TreeNode nodeRootMatch : nodeRootMatchs) {
- UnmodifiableIterator<EObject> treeNode = Iterators
- .filter(nodeRootMatch.eAllContents(), predicate);
+ UnmodifiableIterator<EObject> treeNode = Iterators.filter(
+ nodeRootMatch.eAllContents(), predicate);
if (treeNode != null && treeNode.hasNext()) {
- moveEdge = (TreeNode)treeNode.next();
+ moveEdge = (TreeNode) treeNode.next();
break;
}
}
@@ -141,20 +141,16 @@ public class DiagramTooltipProviderTest extends AbstractTest {
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable,
+ rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry,
+ accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
String tooltipText = action.getToolTipText();
- String expectedtTooltip = EMFCompareDiagramEditMessages.getString("reject.change.tooltip");
+ String expectedtTooltip = EMFCompareDiagramEditMessages
+ .getString("reject.change.tooltip");
assertEquals(expectedtTooltip, tooltipText);
}
@@ -164,20 +160,16 @@ public class DiagramTooltipProviderTest extends AbstractTest {
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable,
+ rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry,
+ accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
String tooltipText = action.getToolTipText();
- String expectedtTooltip = EMFCompareDiagramEditMessages.getString("accept.change.tooltip");
+ String expectedtTooltip = EMFCompareDiagramEditMessages
+ .getString("accept.change.tooltip");
assertEquals(expectedtTooltip, tooltipText);
}
@@ -187,20 +179,16 @@ public class DiagramTooltipProviderTest extends AbstractTest {
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable,
+ rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry,
+ accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
String tooltipText = action.getToolTipText();
- String expectedtTooltip = EMFCompareDiagramEditMessages.getString("merged.to.right.tooltip");
+ String expectedtTooltip = EMFCompareDiagramEditMessages
+ .getString("merged.to.right.tooltip");
assertEquals(expectedtTooltip, tooltipText);
}
@@ -210,20 +198,16 @@ public class DiagramTooltipProviderTest extends AbstractTest {
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable,
+ rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry,
+ accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
String tooltipText = action.getToolTipText();
- String expectedtTooltip = EMFCompareDiagramEditMessages.getString("merged.to.left.tooltip");
+ String expectedtTooltip = EMFCompareDiagramEditMessages
+ .getString("merged.to.left.tooltip");
assertEquals(expectedtTooltip, tooltipText);
}
@@ -232,21 +216,23 @@ public class DiagramTooltipProviderTest extends AbstractTest {
return input;
}
- private static Iterable<TreeNode> getNodeRootMatch(Comparison comparison) throws IOException {
+ private static Iterable<TreeNode> getNodeRootMatch(Comparison comparison)
+ throws IOException {
TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
treeNode.setData(comparison);
treeNode.eAdapters().add(new DefaultGroupProvider());
Collection<?> children = itemProvider.getChildren(treeNode);
- Iterable<TreeNode> matches = (Iterable<TreeNode>)filter(children, matchTreeNode);
+ Iterable<TreeNode> matches = (Iterable<TreeNode>) filter(children,
+ matchTreeNode);
return matches;
}
public static Predicate<Object> matchTreeNode = new Predicate<Object>() {
public boolean apply(Object object) {
if (object instanceof TreeNode) {
- EObject data = ((TreeNode)object).getData();
+ EObject data = ((TreeNode) object).getData();
if (data instanceof Match) {
return true;
}
@@ -255,4 +241,16 @@ public class DiagramTooltipProviderTest extends AbstractTest {
}
};
+ private IEMFCompareConfiguration createConfiguration(boolean leftEditable,
+ boolean rightEditable) {
+ CompareConfiguration cc = new CompareConfiguration();
+ cc.setLeftEditable(leftEditable);
+ cc.setRightEditable(rightEditable);
+ EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ emfCC.setEditingDomain(editingDomain);
+ emfCC.setAdapterFactory(composedAdapterFactory);
+
+ return emfCC;
+ }
+
}
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 d1de8eceb..326cfe7d9 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
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.diagram.papyrus.tests.groups;
import static com.google.common.base.Predicates.alwaysTrue;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.List;
@@ -28,6 +29,7 @@ import org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl;
import org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry;
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;
@@ -53,8 +55,8 @@ import org.junit.Before;
import org.junit.Test;
/**
- * Tests the order of the differences they would be displayed in the structure
- * merge viewer for MDT Papyrus model.
+ * Tests the order of the differences they would be displayed in the structure merge viewer for MDT Papyrus
+ * model.
*
* @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
*/
@@ -65,6 +67,8 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
*/
private ExpectedResultData expectedResultData;
+ private EventBus eventBus;
+
@Before
@Override
public void before() throws IOException {
@@ -83,15 +87,13 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
PostProcessorDescriptorRegistryImpl<Object> postProcessorRegistry = new PostProcessorDescriptorRegistryImpl<Object>();
// Adds UML post processor
BasicPostProcessorDescriptorImpl descriptor = new BasicPostProcessorDescriptorImpl(
- new UMLPostProcessor(),
- Pattern.compile("http://www.eclipse.org/uml2/\\d.0.0/UML"), null); //$NON-NLS-1$
+ new UMLPostProcessor(), Pattern.compile("http://www.eclipse.org/uml2/\\d.0.0/UML"), null); //$NON-NLS-1$
postProcessorRegistry.put(UMLPostProcessor.class.getName(), descriptor);
// Adds Diagram post processor
BasicPostProcessorDescriptorImpl descriptor2 = new BasicPostProcessorDescriptorImpl(
- new CompareDiagramPostProcessor(),
- Pattern.compile("http://www.eclipse.org/gmf/runtime/\\d.\\d.\\d/notation"), null); //$NON-NLS-1$
- postProcessorRegistry.put(CompareDiagramPostProcessor.class.getName(),
- descriptor2);
+ new CompareDiagramPostProcessor(), Pattern
+ .compile("http://www.eclipse.org/gmf/runtime/\\d.\\d.\\d/notation"), null); //$NON-NLS-1$
+ postProcessorRegistry.put(CompareDiagramPostProcessor.class.getName(), descriptor2);
return postProcessorRegistry;
}
@@ -102,17 +104,14 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
@Override
protected List<AdapterFactory> getAdaptersFactory() {
- return Lists.<AdapterFactory> newArrayList(
- new CompareItemProviderAdapterFactorySpec(),
- new TreeItemProviderAdapterFactorySpec(),
- new UMLCompareCustomItemProviderAdapterFactory(),
- new UMLItemProviderAdapterFactory(),
+ eventBus = new EventBus();
+ return Lists.<AdapterFactory> newArrayList(new CompareItemProviderAdapterFactorySpec(),
+ new TreeItemProviderAdapterFactorySpec(new StructureMergeViewerFilter(eventBus)),
+ new UMLCompareCustomItemProviderAdapterFactory(), new UMLItemProviderAdapterFactory(),
new UMLCompareItemProviderDecoratorAdapterFactory(),
- new ReflectiveItemProviderAdapterFactory(),
- new NotationAdapterFactory(),
+ new ReflectiveItemProviderAdapterFactory(), new NotationAdapterFactory(),
new ExtensionsItemProviderAdapterFactorySpec(),
- new DiagramCompareItemProviderAdapterFactorySpec(),
- new NotationItemProviderAdapterFactory());
+ new DiagramCompareItemProviderAdapterFactorySpec(), new NotationItemProviderAdapterFactory());
}
@Test
@@ -120,8 +119,8 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
GMFRefinedElementsFilter diagramFilter = new GMFRefinedElementsFilter();
getFilter().removeFilter(diagramFilter);
- IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(),
- alwaysTrue(), getCrossReferenceAdapter());
+ IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(), alwaysTrue(),
+ getCrossReferenceAdapter());
List<? extends TreeNode> roots = group.getChildren();
// Uncomment the following lines to reserialize the expected model
@@ -129,8 +128,7 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
// writerHelper.createExpectedModel(PATH_TO_MODEL_FILE+"/expectedResult_DiagRefineOff.nodes",
// roots,false);
- compareTree(expectedResultData.getExpectedReseultWithFilterOff(),
- roots, false);
+ compareTree(expectedResultData.getExpectedReseultWithFilterOff(), roots, false);
}
@Test
@@ -138,8 +136,8 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
GMFRefinedElementsFilter diagramFilter = new GMFRefinedElementsFilter();
getFilter().addFilter(diagramFilter);
- IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(),
- alwaysTrue(), getCrossReferenceAdapter());
+ IDifferenceGroup group = new BasicDifferenceGroupImpl(getComparison(), alwaysTrue(),
+ getCrossReferenceAdapter());
List<? extends TreeNode> roots = group.getChildren();
// Uncomment the following lines to reserialize the expected model
@@ -147,8 +145,7 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
// writerHelper.createExpectedModel(PATH_TO_MODEL_FILE+"/expectedResult_DiagRefineOn.nodes",
// roots);
- compareTree(expectedResultData.getExpectedReseultWithFilterOn(), roots,
- false);
+ compareTree(expectedResultData.getExpectedReseultWithFilterOn(), roots, false);
}
/**
@@ -172,22 +169,18 @@ public class PapyrusDifferencesOrderTest extends AbstractDifferenceOrderTest {
*
* @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
*/
- private static final class InputData extends DiagramInputData implements
- NotifierScopeProvider {
+ private static final class InputData extends DiagramInputData implements NotifierScopeProvider {
public ResourceSet getLeft() throws IOException {
- return loadFromClassLoader("data/a1/left.notation")
- .getResourceSet();
+ return loadFromClassLoader("data/a1/left.notation").getResourceSet();
}
public ResourceSet getRight() throws IOException {
- return loadFromClassLoader("data/a1/right.notation")
- .getResourceSet();
+ return loadFromClassLoader("data/a1/right.notation").getResourceSet();
}
public ResourceSet getOrigin() throws IOException {
- return loadFromClassLoader("data/a1/origin.notation")
- .getResourceSet();
+ return loadFromClassLoader("data/a1/origin.notation").getResourceSet();
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
index 2e5c1f84a..ab0b607ef 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/egit/CompareGitTestCase.java
@@ -26,6 +26,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.GitCorePreferences;
import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.EMFCompare;
@@ -40,6 +41,7 @@ import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
import org.eclipse.emf.compare.ide.ui.tests.egit.fixture.GitTestRepository;
import org.eclipse.emf.compare.ide.ui.tests.egit.fixture.MockSystemReader;
+import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -136,6 +138,7 @@ public class CompareGitTestCase extends CompareTestCase {
final ITypedElement right = new StorageTypedElement(remoteProvider.getStorage(monitor), fullPath);
final ITypedElement origin = new StorageTypedElement(ancestorProvider.getStorage(monitor), fullPath);
final ThreadedModelResolver resolver = new ThreadedModelResolver();
+ resolver.setGraph(new Graph<URI>());
resolver.initialize();
final ComparisonScopeBuilder scopeBuilder = new ComparisonScopeBuilder(resolver,
new IdenticalResourceMinimizer(), storageAccessor);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java
index 7f4cca494..350fbd87d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverLocalTest.java
@@ -35,6 +35,8 @@ import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraphView;
+import org.eclipse.emf.compare.graph.PruningIterator;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.internal.logical.EMFModelProvider;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.CrossReferenceResolutionScope;
@@ -44,7 +46,6 @@ import org.eclipse.emf.compare.ide.ui.tests.egit.CompareGitTestCase;
import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
import org.eclipse.emf.compare.ide.utils.ResourceUtil;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
-import org.eclipse.emf.compare.internal.utils.PruningIterator;
import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -1802,7 +1803,7 @@ public class ModelResolverLocalTest extends CompareGitTestCase {
ThreadedModelResolver resolver = new ThreadedModelResolver();
resolver.initialize();
StorageTraversal traversal = resolver.resolveLocalModel(file, new NullProgressMonitor());
- Set<Set<URI>> subGraphs = getSubGraphs(resolver.getDependencyGraph());
+ Set<Set<URI>> subGraphs = getSubGraphs(resolver.getGraphView());
return new ResolvingResult(subGraphs, traversal);
}
@@ -1814,7 +1815,7 @@ public class ModelResolverLocalTest extends CompareGitTestCase {
return Sets.<IStorage> newLinkedHashSet(Arrays.asList(storages));
}
- private Set<Set<URI>> getSubGraphs(ReadOnlyGraph<URI> graph) {
+ private Set<Set<URI>> getSubGraphs(IGraphView<URI> graph) {
PruningIterator<URI> iterator = graph.breadthFirstIterator();
Set<URI> roots = new LinkedHashSet<URI>();
while (iterator.hasNext()) {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java
index 8c95fc9cb..a25ea9f4d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ModelResolverRemoteTest.java
@@ -39,6 +39,8 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraphView;
+import org.eclipse.emf.compare.graph.PruningIterator;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.internal.logical.EMFModelProvider;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.CrossReferenceResolutionScope;
@@ -51,7 +53,6 @@ import org.eclipse.emf.compare.ide.ui.tests.egit.CompareGitTestCase;
import org.eclipse.emf.compare.ide.ui.tests.workspace.TestProject;
import org.eclipse.emf.compare.ide.utils.ResourceUtil;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
-import org.eclipse.emf.compare.internal.utils.PruningIterator;
import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -730,11 +731,11 @@ public class ModelResolverRemoteTest extends CompareGitTestCase {
DiffSide.ORIGIN).getStorage(nullMonitor);
SynchronizationModel syncModel = resolver.resolveModels(accessor,
leftStorage, rightStorage, originStorage, nullMonitor);
- Set<Set<URI>> subGraphs = getSubGraphs(resolver.getDependencyGraph());
+ Set<Set<URI>> subGraphs = getSubGraphs(resolver.getGraphView());
return new ResolvingResult(subGraphs, syncModel);
}
- private Set<Set<URI>> getSubGraphs(ReadOnlyGraph<URI> graph) {
+ private Set<Set<URI>> getSubGraphs(IGraphView<URI> graph) {
PruningIterator<URI> iterator = graph.breadthFirstIterator();
Set<URI> roots = new LinkedHashSet<URI>();
while (iterator.hasNext()) {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java
index d636b8d1c..01067325d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests.git/src/org/eclipse/emf/compare/ide/ui/tests/unit/ThreadedModelResolverResolutionTest.java
@@ -22,12 +22,14 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.ide.ui.internal.logical.StorageTypedElement;
import org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.ide.ui.logical.SynchronizationModel;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
+import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.ecore.resource.Resource;
import org.junit.Test;
@@ -56,73 +58,74 @@ public class ThreadedModelResolverResolutionTest extends AbstractGitLogicalModel
@Test
public void testRemoteResolutionWithIncomingLogicalModel() throws Exception {
- setupRepositoryWithRemoteIncomingLogicalModel();
+ setupRepositoryWithRemoteIncomingLogicalModel();
- ThreadedModelResolver resolver = new ThreadedModelResolver();
- resolver.initialize();
+ ThreadedModelResolver resolver = new ThreadedModelResolver();
+ resolver.setGraph(new Graph<URI>());
+ resolver.initialize();
- IStorageProviderAccessor storageAccessor = createRemoteAccessorForComparison(MASTER, BRANCH, iFile3);
+ IStorageProviderAccessor storageAccessor = createRemoteAccessorForComparison(MASTER, BRANCH, iFile3);
- StreamAccessorStorage file3Storage = StreamAccessorStorage.fromTypedElement(new StorageTypedElement(
- iFile3, iFile3.getFullPath().toOSString()));
+ StreamAccessorStorage file3Storage = StreamAccessorStorage.fromTypedElement(new StorageTypedElement(
+ iFile3, iFile3.getFullPath().toOSString()));
- SynchronizationModel synchronizationModel = resolver.resolveModels(storageAccessor, iFile3,
- file3Storage, null, monitor);
+ SynchronizationModel synchronizationModel = resolver.resolveModels(storageAccessor, iFile3,
+ file3Storage, null, monitor);
- StorageTraversal rightTraversal = synchronizationModel.getRightTraversal();
- StorageTraversal leftTraversal = synchronizationModel.getLeftTraversal();
+ StorageTraversal rightTraversal = synchronizationModel.getRightTraversal();
+ StorageTraversal leftTraversal = synchronizationModel.getLeftTraversal();
- /*
- * leftTraversal should be empty, since file3 and file4 do not exist locally
- */
- assertTrue(leftTraversal.getStorages().isEmpty());
+ /*
+ * leftTraversal should be empty, since file3 and file4 do not exist locally
+ */
+ assertTrue(leftTraversal.getStorages().isEmpty());
- /*
- * rightTraversal should contain file3 and file4, since file3 has a reference to file4
- */
- assertEquals(2, rightTraversal.getStorages().size());
- assertContainsFile(rightTraversal, iFile3);
- assertContainsFile(rightTraversal, iFile4);
+ /*
+ * rightTraversal should contain file3 and file4, since file3 has a reference to file4
+ */
+ assertEquals(2, rightTraversal.getStorages().size());
+ assertContainsFile(rightTraversal, iFile3);
+ assertContainsFile(rightTraversal, iFile4);
}
/**
* Creates a repository in which branch BRANCH forks from MASTER and contains two new files forming a
- * logical model (file3 and file4, with file3 containing a reference to file4). Checked out is MASTER
- * and file3 and file4 do not exist locally.
+ * logical model (file3 and file4, with file3 containing a reference to file4). Checked out is MASTER and
+ * file3 and file4 do not exist locally.
*
* @throws Exception
* if something went wrong.
*/
private void setupRepositoryWithRemoteIncomingLogicalModel() throws Exception {
- resource1.getContents().add(createBasicModel("1"));
- resource2.getContents().add(createBasicModel("2"));
- makeCrossReference(resource1, resource2);
- save(resource1, resource2);
-
- repository.addAndCommit(project, "master-commit-1", file1, file2);
-
- resource3 = createAndConnectResource("file3.ecore");
- resource3.getContents().add(createBasicModel("3"));
- save(resource3);
- file3 = project.getOrCreateFile(iProject, "file3.ecore");
- iFile3 = project.getIFile(iProject, file3);
-
- resource4 = createAndConnectResource("file4.ecore");
- resource4.getContents().add(createBasicModel("4"));
- save(resource4);
- file4 = project.getOrCreateFile(iProject, "file4.ecore");
- iFile4 = project.getIFile(iProject, file4);
-
- makeCrossReference(resource3, resource4);
- save(resource3, resource4);
-
- repository.createBranch(MASTER, BRANCH);
- repository.checkoutBranch(BRANCH);
- reload(resource1, resource2, resource3, resource4);
- repository.addAndCommit(project, "branch-commit-1", file3, file4);
-
- repository.checkoutBranch(MASTER);
- reload(resource1, resource2);
+ resource1.getContents().add(createBasicModel("1"));
+ resource2.getContents().add(createBasicModel("2"));
+ makeCrossReference(resource1, resource2);
+ save(resource1, resource2);
+
+ repository.addAndCommit(project, "master-commit-1", file1, file2);
+
+ resource3 = createAndConnectResource("file3.ecore");
+ resource3.getContents().add(createBasicModel("3"));
+ save(resource3);
+ file3 = project.getOrCreateFile(iProject, "file3.ecore");
+ iFile3 = project.getIFile(iProject, file3);
+
+ resource4 = createAndConnectResource("file4.ecore");
+ resource4.getContents().add(createBasicModel("4"));
+ save(resource4);
+ file4 = project.getOrCreateFile(iProject, "file4.ecore");
+ iFile4 = project.getIFile(iProject, file4);
+
+ makeCrossReference(resource3, resource4);
+ save(resource3, resource4);
+
+ repository.createBranch(MASTER, BRANCH);
+ repository.checkoutBranch(BRANCH);
+ reload(resource1, resource2, resource3, resource4);
+ repository.addAndCommit(project, "branch-commit-1", file3, file4);
+
+ repository.checkoutBranch(MASTER);
+ reload(resource1, resource2);
}
/**
@@ -134,15 +137,15 @@ public class ThreadedModelResolverResolutionTest extends AbstractGitLogicalModel
* The file to look for in the traversal.
*/
private void assertContainsFile(StorageTraversal traversal, final IFile iFile) {
- assertTrue(Iterables.any(traversal.getStorages(), containsFile(iFile)));
+ assertTrue(Iterables.any(traversal.getStorages(), containsFile(iFile)));
}
private static Predicate<IStorage> containsFile(final IFile iFile) {
- return new Predicate<IStorage>() {
- public boolean apply(IStorage input) {
- return iFile.getName().equals(input.getName());
- }
- };
+ return new Predicate<IStorage>() {
+ public boolean apply(IStorage input) {
+ return iFile.getName().equals(input.getName());
+ }
+ };
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/contentmergeviewer/notloadedfragment/NotLoadedFragmentItemTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/contentmergeviewer/notloadedfragment/NotLoadedFragmentItemTest.java
index 0b018d741..4ba04b37c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/contentmergeviewer/notloadedfragment/NotLoadedFragmentItemTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/contentmergeviewer/notloadedfragment/NotLoadedFragmentItemTest.java
@@ -18,6 +18,7 @@ import static org.junit.Assert.assertTrue;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.File;
import java.io.IOException;
@@ -25,7 +26,6 @@ import java.net.URL;
import java.util.Collection;
import java.util.List;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -38,13 +38,11 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder;
import org.eclipse.emf.compare.ide.ui.internal.logical.IdenticalResourceMinimizer;
import org.eclipse.emf.compare.ide.ui.internal.logical.StorageTypedElement;
@@ -52,10 +50,9 @@ import org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.item.impl.MergeViewerItem;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.util.MergeViewerUtil;
import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
@@ -67,7 +64,7 @@ import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -80,11 +77,14 @@ public class NotLoadedFragmentItemTest {
private static String SEP = File.separator;
- @BeforeClass
- public static void beforeClass() {
+ private EventBus eventBus;
+
+ @Before
+ public void setup() {
final Collection<AdapterFactory> factories = Lists.newArrayList();
factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
+ eventBus = new EventBus();
+ factories.add(new TreeItemProviderAdapterFactorySpec(new StructureMergeViewerFilter(eventBus)));
factories.add(new EcoreItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
@@ -125,11 +125,6 @@ public class NotLoadedFragmentItemTest {
final IComparisonScope scope = scopeBuilder.build(left, right, null, new NullProgressMonitor());
final Comparison comparison = EMFCompare.builder().build().compare(scope);
- ReadOnlyGraph<URI> graph = ((ThreadedModelResolver)resolver).getDependencyGraph();
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(new CompareConfiguration());
- emfCC.setResourcesGraph(graph);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
return comparison;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/GraphResolutionTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/GraphResolutionTest.java
index 02d6a5561..564d15549 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/GraphResolutionTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/GraphResolutionTest.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.EMFCompare;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder;
import org.eclipse.emf.compare.ide.ui.internal.logical.IdenticalResourceMinimizer;
@@ -25,7 +26,7 @@ import org.eclipse.emf.compare.ide.ui.internal.logical.StorageTypedElement;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
+import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.junit.Test;
@@ -103,7 +104,7 @@ public class GraphResolutionTest extends CompareTestCase {
new NullProgressMonitor());
final Comparison comparison = EMFCompare.builder().build().compare(scope);
- ReadOnlyGraph<URI> graph = ((ThreadedModelResolver)resolver).getDependencyGraph();
+ IGraphView<URI> graph = ((ThreadedModelResolver)resolver).getGraphView();
assertTrue(graph.getDirectParents(getURI(leftR4)).contains(getURI(leftR3)));
assertTrue(graph.getDirectParents(getURI(leftR3)).contains(getURI(leftR2)));
@@ -136,9 +137,10 @@ public class GraphResolutionTest extends CompareTestCase {
@Test
public void testModelResolver() throws Exception {
ThreadedModelResolver resolver = new ThreadedModelResolver();
+ resolver.setGraph(new Graph<URI>());
resolver.initialize();
resolver.resolveLocalModels(leftR1, rightR1, originR1, new NullProgressMonitor());
- ReadOnlyGraph<URI> graph = resolver.getDependencyGraph();
+ IGraphView<URI> graph = resolver.getGraphView();
assertTrue(graph.getDirectParents(getURI(leftR4)).contains(getURI(leftR3)));
assertTrue(graph.getDirectParents(getURI(leftR3)).contains(getURI(leftR2)));
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverGraphTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverGraphTest.java
index b180e705a..682d9a793 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverGraphTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverGraphTest.java
@@ -30,6 +30,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder;
import org.eclipse.emf.compare.ide.ui.internal.logical.IdenticalResourceMinimizer;
@@ -38,7 +39,6 @@ import org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -55,7 +55,7 @@ public class ThreadedModelResolverGraphTest {
private static String PLATFORM_RESOURCE = "platform:" + URI_SEP + "resource";
- private ReadOnlyGraph<URI> initGraph(String projectName) throws IOException, CoreException {
+ private IGraphView<URI> initGraph(String projectName) throws IOException, CoreException {
Bundle bundle = Platform.getBundle("org.eclipse.emf.compare.ide.ui.tests");
URL entry = bundle.getEntry("src" + SEP + "org" + SEP + "eclipse" + SEP + "emf" + SEP + "compare"
+ SEP + "ide" + SEP + "ui" + SEP + "tests" + SEP + "structuremergeviewer" + SEP
@@ -87,13 +87,13 @@ public class ThreadedModelResolverGraphTest {
new IdenticalResourceMinimizer(), null);
scopeBuilder.build(left, right, null, new NullProgressMonitor());
- return ((ThreadedModelResolver)resolver).getDependencyGraph();
+ return ((ThreadedModelResolver)resolver).getGraphView();
}
@Test
public void testCase0_GetParentData() throws IOException, CoreException {
String projectName = "case0";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + URI_SEP + "R1.ecore",
@@ -112,7 +112,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase1_GetParentData() throws IOException, CoreException {
String projectName = "case1";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -134,7 +134,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase2_GetParentData() throws IOException, CoreException {
String projectName = "case2";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -156,7 +156,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase3_GetParentData() throws IOException, CoreException {
String projectName = "case3";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -182,7 +182,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase4_GetParentData() throws IOException, CoreException {
String projectName = "case4";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -204,7 +204,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase5_GetParentData() throws IOException, CoreException {
String projectName = "case5";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -242,7 +242,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase6_GetParentData() throws IOException, CoreException {
String projectName = "case6";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
@@ -276,7 +276,7 @@ public class ThreadedModelResolverGraphTest {
@Test
public void testCase7_GetParentData() throws IOException, CoreException {
String projectName = "case7";
- final ReadOnlyGraph<URI> graph = initGraph(projectName);
+ final IGraphView<URI> graph = initGraph(projectName);
// Left
String leftPath = projectName + URI_SEP + LEFT + URI_SEP;
URI parentData = graph.getParentData(URI.createPlatformResourceURI(leftPath + "R1.ecore", false));
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverWithCustomDependencyProviderTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverWithCustomDependencyProviderTest.java
index 8f14ae273..9ccd3aec7 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverWithCustomDependencyProviderTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/logical/resolver/ThreadedModelResolverWithCustomDependencyProviderTest.java
@@ -35,6 +35,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraph;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.DefaultResolutionContext;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.DependencyGraphUpdater;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.IImplicitDependencies;
@@ -70,7 +71,7 @@ import org.osgi.framework.Bundle;
*
* @author Philip Langer <planger@eclipsesource.com>
*/
-@SuppressWarnings({"nls", "restriction" })
+@SuppressWarnings({"nls" })
public class ThreadedModelResolverWithCustomDependencyProviderTest extends CompareTestCase {
private static final String TEST_BUNDLE = "org.eclipse.emf.compare.ide.ui.tests";
@@ -220,6 +221,7 @@ public class ThreadedModelResolverWithCustomDependencyProviderTest extends Compa
private ThreadedModelResolver createModelResolver() {
ThreadedModelResolver resolver = new ThreadedModelResolver();
+ resolver.setGraph(new Graph<URI>());
resolver.initialize();
return resolver;
}
@@ -227,7 +229,7 @@ public class ThreadedModelResolverWithCustomDependencyProviderTest extends Compa
private ThreadedModelResolver createModelResolverWithCustomImplicitDependencies() {
ThreadedModelResolver resolver = new ThreadedModelResolver() {
@Override
- protected DefaultResolutionContext createContext(EventBus eventBus, Graph<URI> graph) {
+ protected DefaultResolutionContext createContext(EventBus eventBus, IGraph<URI> graph) {
return new DefaultResolutionContext(eventBus, graph, new DependencyGraphUpdater<URI>(graph,
eventBus), new ResourceComputationScheduler<URI>(), new ModelResourceListener()) {
@Override
@@ -252,6 +254,7 @@ public class ThreadedModelResolverWithCustomDependencyProviderTest extends Compa
};
}
};
+ resolver.setGraph(new Graph<URI>());
resolver.initialize();
return resolver;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/AbstractTestUITreeNodeItemProviderAdapter.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/AbstractTestUITreeNodeItemProviderAdapter.java
new file mode 100644
index 000000000..8bb2be7bc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/AbstractTestUITreeNodeItemProviderAdapter.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.emf.compare.domain.ICompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
+
+public abstract class AbstractTestUITreeNodeItemProviderAdapter extends AbstractTestTreeNodeItemProviderAdapter {
+
+ protected ICompareEditingDomain editingDomain;
+
+ protected IEMFCompareConfiguration createConfiguration(boolean leftEditable, boolean rightEditable) {
+ CompareConfiguration cc = new CompareConfiguration();
+ cc.setLeftEditable(leftEditable);
+ cc.setRightEditable(rightEditable);
+ EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ emfCC.setEditingDomain(editingDomain);
+
+ return emfCC;
+ }
+
+}
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 7da0a8375..19eded6b2 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
@@ -22,15 +22,14 @@ 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.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
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.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.data.ecore.a1.EcoreA1InputData;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeFactory;
@@ -43,14 +42,12 @@ import org.junit.Test;
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
@SuppressWarnings({"nls", "restriction" })
-public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
+public class MergeActionTest extends AbstractTestUITreeNodeItemProviderAdapter {
private static TreeNodeItemProviderSpec itemProvider;
private IMerger.Registry mergerRegistry;
- private ICompareEditingDomain editingDomain;
-
private TreeNode leftAdd;
private TreeNode leftDelete;
@@ -121,8 +118,8 @@ public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
final TreeNode remoteAdd = rightAdd;
final TreeNode remoteDelete = rightDelete;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Local add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -173,8 +170,8 @@ public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
final TreeNode remoteAdd = rightAdd;
final TreeNode remoteDelete = rightDelete;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// REJECT Local add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -225,8 +222,8 @@ public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
final TreeNode remoteAdd = leftAdd;
final TreeNode remoteDelete = leftDelete;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Local add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -277,8 +274,8 @@ public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
final TreeNode remoteAdd = leftAdd;
final TreeNode remoteDelete = leftDelete;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// REJECT Local add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -327,4 +324,5 @@ public class MergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
Iterable<?> matches = filter(children, matchTreeNode);
return (TreeNode)matches.iterator().next();
}
+
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MockMergeAction.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MockMergeAction.java
index 8eb0b8269..7222b0f08 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MockMergeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/actions/MockMergeAction.java
@@ -15,10 +15,10 @@ import java.util.List;
import org.eclipse.compare.INavigatable;
import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeAction;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.merge.IMerger.Registry;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
@@ -30,9 +30,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
@SuppressWarnings("restriction")
public class MockMergeAction extends MergeAction {
- public MockMergeAction(ICompareEditingDomain editingDomain, Registry mergerRegistry, MergeMode mode,
- boolean isLeftEditable, boolean isRightEditable, INavigatable navigatable) {
- super(editingDomain, mergerRegistry, mode, isLeftEditable, isRightEditable, navigatable);
+ public MockMergeAction(IEMFCompareConfiguration compareConfiguration, Registry mergerRegistry,
+ MergeMode mode, INavigatable navigatable) {
+ super(compareConfiguration, mergerRegistry, mode, navigatable);
}
@Override
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 ada7a70a7..5a4ff3967 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
@@ -29,16 +29,15 @@ import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.EMFCompare.Builder;
-import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
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.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.compare.tests.merge.data.IndividualDiffInputData;
@@ -52,14 +51,12 @@ import org.junit.Test;
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
@SuppressWarnings({"restriction" })
-public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProviderAdapter {
+public class PseudoConflictsMergeActionTest extends AbstractTestUITreeNodeItemProviderAdapter {
private static TreeNodeItemProviderSpec itemProvider;
private IMerger.Registry mergerRegistry;
- private ICompareEditingDomain editingDomain;
-
private TreeNode leftAdd;
private TreeNode rightAdd;
@@ -140,8 +137,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = leftChange;
final TreeNode remoteChange = rightChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Local Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -192,8 +189,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = leftChange;
final TreeNode remoteChange = rightChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, reject, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, reject, null);
// REJECT Local Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -243,8 +240,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = leftChange;
final TreeNode remoteChange = rightChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Remote Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -294,8 +291,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = leftChange;
final TreeNode remoteChange = rightChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, reject, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, reject, null);
// REJECT Remote Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -346,8 +343,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = rightChange;
final TreeNode remoteChange = leftChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Local Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -398,8 +395,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = rightChange;
final TreeNode remoteChange = leftChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, reject, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, reject, null);
// REJECT Local Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -449,8 +446,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = rightChange;
final TreeNode remoteChange = leftChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// ACCEPT Remote Add difference
Diff localAddDiff = (Diff)localAdd.getData();
@@ -500,8 +497,8 @@ public class PseudoConflictsMergeActionTest extends AbstractTestTreeNodeItemProv
final TreeNode localChange = rightChange;
final TreeNode remoteChange = leftChange;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, reject, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, reject, null);
// REJECT Remote Add difference
Diff localAddDiff = (Diff)localAdd.getData();
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 7b48eb4f6..02cac386d 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
@@ -24,15 +24,14 @@ 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.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
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.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.tests.framework.AbstractInputData;
import org.eclipse.emf.ecore.EObject;
@@ -49,14 +48,12 @@ import org.junit.Test;
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
@SuppressWarnings({"nls", "restriction" })
-public class TestBug470503 extends AbstractTestTreeNodeItemProviderAdapter {
+public class TestBug470503 extends AbstractTestUITreeNodeItemProviderAdapter {
private static TreeNodeItemProviderSpec itemProvider;
private IMerger.Registry mergerRegistry;
- private ICompareEditingDomain editingDomain;
-
private TreeNode titledItemESuperTypesDelete;
private TreeNode titledItemEClassifiersDelete;
@@ -115,8 +112,9 @@ public class TestBug470503 extends AbstractTestTreeNodeItemProviderAdapter {
final boolean leftEditable = true;
final boolean rightEditable = true;
final boolean cascadingFilter = true;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, rightToLeft,
- leftEditable, rightEditable, null);
+
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, rightToLeft, null);
// Merge from right to left TitledItem [eSuperTypes delete] difference difference
Diff titledItemESuperTypesDeleteDiff = (Diff)titledItemESuperTypesDelete.getData();
@@ -141,8 +139,9 @@ public class TestBug470503 extends AbstractTestTreeNodeItemProviderAdapter {
final boolean leftEditable = true;
final boolean rightEditable = true;
final boolean cascadingFilter = false;
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, rightToLeft,
- leftEditable, rightEditable, null);
+
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, rightToLeft, null);
// Merge from right to left TitledItem [eSuperTypes delete] difference difference
Diff titledItemESuperTypesDeleteDiff = (Diff)titledItemESuperTypesDelete.getData();
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 8d07ef9ee..17ea4fcd3 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
@@ -30,7 +30,6 @@ import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.Collection;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.Comparison;
@@ -38,10 +37,8 @@ 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.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
-import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.tests.structuremergeviewer.actions.data.tooltips.NodeTooltipsInputData;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.merge.IMerger;
@@ -49,11 +46,9 @@ import org.eclipse.emf.compare.provider.TooltipLabelAdapterFactory;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
-import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
-import org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider.AbstractTestTreeNodeItemProviderAdapter;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
@@ -62,13 +57,11 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
@SuppressWarnings({"nls", "restriction" })
-public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter {
+public class TooltipProviderTest extends AbstractTestUITreeNodeItemProviderAdapter {
private static AdapterFactory composedAdapterFactory;
@@ -76,8 +69,6 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
private IMerger.Registry mergerRegistry;
- private ICompareEditingDomain editingDomain;
-
private TreeNode leftAttributeAdd;
private TreeNode rightAttributeAdd;
@@ -130,26 +121,18 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
private TreeNode rightReferenceUnset;
- @BeforeClass
- public static void beforeClass() {
+ @Override
+ @Before
+ public void before() throws IOException {
+ super.before();
+
final Collection<AdapterFactory> factories = Lists.newArrayList();
factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
factories.add(new EcoreItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
+ factories.add(treeItemProviderAdapterFactory);
factories.add(new TooltipLabelAdapterFactory());
composedAdapterFactory = new ComposedAdapterFactory(factories);
- }
-
- @AfterClass
- public static void afterClass() {
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(null);
- }
-
- @Override
- @Before
- public void before() throws IOException {
- super.before();
itemProvider = (TreeNodeItemProviderSpec)treeItemProviderAdapterFactory.createTreeNodeAdapter();
mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
@@ -312,15 +295,9 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for the REJECT of a String Set on the Left side
action.updateSelection(new StructuredSelection(leftStringSet));
@@ -542,15 +519,9 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for the ACCEPT of a String Set on the Left side
action.updateSelection(new StructuredSelection(leftStringSet));
@@ -755,15 +726,9 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for the LEFT_TO_RIGHT copy of a String Set on the Left side
action.updateSelection(new StructuredSelection(leftStringSet));
@@ -976,15 +941,9 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for the RIGHT_TO_LEFT copy of a String Set on the Left side
action.updateSelection(new StructuredSelection(leftStringSet));
@@ -1214,4 +1173,5 @@ public class TooltipProviderTest extends AbstractTestTreeNodeItemProviderAdapter
builder.append(footer);
return builder.toString();
}
+
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/notloadedfragment/NotLoadedFragmentNodeTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/notloadedfragment/NotLoadedFragmentNodeTest.java
index e1f7ce366..d99384af8 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/notloadedfragment/NotLoadedFragmentNodeTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/structuremergeviewer/notloadedfragment/NotLoadedFragmentNodeTest.java
@@ -18,6 +18,7 @@ import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.File;
import java.io.IOException;
@@ -25,7 +26,6 @@ import java.net.URL;
import java.util.Collection;
import java.util.Iterator;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -38,11 +38,9 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder;
import org.eclipse.emf.compare.ide.ui.internal.logical.IdenticalResourceMinimizer;
import org.eclipse.emf.compare.ide.ui.internal.logical.StorageTypedElement;
@@ -50,10 +48,9 @@ import org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.match.impl.NotLoadedFragmentMatch;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.ThreeWayComparisonGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.GroupItemProviderAdapter;
@@ -66,7 +63,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -85,11 +82,14 @@ public class NotLoadedFragmentNodeTest {
private static AdapterFactoryItemDelegator itemDelegator;
- @BeforeClass
- public static void beforeClass() {
+ private EventBus eventBus;
+
+ @Before
+ public void setup() {
final Collection<AdapterFactory> factories = Lists.newArrayList();
factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
+ eventBus = new EventBus();
+ factories.add(new TreeItemProviderAdapterFactorySpec(new StructureMergeViewerFilter(eventBus)));
factories.add(new EcoreItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
@@ -160,11 +160,6 @@ public class NotLoadedFragmentNodeTest {
final IComparisonScope scope = scopeBuilder.build(left, right, origin, new NullProgressMonitor());
final Comparison comparison = EMFCompare.builder().build().compare(scope);
- ReadOnlyGraph<URI> graph = ((ThreadedModelResolver)resolver).getDependencyGraph();
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(new CompareConfiguration());
- emfCC.setResourcesGraph(graph);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
return comparison;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
index 4df89bdd1..8f4c1914e 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui.tests/src/org/eclipse/emf/compare/ide/ui/tests/unit/DependenciesTest.java
@@ -17,10 +17,12 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.ide.ui.tests.CompareTestCase;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
+import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@@ -59,6 +61,7 @@ public class DependenciesTest extends CompareTestCase {
public void setUp() throws Exception {
super.setUp();
resolver = new ThreadedModelResolver();
+ ((ThreadedModelResolver)resolver).setGraph(new Graph<URI>());
resolver.initialize();
monitor = new NullProgressMonitor();
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
index 24cfc7fa2..fc89a02fd 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
@@ -22,13 +22,11 @@ import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ICompareInputLabelProvider;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.impl.CompareEditingDomainChange;
@@ -70,8 +68,6 @@ public class EMFCompareConfiguration extends ForwardingCompareConfiguration impl
private static final String SMV_GROUP_PROVIDERS = EMFCompareIDEUIPlugin.PLUGIN_ID
+ ".SMV_GROUP_PROVIDERS"; //$NON-NLS-1$;
- private static final String RESOURCES_GRAPH = EMFCompareRCPUIPlugin.PLUGIN_ID + ".RESOURCES_GRAPH"; //$NON-NLS-1$;
-
private final PropertyChangeListener propertyChangeListener;
private final CompareConfiguration compareConfiguration;
@@ -146,7 +142,6 @@ public class EMFCompareConfiguration extends ForwardingCompareConfiguration impl
compareConfiguration.setProperty(ADAPTER_FACTORY, null);
compareConfiguration.setProperty(SMV_GROUP_PROVIDERS, null);
compareConfiguration.setProperty(PREVIEW_MERGE_MODE, null);
- compareConfiguration.setProperty(RESOURCES_GRAPH, null);
}
public boolean getBooleanProperty(String key, boolean dflt) {
@@ -291,15 +286,6 @@ public class EMFCompareConfiguration extends ForwardingCompareConfiguration impl
return (StructureMergeViewerFilter)getProperty(SMV_FILTERS);
}
- @SuppressWarnings("unchecked")
- public ReadOnlyGraph<URI> getResourcesGraph() {
- return (ReadOnlyGraph<URI>)getProperty(RESOURCES_GRAPH);
- }
-
- public void setResourcesGraph(ReadOnlyGraph<URI> graph) {
- setProperty(RESOURCES_GRAPH, graph);
- }
-
public void setLabelProvider(Class<? extends ICompareInput> inputType,
ICompareInputLabelProvider labelProvider) {
labelProviders.put(inputType, labelProvider);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFResourceMappingMerger.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFResourceMappingMerger.java
index a5617418d..073f25e6b 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFResourceMappingMerger.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFResourceMappingMerger.java
@@ -67,6 +67,8 @@ import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.EMFCompare.Builder;
import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.PruningIterator;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.logical.IModelMinimizer;
@@ -75,8 +77,6 @@ import org.eclipse.emf.compare.ide.utils.ResourceUtil;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
import org.eclipse.emf.compare.internal.merge.MergeDependenciesUtil;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.internal.utils.Graph;
-import org.eclipse.emf.compare.internal.utils.PruningIterator;
import org.eclipse.emf.compare.merge.BatchMerger;
import org.eclipse.emf.compare.merge.IBatchMerger;
import org.eclipse.emf.compare.merge.IMerger;
@@ -312,7 +312,7 @@ public class EMFResourceMappingMerger implements IResourceMappingMerger {
* @return the set of the uri for resources on which conflicts were not auto-mergeable.
*/
private Set<URI> performPreMerge(Comparison comparison, SubMonitor subMonitor) {
- final Graph<Diff> differencesGraph = MergeDependenciesUtil.mapDifferences(comparison,
+ final IGraph<Diff> differencesGraph = MergeDependenciesUtil.mapDifferences(comparison,
MERGER_REGISTRY, true, MergeMode.RIGHT_TO_LEFT);
final PruningIterator<Diff> iterator = differencesGraph.breadthFirstIterator();
final Monitor emfMonitor = BasicMonitor.toMonitor(subMonitor);
@@ -322,7 +322,8 @@ public class EMFResourceMappingMerger implements IResourceMappingMerger {
final Diff next = iterator.next();
if (hasConflict(ConflictKind.REAL).apply(next)) {
iterator.prune();
- conflictingURIs.addAll(collectConflictingResources(differencesGraph.depthFirstIterator(next)));
+ conflictingURIs
+ .addAll(collectConflictingResources(differencesGraph.depthFirstIterator(next)));
} else if (next.getState() != DifferenceState.MERGED) {
final IMerger merger = MERGER_REGISTRY.getHighestRankingMerger(next);
merger.copyRightToLeft(next, emfMonitor);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DefaultResolutionContext.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DefaultResolutionContext.java
index 8d8705437..cffb5ec69 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DefaultResolutionContext.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DefaultResolutionContext.java
@@ -17,7 +17,7 @@ import com.google.common.eventbus.EventBus;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.internal.utils.Graph;
+import org.eclipse.emf.compare.graph.IGraph;
/**
* Default implementation of {@link IResolutionContext}.
@@ -28,7 +28,7 @@ public class DefaultResolutionContext implements IResolutionContext {
private final EventBus eventBus;
- private final Graph<URI> graph;
+ private final IGraph<URI> graph;
private final DependencyGraphUpdater<URI> graphUpdater;
@@ -44,7 +44,7 @@ public class DefaultResolutionContext implements IResolutionContext {
private IImplicitDependencies implicitDependencies;
- public DefaultResolutionContext(EventBus eventBus, Graph<URI> graph,
+ public DefaultResolutionContext(EventBus eventBus, IGraph<URI> graph,
DependencyGraphUpdater<URI> graphUpdater, ResourceComputationScheduler<URI> scheduler,
ModelResourceListener modelResourceListener) {
this.eventBus = checkNotNull(eventBus);
@@ -58,7 +58,7 @@ public class DefaultResolutionContext implements IResolutionContext {
return eventBus;
}
- public Graph<URI> getGraph() {
+ public IGraph<URI> getGraph() {
return graph;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DependencyGraphUpdater.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DependencyGraphUpdater.java
index c8b896094..965d14803 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DependencyGraphUpdater.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/DependencyGraphUpdater.java
@@ -19,7 +19,7 @@ import com.google.common.eventbus.Subscribe;
import java.util.Collections;
import org.apache.log4j.Logger;
-import org.eclipse.emf.compare.internal.utils.Graph;
+import org.eclipse.emf.compare.graph.IGraph;
/**
* This class's responsibility is to maintain the state of its graph when notified that a new model resource
@@ -30,7 +30,7 @@ import org.eclipse.emf.compare.internal.utils.Graph;
public class DependencyGraphUpdater<T> {
/** The graph of dependencies between the resources. */
- private final Graph<T> dependencyGraph;
+ private final IGraph<T> dependencyGraph;
/** The logger. */
private static final Logger LOGGER = Logger.getLogger(DependencyGraphUpdater.class);
@@ -43,7 +43,7 @@ public class DependencyGraphUpdater<T> {
* @param eventBus
* The event bus that will fire events to record.
*/
- public DependencyGraphUpdater(Graph<T> graph, EventBus eventBus) {
+ public DependencyGraphUpdater(IGraph<T> graph, EventBus eventBus) {
this.dependencyGraph = checkNotNull(graph);
eventBus.register(this);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/IResolutionContext.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/IResolutionContext.java
index 10cfa05fb..ba754f164 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/IResolutionContext.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/IResolutionContext.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.compare.ide.ui.internal.logical.resolver;
import com.google.common.eventbus.EventBus;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.internal.utils.Graph;
+import org.eclipse.emf.compare.graph.IGraph;
/**
* A resolution context provides the different elements that can be involved in a comparison taking logical
@@ -27,7 +27,7 @@ public interface IResolutionContext {
EventBus getEventBus();
/** The graph of dependencies. */
- Graph<URI> getGraph();
+ IGraph<URI> getGraph();
/** The graph updater, in charge of making changes to the dependency graph. */
DependencyGraphUpdater<URI> getGraphUpdater();
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyLocalResolver.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyLocalResolver.java
index ec9e8c882..58df9d6c2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyLocalResolver.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyLocalResolver.java
@@ -32,9 +32,9 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraph;
import org.eclipse.emf.compare.ide.ui.internal.util.ThreadSafeProgressMonitor;
import org.eclipse.emf.compare.ide.utils.ResourceUtil;
-import org.eclipse.emf.compare.internal.utils.Graph;
/**
* The default implementation of the {@link IResourceDependencyProvider}.
@@ -52,7 +52,7 @@ public class ResourceDependencyLocalResolver implements IResourceDependencyLocal
private final EventBus eventBus;
/** The dependency graph. */
- private final Graph<URI> dependencyGraph;
+ private final IGraph<URI> dependencyGraph;
/** The resource listener. */
private final ModelResourceListener resourceListener;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyProvider.java
index 0cdec6b4f..37020ff09 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ResourceDependencyProvider.java
@@ -22,8 +22,8 @@ import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraph;
import org.eclipse.emf.compare.ide.utils.ResourceUtil;
-import org.eclipse.emf.compare.internal.utils.Graph;
/**
* The default implementation of the {@link IResourceDependencyProvider}.
@@ -33,7 +33,7 @@ import org.eclipse.emf.compare.internal.utils.Graph;
public class ResourceDependencyProvider implements IResourceDependencyProvider {
/** The dependency graph. */
- private final Graph<URI> dependencyGraph;
+ private final IGraph<URI> dependencyGraph;
/**
* Constructor.
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ThreadedModelResolver.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ThreadedModelResolver.java
index 330e5aa31..8a4c88be4 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ThreadedModelResolver.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/ThreadedModelResolver.java
@@ -17,13 +17,16 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.ide.ui.logical.AbstractModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.ide.ui.logical.SynchronizationModel;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
-import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
+import org.eclipse.emf.compare.rcp.graph.IGraphConsumer;
+import org.eclipse.emf.compare.rcp.ui.internal.util.ResourceUIUtil;
/**
* This implementation of an {@link IModelResolver} will look up all of the models located in a set container
@@ -51,17 +54,22 @@ import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
*
* @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
*/
-public class ThreadedModelResolver extends AbstractModelResolver {
+public class ThreadedModelResolver extends AbstractModelResolver implements IGraphConsumer {
private IResolutionContext context;
/**
+ * The URI Graph instance.
+ */
+ private IGraph<URI> graph;
+
+ /**
* Convert the dependency graph to its read-only version.
*
* @return a read-only version of the dependency graph associated to this model resolver.
*/
- public ReadOnlyGraph<URI> getDependencyGraph() {
- return ReadOnlyGraph.toReadOnlyGraph(context.getGraph());
+ public IGraphView<URI> getGraphView() {
+ return ReadOnlyGraph.toReadOnlyGraph(graph);
}
/**
@@ -75,8 +83,10 @@ public class ThreadedModelResolver extends AbstractModelResolver {
@Override
public void initialize() {
super.initialize();
+ if (graph == null) {
+ throw new IllegalStateException();
+ }
EventBus eventBus = new EventBus();
- Graph<URI> graph = new Graph<URI>();
this.context = createContext(eventBus, graph);
context.initialize();
}
@@ -92,13 +102,12 @@ public class ThreadedModelResolver extends AbstractModelResolver {
* For testing purposes, this method is protected.
*
* @param eventBus
- * @param graph
+ * @param aGraph
* @return The resolution context to use.
*/
- protected DefaultResolutionContext createContext(EventBus eventBus, Graph<URI> graph) {
- return new DefaultResolutionContext(eventBus, graph,
- new DependencyGraphUpdater<URI>(graph, eventBus), new ResourceComputationScheduler<URI>(),
- new ModelResourceListener());
+ protected DefaultResolutionContext createContext(EventBus eventBus, IGraph<URI> aGraph) {
+ return new DefaultResolutionContext(eventBus, aGraph, new DependencyGraphUpdater<URI>(aGraph,
+ eventBus), new ResourceComputationScheduler<URI>(), new ModelResourceListener());
}
/** {@inheritDoc} */
@@ -151,4 +160,21 @@ public class ThreadedModelResolver extends AbstractModelResolver {
ModelsResolution comp = new ModelsResolution(context, monitor, storageAccessor, left, right, origin);
return comp.run();
}
+
+ /**
+ * Getter for the ID of the Resource Graph.
+ */
+ public String getId() {
+ return ResourceUIUtil.RESOURCES_GRAPH_ID;
+ }
+
+ /**
+ * Setter for the URI Graph istance.
+ *
+ * @param graph
+ * The URI Graph
+ */
+ public void setGraph(IGraph<URI> graph) {
+ this.graph = graph;
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/registry/ModelResolverDescriptor.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/registry/ModelResolverDescriptor.java
index a5def719f..b234e2cc0 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/registry/ModelResolverDescriptor.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/resolver/registry/ModelResolverDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 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
@@ -21,6 +21,8 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
+import org.eclipse.emf.compare.rcp.graph.IGraphConsumer;
/**
* Descriptor of an {@link IModelResolver}.
@@ -139,6 +141,9 @@ public class ModelResolverDescriptor {
try {
resolver = (IModelResolver)configurationElement
.createExecutableExtension(resolverClassPropertyName);
+ if (resolver instanceof IGraphConsumer) {
+ EMFCompareRCPPlugin.getDefault().register((IGraphConsumer)resolver);
+ }
resolver.initialize();
} catch (CoreException e) {
// Shouldn't happen since the registry listener should have checked that.
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
index 3f7e658a7..cb298d0c1 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
@@ -163,16 +163,15 @@ public class CompareToolBar implements ISelectionChangedListener {
private MergeAction createMergeAction(MergeMode mergeMode, EMFCompareConfiguration cc, INavigatable nav) {
IMerger.Registry mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
- MergeAction mergeAction = new MergeAction(cc.getEditingDomain(), mergerRegistry, mergeMode, cc
- .isLeftEditable(), cc.isRightEditable(), nav);
+ MergeAction mergeAction = new MergeAction(this.compareConfiguration, mergerRegistry, mergeMode, nav);
mergeActions.add(mergeAction);
return mergeAction;
}
private MergeAction createMergeAllNonConflictingAction(MergeMode mergeMode, IEMFCompareConfiguration cc) {
IMerger.Registry mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
- MergeAllNonConflictingAction mergeAction = new MergeAllNonConflictingAction(cc.getEditingDomain(), cc
- .getComparison(), mergerRegistry, mergeMode, cc.isLeftEditable(), cc.isRightEditable());
+ MergeAllNonConflictingAction mergeAction = new MergeAllNonConflictingAction(
+ this.compareConfiguration, cc.getComparison(), mergerRegistry, mergeMode);
mergeAllNonConflictingActions.add(mergeAction);
return mergeAction;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index 4826fad14..f4d8009b5 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -69,7 +69,6 @@ import org.eclipse.emf.common.ui.CommonUIPlugin;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
@@ -96,7 +95,6 @@ import org.eclipse.emf.compare.ide.ui.internal.editor.ComparisonScopeInput;
import org.eclipse.emf.compare.ide.ui.internal.logical.ComparisonScopeBuilder;
import org.eclipse.emf.compare.ide.ui.internal.logical.EmptyComparisonScope;
import org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage;
-import org.eclipse.emf.compare.ide.ui.internal.logical.resolver.ThreadedModelResolver;
import org.eclipse.emf.compare.ide.ui.internal.progress.JobProgressInfoComposite;
import org.eclipse.emf.compare.ide.ui.internal.progress.JobProgressMonitorWrapper;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.EMFCompareStructureMergeViewerContentProvider.FetchListener;
@@ -107,13 +105,10 @@ import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.provider.Tre
import org.eclipse.emf.compare.ide.ui.internal.util.CompareHandlerService;
import org.eclipse.emf.compare.ide.ui.internal.util.JFaceUtil;
import org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil;
-import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.ICompareEditingDomainChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IMergePreviewModeChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.SideLabelProvider;
@@ -364,9 +359,6 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
config.getEventBus().register(this);
- // Bug 473190: NPE when using merge tool after a conflicting merge
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(getCompareConfiguration());
-
final boolean enabled = any(config.getStructureMergeViewerFilter().getSelectedDifferenceFilters(),
instanceOf(CascadingDifferencesFilter.class));
setCascadingDifferencesFilterEnabled(enabled);
@@ -435,9 +427,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
for (MergeMode mode : modes) {
IMerger.Registry mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
if (isOneDiffSelected()) {
- MergeAction mergeAction = new MergeAction(getCompareConfiguration().getEditingDomain(),
- mergerRegistry, mode, leftEditable, rightEditable, navigatable,
- (IStructuredSelection)getSelection());
+ MergeAction mergeAction = new MergeAction(getCompareConfiguration(), mergerRegistry,
+ mode, navigatable, (IStructuredSelection)getSelection());
mergeAction.setCascadingDifferencesFilterEnabled(getCascadingDifferencesFilterEnabled());
manager.add(mergeAction);
} else if (isOneMatchOrResourceMatchSelected()) {
@@ -448,8 +439,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
}
};
MergeContainedNonConflictingAction mergeAction = new MergeContainedNonConflictingAction(
- getCompareConfiguration().getEditingDomain(), mergerRegistry, mode, leftEditable,
- rightEditable, navigatable, (IStructuredSelection)getSelection(), filterPredicate);
+ getCompareConfiguration(), mergerRegistry, mode, navigatable,
+ (IStructuredSelection)getSelection(), filterPredicate);
mergeAction.setCascadingDifferencesFilterEnabled(getCascadingDifferencesFilterEnabled());
manager.add(mergeAction);
}
@@ -522,7 +513,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
protected void preHookCreateControlAndViewer() {
fAdapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
.createFilteredAdapterFactoryRegistry());
- fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec());
+ fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec(getCompareConfiguration()
+ .getStructureMergeViewerFilter()));
fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
@@ -1148,13 +1140,6 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
if (leftStorage == null) {
leftStorage = StreamAccessorStorage.fromTypedElement(left);
}
- IModelResolver resolver = EMFCompareIDEUIPlugin.getDefault().getModelResolverRegistry()
- .getBestResolverFor(leftStorage);
- if (resolver instanceof ThreadedModelResolver) {
- ReadOnlyGraph<URI> graph = ((ThreadedModelResolver)resolver).getDependencyGraph();
- getCompareConfiguration().setResourcesGraph(graph);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(compareConfiguration);
- }
initToolbar();
compareInputChanged(scope, compareResult);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
index a2ab8a0a7..b30c492e0 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
@@ -41,7 +41,6 @@ import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.merge.IMerger.Registry;
import org.eclipse.emf.compare.merge.IMerger2;
import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.ecore.EObject;
@@ -94,14 +93,13 @@ public class MergeAction extends BaseSelectionListenerAction {
* @param configuration
* The compare configuration object.
*/
- public MergeAction(ICompareEditingDomain editingDomain, IMerger.Registry mergerRegistry, MergeMode mode,
- boolean isLeftEditable, boolean isRightEditable, INavigatable navigatable) {
+ public MergeAction(IEMFCompareConfiguration compareConfiguration, IMerger.Registry mergerRegistry,
+ MergeMode mode, INavigatable navigatable) {
super(""); //$NON-NLS-1$
- IEMFCompareConfiguration emfCompareConfiguration = EMFCompareRCPUIPlugin.getDefault()
- .getEMFCompareConfiguration();
- if (emfCompareConfiguration != null) {
- adapterFactory = emfCompareConfiguration.getAdapterFactory();
- }
+
+ adapterFactory = compareConfiguration.getAdapterFactory();
+ boolean isLeftEditable = compareConfiguration.isLeftEditable();
+ boolean isRightEditable = compareConfiguration.isRightEditable();
this.navigatable = navigatable;
Preconditions.checkNotNull(mode);
@@ -117,7 +115,7 @@ public class MergeAction extends BaseSelectionListenerAction {
Preconditions.checkState(mode == MergeMode.ACCEPT || mode == MergeMode.REJECT);
}
- this.editingDomain = editingDomain;
+ this.editingDomain = compareConfiguration.getEditingDomain();
this.mergerRegistry = mergerRegistry;
this.leftToRight = mode.isLeftToRight(isLeftEditable, isRightEditable);
this.mergeRunnable = createMergeRunnable(mode, isLeftEditable, isRightEditable);
@@ -127,10 +125,9 @@ public class MergeAction extends BaseSelectionListenerAction {
initToolTipAndImage(mode);
}
- public MergeAction(ICompareEditingDomain editingDomain, IMerger.Registry mergerRegistry, MergeMode mode,
- boolean isLeftEditable, boolean isRightEditable, INavigatable navigatable,
- IStructuredSelection selection) {
- this(editingDomain, mergerRegistry, mode, isLeftEditable, isRightEditable, navigatable);
+ public MergeAction(IEMFCompareConfiguration compareConfiguration, IMerger.Registry mergerRegistry,
+ MergeMode mode, INavigatable navigatable, IStructuredSelection selection) {
+ this(compareConfiguration, mergerRegistry, mode, navigatable);
updateSelection(selection);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllNonConflictingAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllNonConflictingAction.java
index 9a26fadce..340f00c8d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllNonConflictingAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllNonConflictingAction.java
@@ -18,13 +18,13 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
-import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.internal.domain.IMergeAllNonConflictingRunnable;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.merge.IMerger;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -46,11 +46,12 @@ public class MergeAllNonConflictingAction extends MergeAction {
* @param configuration
* The compare configuration object.
*/
- public MergeAllNonConflictingAction(ICompareEditingDomain editingDomain, Comparison comparison,
- IMerger.Registry mergerRegistry, MergeMode mode, boolean isLeftEditable, boolean isRightEditable) {
- super(editingDomain, mergerRegistry, mode, isLeftEditable, isRightEditable, null);
+ public MergeAllNonConflictingAction(IEMFCompareConfiguration compareConfiguration, Comparison comparison,
+ IMerger.Registry mergerRegistry, MergeMode mode) {
+ super(compareConfiguration, mergerRegistry, mode, null);
this.comparison = comparison;
- this.runnable = new MergeNonConflictingRunnable(isLeftEditable, isRightEditable, mode);
+ this.runnable = new MergeNonConflictingRunnable(compareConfiguration.isLeftEditable(),
+ compareConfiguration.isRightEditable(), mode);
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeContainedNonConflictingAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeContainedNonConflictingAction.java
index a91399054..1fcc95226 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeContainedNonConflictingAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeContainedNonConflictingAction.java
@@ -26,12 +26,12 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.IMergeRunnable;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.merge.IMerger.Registry;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
@@ -82,10 +82,10 @@ public class MergeContainedNonConflictingAction extends MergeAction {
* @param isFiltered
* The predicate to use for determining whether a {@link TreeNode} is filtered.
*/
- public MergeContainedNonConflictingAction(ICompareEditingDomain editingDomain, Registry mergerRegistry,
- MergeMode mode, boolean isLeftEditable, boolean isRightEditable, INavigatable navigatable,
+ public MergeContainedNonConflictingAction(IEMFCompareConfiguration compareConfiguration,
+ Registry mergerRegistry, MergeMode mode, INavigatable navigatable,
IStructuredSelection selection, Predicate<TreeNode> isFiltered) {
- super(editingDomain, mergerRegistry, mode, isLeftEditable, isRightEditable, navigatable);
+ super(compareConfiguration, mergerRegistry, mode, navigatable);
this.isFiltered = isFiltered;
updateSelection(selection);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeNonConflictingRunnable.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeNonConflictingRunnable.java
index bd5589400..c27e730b2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeNonConflictingRunnable.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeNonConflictingRunnable.java
@@ -35,13 +35,13 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.domain.IMergeRunnable;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.PruningIterator;
import org.eclipse.emf.compare.internal.domain.IMergeAllNonConflictingRunnable;
import org.eclipse.emf.compare.internal.merge.MergeDependenciesUtil;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.internal.merge.MergeOperation;
import org.eclipse.emf.compare.internal.utils.ComparisonUtil;
-import org.eclipse.emf.compare.internal.utils.Graph;
-import org.eclipse.emf.compare.internal.utils.PruningIterator;
import org.eclipse.emf.compare.merge.BatchMerger;
import org.eclipse.emf.compare.merge.IBatchMerger;
import org.eclipse.emf.compare.merge.IMerger;
@@ -223,7 +223,7 @@ public class MergeNonConflictingRunnable extends AbstractMergeRunnable implement
Registry mergerRegistry) {
final List<Diff> affectedDiffs = new ArrayList<Diff>();
final Monitor emfMonitor = new BasicMonitor();
- final Graph<Diff> differencesGraph = MergeDependenciesUtil.mapDifferences(differences,
+ final IGraph<Diff> differencesGraph = MergeDependenciesUtil.mapDifferences(differences,
mergerRegistry, !leftToRight, getMergeMode());
final PruningIterator<Diff> iterator = differencesGraph.breadthFirstIterator();
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.rcp.ui.tests/META-INF/MANIFEST.MF
index 17d2abeb3..5479433af 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
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)"
+ com.google.common.collect;version="[11.0.0,16.0.0)",
+ com.google.common.eventbus;version="[11.0.0,16.0.0)"
Export-Package: org.eclipse.emf.compare.rcp.ui.tests,
org.eclipse.emf.compare.rcp.ui.tests.mergeviewer.item,
org.eclipse.emf.compare.rcp.ui.tests.structuremergeviewer.groups.provider,
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 fbda13901..eb764c4cc 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
@@ -49,7 +49,7 @@ public class TestBasicDifferenceGroupImpl extends AbstractTestTreeNodeItemProvid
final Collection<AdapterFactory> factories = Lists.newArrayList();
factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
+ factories.add(treeItemProviderAdapterFactory);
factories.add(new EcoreItemProviderAdapterFactory());
factories.add(new ReflectiveItemProviderAdapterFactory());
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/AbstractTestTreeNodeItemProviderAdapter.java b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/AbstractTestTreeNodeItemProviderAdapter.java
index 224bd8f1a..abc91c49b 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/AbstractTestTreeNodeItemProviderAdapter.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui.tests/src/org/eclipse/emf/compare/rcp/ui/tests/structuremergeviewer/groups/provider/AbstractTestTreeNodeItemProviderAdapter.java
@@ -24,6 +24,7 @@ import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.EMFCompare.Builder;
import org.eclipse.emf.compare.rcp.internal.extension.impl.EMFCompareBuilderConfigurator;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.scope.DefaultComparisonScope;
import org.eclipse.emf.compare.scope.IComparisonScope;
@@ -37,6 +38,7 @@ import org.junit.Before;
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
+import com.google.common.eventbus.EventBus;
/**
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
@@ -46,9 +48,12 @@ public class AbstractTestTreeNodeItemProviderAdapter {
protected static TreeItemProviderAdapterFactorySpec treeItemProviderAdapterFactory;
+ protected EventBus eventBus;
+
@Before
public void before() throws IOException {
- treeItemProviderAdapterFactory = new TreeItemProviderAdapterFactorySpec();
+ eventBus = new EventBus();
+ treeItemProviderAdapterFactory = new TreeItemProviderAdapterFactorySpec(new StructureMergeViewerFilter(eventBus));
}
/**
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/EMFCompareRCPUIPlugin.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/EMFCompareRCPUIPlugin.java
index 384ff77cb..a58bdeabd 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/EMFCompareRCPUIPlugin.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/EMFCompareRCPUIPlugin.java
@@ -118,6 +118,7 @@ public class EMFCompareRCPUIPlugin extends AbstractUIPlugin {
private ConfigurationUIRegistryEventListener matchEngineConfiguratorRegistryListener;
+ @Deprecated
private IEMFCompareConfiguration compareConfiguration;
/**
@@ -376,21 +377,29 @@ public class EMFCompareRCPUIPlugin extends AbstractUIPlugin {
}
/**
- * @return the compare configuration object.
+ * The compareConfiguration is not provided by the RCPUI plugin anymore. This plugin provide cross
+ * comparison elements and the compareConfiguration is configuration dependent.
+ *
+ * @return null
+ * @deprecated
* @since 4.1
*/
+ @Deprecated
public IEMFCompareConfiguration getEMFCompareConfiguration() {
- return compareConfiguration;
+ return null;
}
/**
- * Set the compare configuration object.
+ * The compareConfiguration is not provided by the RCPUI plugin anymore. This plugin provide cross
+ * comparison elements and the compareConfiguration is configuration dependent.
*
* @param compareConfiguration
* the compare configuration object
+ * @deprecated
* @since 4.1
*/
+ @Deprecated
public void setEMFCompareConfiguration(IEMFCompareConfiguration compareConfiguration) {
- this.compareConfiguration = compareConfiguration;
+ // Do nothing
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java
index 38f12acfb..c14d27b6a 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java
@@ -13,12 +13,10 @@ package org.eclipse.emf.compare.rcp.ui.internal.configuration;
import com.google.common.eventbus.EventBus;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.StructureMergeViewerGrouper;
import org.eclipse.emf.compare.scope.IComparisonScope;
@@ -61,8 +59,4 @@ public interface IEMFCompareConfiguration {
void setMergePreviewMode(MergeMode mergePreviewMode);
boolean getBooleanProperty(String key, boolean dflt);
-
- ReadOnlyGraph<URI> getResourcesGraph();
-
- void setResourcesGraph(ReadOnlyGraph<URI> graph);
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/item/impl/MergeViewerItem.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/item/impl/MergeViewerItem.java
index 471c98611..096055502 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/item/impl/MergeViewerItem.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/item/impl/MergeViewerItem.java
@@ -51,9 +51,9 @@ import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.ResourceAttachmentChange;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.internal.spec.EObjectUtil;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
import org.eclipse.emf.compare.match.impl.NotLoadedFragmentMatch;
import org.eclipse.emf.compare.rcp.ui.internal.util.MergeViewerUtil;
import org.eclipse.emf.compare.rcp.ui.internal.util.ResourceUIUtil;
@@ -731,7 +731,7 @@ public class MergeViewerItem extends AdapterImpl implements IMergeViewerItem {
for (Match match : children) {
URI uri = ResourceUIUtil.getDataURI(match, getSide());
if (uri != null) {
- ReadOnlyGraph<URI> graph = ResourceUIUtil.getResourcesURIGraph();
+ IGraphView<URI> graph = ResourceUIUtil.getResourcesURIGraph();
URI parentData = graph.getParentData(uri);
ResourceSet rs = ResourceUIUtil.getDataResourceSet(match, getSide());
Resource resourceParent = ResourceUIUtil.getParent(rs, uri);
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeItemProviderAdapterFactorySpec.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeItemProviderAdapterFactorySpec.java
index 1d0fe9058..a66d0258c 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeItemProviderAdapterFactorySpec.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeItemProviderAdapterFactorySpec.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.compare.provider.IItemDescriptionProvider;
import org.eclipse.emf.compare.provider.IItemStyledLabelProvider;
import org.eclipse.emf.compare.provider.ISemanticObjectLabelProvider;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemFontProvider;
import org.eclipse.emf.edit.tree.provider.TreeItemProviderAdapterFactory;
@@ -26,11 +27,18 @@ import org.eclipse.emf.edit.tree.provider.TreeItemProviderAdapterFactory;
*/
public class TreeItemProviderAdapterFactorySpec extends TreeItemProviderAdapterFactory {
+ /** An instance of {@code StructureMergeViewerFilter}. */
+ private final StructureMergeViewerFilter filter;
+
/**
* Constructor.
+ *
+ * @param filter
+ * The given StructureMergeViewerFilter
*/
- public TreeItemProviderAdapterFactorySpec() {
+ public TreeItemProviderAdapterFactorySpec(StructureMergeViewerFilter filter) {
super();
+ this.filter = filter;
supportedTypes.add(IItemFontProvider.class);
supportedTypes.add(IItemColorProvider.class);
supportedTypes.add(IItemStyledLabelProvider.class);
@@ -45,6 +53,6 @@ public class TreeItemProviderAdapterFactorySpec extends TreeItemProviderAdapterF
*/
@Override
public Adapter createTreeNodeAdapter() {
- return new TreeNodeItemProviderSpec(this);
+ return new TreeNodeItemProviderSpec(this, filter);
}
}
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeNodeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeNodeItemProviderSpec.java
index 5d89e97c6..acb55cfe1 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeNodeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/provider/TreeNodeItemProviderSpec.java
@@ -27,6 +27,7 @@ import com.google.common.collect.UnmodifiableIterator;
import java.util.Collection;
import java.util.Iterator;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
@@ -40,7 +41,7 @@ import org.eclipse.emf.compare.provider.IItemStyledLabelProvider;
import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
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.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroup;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.ecore.EObject;
@@ -61,14 +62,21 @@ public class TreeNodeItemProviderSpec extends TreeNodeItemProvider implements II
/** A map of IDifferenceGroupProvider, GroupItemProviderAdapter. */
private Multimap<IDifferenceGroupProvider, GroupItemProviderAdapter> groupItemProviderAdapters;
+ /** An instance of {@code StructureMergeViewerFilter}. */
+ private StructureMergeViewerFilter structureMergeViewerFilter;
+
/**
* This constructs an instance from a factory.
*
* @param adapterFactory
* the given factory
+ * @param structureMergeViewerFilter
+ * the given structure merge viewer filter
*/
- public TreeNodeItemProviderSpec(AdapterFactory adapterFactory) {
+ public TreeNodeItemProviderSpec(AdapterFactory adapterFactory,
+ StructureMergeViewerFilter structureMergeViewerFilter) {
super(adapterFactory);
+ this.structureMergeViewerFilter = structureMergeViewerFilter;
itemDelegator = new ExtendedAdapterFactoryItemDelegator(getRootAdapterFactory());
}
@@ -244,9 +252,9 @@ public class TreeNodeItemProviderSpec extends TreeNodeItemProvider implements II
/**
* Due to filters (especially UML & Diagram Refined elements filters), refining & refined elements are
- * store in the same conflicts. But refining & refined elements will never be display together. It leads
- * to have a number of unresolved diffs who is confusing because it counts refining & refined unresolved
- * diffs together. So only counts visible unresolved nodes.
+ * store in the same conflicts. But refining & refined elements will never be displayed together. It leads
+ * to have a number of unresolved diffs that is confusing because it counts refining & refined unresolved
+ * diffs together. This method makes sure to only count visible unresolved nodes.
*
* @param conflict
* the conflict for which we want to get the text to display.
@@ -255,8 +263,8 @@ public class TreeNodeItemProviderSpec extends TreeNodeItemProvider implements II
private IComposedStyledString getTreeNodeText(TreeNode treeNode, Conflict conflict) {
final ComposedStyledString ret = new ComposedStyledString();
- final Predicate<? super EObject> unfilteredNode = EMFCompareRCPUIPlugin.getDefault()
- .getEMFCompareConfiguration().getStructureMergeViewerFilter().getAggregatedPredicate();
+ Assert.isNotNull(structureMergeViewerFilter);
+ final Predicate<? super EObject> unfilteredNode = structureMergeViewerFilter.getAggregatedPredicate();
final UnmodifiableIterator<EObject> visibleNodes = Iterators.filter(treeNode.eAllContents(),
unfilteredNode);
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/ResourceUIUtil.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/ResourceUIUtil.java
index d49e1cac3..518b06c53 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/ResourceUIUtil.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/util/ResourceUIUtil.java
@@ -25,10 +25,9 @@ import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.internal.utils.ReadOnlyGraph;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.match.impl.NotLoadedFragmentMatch;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.item.impl.MergeViewerItem;
import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
import org.eclipse.emf.compare.rcp.ui.mergeviewer.item.IMergeViewerItem;
@@ -44,6 +43,9 @@ import org.eclipse.emf.edit.tree.TreeNode;
*/
public class ResourceUIUtil {
+ /** ID of the graph of EMF resources used by EMFCompare to compute the logical model. */
+ public static final String RESOURCES_GRAPH_ID = "org.eclipse.emf.compare.resources.graph"; //$NON-NLS-1$
+
/**
* Function that retrieve the data of the given TreeNode.
*/
@@ -64,13 +66,8 @@ public class ResourceUIUtil {
*
* @return the graph if it exists, <code>null</code> otherwise.
*/
- public static ReadOnlyGraph<URI> getResourcesURIGraph() {
- final IEMFCompareConfiguration configuration = EMFCompareRCPUIPlugin.getDefault()
- .getEMFCompareConfiguration();
- if (configuration != null) {
- return configuration.getResourcesGraph();
- }
- return null;
+ public static IGraphView<URI> getResourcesURIGraph() {
+ return EMFCompareRCPPlugin.getDefault().getGraphView(RESOURCES_GRAPH_ID);
}
/**
@@ -94,7 +91,7 @@ public class ResourceUIUtil {
* @return <code>true</code> if the given URI is a fragment of a model, <code>false</code> otherwise.
*/
public static boolean isFragment(URI uri) {
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (uri != null && graph != null) {
URI parentData = graph.getParentData(uri);
if (parentData != null) {
@@ -137,7 +134,7 @@ public class ResourceUIUtil {
* @return <code>true</code> if the given URI is a fragment of a model, <code>false</code> otherwise.
*/
public static boolean isFirstLevelFragment(URI uri) {
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (uri != null && graph != null) {
URI parentData = graph.getParentData(uri);
if (parentData != null) {
@@ -162,7 +159,7 @@ public class ResourceUIUtil {
*/
public static URI getRootResourceURI(URI uri) {
final URI uriRoot;
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (uri != null && graph != null) {
URI parentData = graph.getParentData(uri);
if (parentData == null) {
@@ -222,7 +219,7 @@ public class ResourceUIUtil {
*/
public static Resource getParent(ResourceSet rs, URI uri) {
final Resource resource;
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (uri != null && graph != null) {
URI parentData = graph.getParentData(uri);
if (parentData != null) {
@@ -282,7 +279,7 @@ public class ResourceUIUtil {
*/
private static Entry<URI, Resource> getResourceParent(ResourceSet rs, URI uri) {
Entry<URI, Resource> entry = null;
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (uri != null && graph != null) {
URI parentData = graph.getParentData(uri);
if (parentData != null) {
@@ -557,7 +554,7 @@ public class ResourceUIUtil {
MergeViewerSide side) {
final Collection<Match> childrenMatches = Sets.newLinkedHashSet();
final Collection<Match> matches = comparison.getMatches();
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
if (graph == null) {
return childrenMatches;
}
@@ -602,7 +599,7 @@ public class ResourceUIUtil {
* otherwise.
*/
public static boolean isChildOf(URI uri, Collection<URI> uris) {
- final ReadOnlyGraph<URI> graph = getResourcesURIGraph();
+ final IGraphView<URI> graph = getResourcesURIGraph();
URI parentData = graph.getParentData(uri);
while (parentData != null) {
URI parent = parentData.trimFragment();
diff --git a/plugins/org.eclipse.emf.compare.rcp/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.rcp/META-INF/MANIFEST.MF
index 8f5e6b07f..233d20be1 100644
--- a/plugins/org.eclipse.emf.compare.rcp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.rcp/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.emf.compare.rcp,
org.eclipse.emf.compare.rcp.extension,
+ org.eclipse.emf.compare.rcp.graph,
org.eclipse.emf.compare.rcp.internal;x-internal:=true,
org.eclipse.emf.compare.rcp.internal.extension;x-friends:="org.eclipse.emf.compare.rcp.ui,org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.rcp.internal.extension.impl;x-friends:="org.eclipse.emf.compare.rcp.ui,org.eclipse.emf.compare.ide.ui",
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java
index 055b2f2f3..65f589a1b 100644
--- a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java
@@ -27,7 +27,9 @@ import com.google.common.collect.Multimaps;
import java.io.IOException;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -42,11 +44,14 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.conflict.IConflictDetector;
import org.eclipse.emf.compare.diff.IDiffEngine;
import org.eclipse.emf.compare.equi.IEquiEngine;
+import org.eclipse.emf.compare.graph.IGraphView;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl;
+import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.compare.match.IMatchEngine;
import org.eclipse.emf.compare.match.eobject.WeightProvider;
import org.eclipse.emf.compare.match.eobject.WeightProviderDescriptorRegistryImpl;
@@ -54,6 +59,7 @@ import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.postprocessor.IPostProcessor;
import org.eclipse.emf.compare.provider.EMFCompareEditPlugin;
import org.eclipse.emf.compare.rcp.extension.AbstractRegistryEventListener;
+import org.eclipse.emf.compare.rcp.graph.IGraphConsumer;
import org.eclipse.emf.compare.rcp.internal.EMFCompareRCPMessages;
import org.eclipse.emf.compare.rcp.internal.adapterfactory.AdapterFactoryDescriptorRegistryListener;
import org.eclipse.emf.compare.rcp.internal.extension.IItemRegistry;
@@ -197,6 +203,11 @@ public class EMFCompareRCPPlugin extends Plugin {
private IPreferenceChangeListener preferenceChangeListener;
/**
+ * Keep all resources graphs identified by their id.
+ */
+ private Map<String, IGraphView<URI>> graphsById = new HashMap<String, IGraphView<URI>>();
+
+ /**
* Instance scope for preferences.
* <p>
* Do not use singleton to respect Helios compatibility
@@ -813,4 +824,35 @@ public class EMFCompareRCPPlugin extends Plugin {
}
}
+ /**
+ * This method creates a new Graph of URI, passes it to the given consumer and then keeps track of the
+ * given graph to be able to provide a read only view of it on demand.
+ *
+ * @param consumer
+ * An instance of graph consumer, for instance the ThreadedModelResolver instance.
+ * @throws IllegalArgumentException
+ * if the consumer uses an ID that is already registered.
+ * @since 2.4
+ */
+ public void register(IGraphConsumer consumer) {
+ consumer.setGraph(new Graph<URI>());
+ String id = consumer.getId();
+ if (graphsById.containsKey(id)) {
+ throw new IllegalArgumentException(EMFCompareRCPMessages.getString("duplicate.graph.id.msg", id)); //$NON-NLS-1$
+ }
+ graphsById.put(id, consumer.getGraphView());
+ }
+
+ /**
+ * Return the graph view associated with the given id, or null if it does not exist.
+ *
+ * @param id
+ * The id of the graph
+ * @return The graph view registered for the given ID, which can be null.
+ * @since 2.4
+ */
+ public IGraphView<URI> getGraphView(String id) {
+ return graphsById.get(id);
+ }
+
}
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/graph/IGraphConsumer.java b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/graph/IGraphConsumer.java
new file mode 100644
index 000000000..4c1da13db
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/graph/IGraphConsumer.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.graph;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.IGraphView;
+
+/**
+ * Graph consumer, that maintains the state of a graph created by a third party.
+ *
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 2.4
+ */
+public interface IGraphConsumer {
+
+ /**
+ * Set the graph to be used by this consumer.
+ *
+ * @param graph
+ * The graph to use
+ */
+ void setGraph(IGraph<URI> graph);
+
+ /**
+ * Return the ID used to identify this specific consumer.
+ *
+ * @return the consumer id
+ */
+ String getId();
+
+ /**
+ * Provide a read-only view of the graph used by this consumer.
+ *
+ * @return A read-only view of the graph used by this consumer.
+ */
+ IGraphView<URI> getGraphView();
+}
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties
index 5c5605a9b..c17e9c04e 100644
--- a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2011, 2012 Obeo.
+# Copyright (c) 2011, 2015 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
@@ -15,4 +15,6 @@ duplicate.extension = The extension {0} is registered twice
RCPMatchEngineFactory.INCORECT_USE_IDENTIFIER_ATTRIBUTE = Incorrect value of UseIdentifier stored in preferences
-logging.appender.error = Impossible to log to file {0}.\nException message is: {1} \ No newline at end of file
+logging.appender.error = Impossible to log to file {0}.\nException message is: {1}
+
+duplicate.graph.id.msg = A graph consumer is already registered for the given ID "{0}". Only one graph consumer can be registered for a given ID.
diff --git a/plugins/org.eclipse.emf.compare.specifications/src/3.2.0-release.mediawiki b/plugins/org.eclipse.emf.compare.specifications/src/3.2.0-release.mediawiki
index ccab36de7..c0ee3e83d 100644
--- a/plugins/org.eclipse.emf.compare.specifications/src/3.2.0-release.mediawiki
+++ b/plugins/org.eclipse.emf.compare.specifications/src/3.2.0-release.mediawiki
@@ -325,3 +325,33 @@ This change is accompanied by EGit-specific and papyrus-specific classes registe
** is used to actually create the <code>ResourceAttachmentChange</code> with kind <code>MOVE</code>
* <code>PapyrusResourceAttachmentChangeMerger</code> in project <code>org.eclipse.emf.compare.diagram.ide.ui.papyrus</code>
** is used to merge papyrus-specific empty resources, which contain no model element to which any diff can be attached. This is necessary to properly create or delete empty resources such as *.di files, or sometimes empty *.notation files also.
+
+== US_320_007 - Remove EMFCompareConfiguration from EMFCompareRCPUIPlugin and extract Graph in a separate plug-in ==
+
+=== Description ===
+Depreciate the access to <code>EMFCompareConfiguration</code> in the <code>EMFCompareRCPUIPlugin</code>.<br/>
+Depreciate the access to <code>Graph</code> in <code>EMFCompareConfiguration</code>.<br/>
+Extract the management of the dependency graph from EMFCompare to its own plugin.
+
+==== Categories ====
+[[./index.html#Core-related Specifications|Core]]
+
+=== Content ===
+
+==== specification ====
+The graphs used by EMFCompare are currently computed and managed by an internal class in <code>org.eclipse.emf.compare</code> bundle. The URI resources graph is shared by all comparisons, its instance being held by the <code>ThreadedModelResolver</code>. Since the bundle <code>org.eclipse.emf.compare.ide.ui</code> needs to access this graph, it is passed throught the <code>EMFCompareConfiguration</code> which is accessible in the <code>EMFCompareRCPUIPlugin</code>.
+The <code>EMFCompareRCPUIPlugin</code> and the URI resources Graph are singletons and used for all comparisons. On the other hand, the <code>EMFCompareConfiguration</code> is specific to each comparison and recreated each time.
+It seems that the <code>EMFCompareConfiguration</code> has been put in the <code>EMFCompareRCPUIPlugin</code> only to allow the transfert of the URI resources graph and the <code>StructureMergeViewerFilter</code> between plugins. A solution to give access to the URI resources graph is to create a new plugin with the creation and managment of graphs as responsibility. The <code>StructureMergeViewerFilter</code> which is given by the <code>EMFCompareConfiguration</code> through the <code>EMFCompareRCPUIPlugin</code> must be give in another way. A solution is to give it through the <code>TreeItemAdapterFactorySpec</code>.
+This work done, the field <code>compareConfiguration</code> and the methods <code>getEMFCompareConfiguration</code> and <code>setEMFCompareConfiguration</code> will be deprecated, and will not have any effects anymore.
+
+==== design ====
+Several different graphs are used during a comparison. The URI resources graph is the only one to be unique for all comparisons. The other graphs are comparison specific.
+To handle the previously expressed needs, several actions must be performed:
+* Extract the classes <code>Graph</code> and <code>ReadOnlyGraph</code> in a new plugin <code>org.eclipse.emf.compare.graph</code>
+* The plugin must be a singleton
+* The resource graph must be accessible from the plugin added
+* The class <code>Graph</code> must remain accessible for comparison needs.
+
+==== test cases ====
+The work will be tested by non-regression tests
+
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/utils/GraphTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/utils/GraphTest.java
index a9e77cd43..362f33313 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/utils/GraphTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/utils/GraphTest.java
@@ -22,8 +22,9 @@ import com.google.common.collect.Sets;
import java.util.Iterator;
import java.util.Set;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.PruningIterator;
import org.eclipse.emf.compare.internal.utils.Graph;
-import org.eclipse.emf.compare.internal.utils.PruningIterator;
import org.junit.Test;
/**
@@ -36,7 +37,7 @@ public class GraphTest {
@Test
public void testBuildSubGraph() {
- Graph<String> graph = new Graph<String>();
+ IGraph<String> graph = new Graph<String>();
//@formatter:off
/*
* Add the following graph:
@@ -64,7 +65,7 @@ public class GraphTest {
*/
@Test
public void testPrune() {
- Graph<String> graph = new Graph<String>();
+ IGraph<String> graph = new Graph<String>();
//@formatter:off
/*
* Add the following graph:
@@ -87,7 +88,7 @@ public class GraphTest {
@Test
public void testBreadthFirstIteration() {
- Graph<String> graph = new Graph<String>();
+ IGraph<String> graph = new Graph<String>();
//@formatter:off
/*
* With the following Graph:
@@ -141,7 +142,7 @@ public class GraphTest {
@Test
public void testTreeIteration_1() {
- Graph<String> graph = getAcyclicGraph();
+ IGraph<String> graph = getAcyclicGraph();
Iterator<String> iteratorOnA = graph.depthFirstIterator("A");
assertEquals("A", iteratorOnA.next());
@@ -155,7 +156,7 @@ public class GraphTest {
@Test
public void testTreeIteration_2() {
- Graph<String> graph = getAcyclicGraph();
+ IGraph<String> graph = getAcyclicGraph();
Iterator<String> iteratorOnC = graph.depthFirstIterator("C");
assertEquals("C", iteratorOnC.next());
@@ -166,7 +167,7 @@ public class GraphTest {
@Test
public void testTreeIteration_3() {
- Graph<String> graph = getAcyclicGraph();
+ IGraph<String> graph = getAcyclicGraph();
Iterator<String> iteratorOnI = graph.depthFirstIterator("I");
assertEquals("I", iteratorOnI.next());
@@ -178,7 +179,7 @@ public class GraphTest {
@Test
public void testTreeIteration_4() {
- Graph<String> graph = getAcyclicGraph();
+ IGraph<String> graph = getAcyclicGraph();
Iterator<String> iteratorOnJ = graph.depthFirstIterator("J");
assertEquals("J", iteratorOnJ.next());
@@ -191,7 +192,7 @@ public class GraphTest {
@Test
public void testDepthIterationWithCycles_1() {
- Graph<String> graph = getGraphWithCycles();
+ IGraph<String> graph = getGraphWithCycles();
Iterator<String> iteratorOnA = graph.depthFirstIterator("A");
assertEquals("A", iteratorOnA.next());
@@ -207,7 +208,7 @@ public class GraphTest {
@Test
public void testDepthIterationWithCycles_2() {
- Graph<String> graph = getGraphWithCycles();
+ IGraph<String> graph = getGraphWithCycles();
Iterator<String> iteratorOnC = graph.depthFirstIterator("C");
assertEquals("C", iteratorOnC.next());
@@ -223,7 +224,7 @@ public class GraphTest {
@Test
public void testDepthIterationWithCycles_3() {
- Graph<String> graph = getGraphWithCycles();
+ IGraph<String> graph = getGraphWithCycles();
Iterator<String> iteratorOnI = graph.depthFirstIterator("I");
assertEquals("I", iteratorOnI.next());
@@ -236,7 +237,7 @@ public class GraphTest {
@Test
public void testDepthIterationWithCycles_4() {
- Graph<String> graph = getGraphWithCycles();
+ IGraph<String> graph = getGraphWithCycles();
Iterator<String> iteratorOnJ = graph.depthFirstIterator("J");
assertEquals("J", iteratorOnJ.next());
@@ -259,8 +260,8 @@ public class GraphTest {
* D E F H M N
* </pre>
*/
- private Graph<String> getAcyclicGraph() {
- Graph<String> graph = new Graph<String>();
+ private IGraph<String> getAcyclicGraph() {
+ IGraph<String> graph = new Graph<String>();
graph.addChildren("A", ImmutableSet.of("B", "C"));
graph.addChildren("B", ImmutableSet.of("D"));
@@ -284,8 +285,8 @@ public class GraphTest {
* D - E F = H M N
* </pre>
*/
- private Graph<String> getGraphWithCycles() {
- Graph<String> graph = new Graph<String>();
+ private IGraph<String> getGraphWithCycles() {
+ IGraph<String> graph = new Graph<String>();
graph.addChildren("A", ImmutableSet.of("B", "C"));
graph.addChildren("B", ImmutableSet.of("D"));
diff --git a/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/META-INF/MANIFEST.MF
index 91c30de3f..71c940e58 100644
--- a/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/META-INF/MANIFEST.MF
@@ -25,4 +25,5 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: com.google.common.base;version="[11.0.0,16.0.0)",
- com.google.common.collect;version="[11.0.0,16.0.0)"
+ com.google.common.collect;version="[11.0.0,16.0.0)",
+ com.google.common.eventbus;version="[11.0.0,16.0.0)"
diff --git a/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/src/org/eclipse/emf/compare/uml2/ide/ui/tests/comparison/tooltip/UMLTooltipProviderTest.java b/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/src/org/eclipse/emf/compare/uml2/ide/ui/tests/comparison/tooltip/UMLTooltipProviderTest.java
index 8c71fa99c..f628a18bb 100644
--- a/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/src/org/eclipse/emf/compare/uml2/ide/ui/tests/comparison/tooltip/UMLTooltipProviderTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.ide.ui.tests/src/org/eclipse/emf/compare/uml2/ide/ui/tests/comparison/tooltip/UMLTooltipProviderTest.java
@@ -19,6 +19,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.Collection;
@@ -39,7 +40,8 @@ import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.provider.TooltipLabelAdapterFactory;
import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.DefaultGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeNodeItemProviderSpec;
@@ -76,26 +78,31 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
private TreeNode moveEdge;
+ private EventBus eventBus;
+
@BeforeClass
public static void setupClass() {
fillRegistries();
- final Collection<AdapterFactory> factories = Lists.newArrayList();
- factories.add(new CompareItemProviderAdapterFactorySpec());
- factories.add(new TreeItemProviderAdapterFactorySpec());
- factories.add(new EcoreItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- factories.add(new TooltipLabelAdapterFactory());
- composedAdapterFactory = new ComposedAdapterFactory(factories);
}
@AfterClass
public static void teardownClass() {
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(null);
resetRegistries();
}
public void setup_001() throws Exception {
- TreeItemProviderAdapterFactorySpec treeItemProviderAdapterFactorySpec = new TreeItemProviderAdapterFactorySpec();
+ eventBus = new EventBus();
+ TreeItemProviderAdapterFactorySpec treeItemProviderAdapterFactorySpec = new TreeItemProviderAdapterFactorySpec(
+ new StructureMergeViewerFilter(eventBus));
+
+ final Collection<AdapterFactory> factories = Lists.newArrayList();
+ factories.add(new CompareItemProviderAdapterFactorySpec());
+ factories.add(treeItemProviderAdapterFactorySpec);
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ factories.add(new TooltipLabelAdapterFactory());
+ composedAdapterFactory = new ComposedAdapterFactory(factories);
+
itemProvider = (TreeNodeItemProviderSpec)treeItemProviderAdapterFactorySpec.createTreeNodeAdapter();
mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
@@ -146,15 +153,8 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
@@ -170,15 +170,8 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
final boolean leftEditable = true;
final boolean rightEditable = false;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
@@ -194,15 +187,8 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
@@ -218,15 +204,8 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
final boolean leftEditable = true;
final boolean rightEditable = true;
- CompareConfiguration cc = new CompareConfiguration();
- cc.setLeftEditable(leftEditable);
- cc.setRightEditable(rightEditable);
- EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
- emfCC.setAdapterFactory(composedAdapterFactory);
- EMFCompareRCPUIPlugin.getDefault().setEMFCompareConfiguration(emfCC);
-
- MockMergeAction action = new MockMergeAction(editingDomain, mergerRegistry, accept, leftEditable,
- rightEditable, null);
+ IEMFCompareConfiguration emfCC = createConfiguration(leftEditable, rightEditable);
+ MockMergeAction action = new MockMergeAction(emfCC, mergerRegistry, accept, null);
// Get tooltip for a diff on a move of an edge.
action.updateSelection(new StructuredSelection(moveEdge));
@@ -263,4 +242,15 @@ public class UMLTooltipProviderTest extends AbstractUMLTest {
}
};
+ private IEMFCompareConfiguration createConfiguration(boolean leftEditable, boolean rightEditable) {
+ CompareConfiguration cc = new CompareConfiguration();
+ cc.setLeftEditable(leftEditable);
+ cc.setRightEditable(rightEditable);
+ EMFCompareConfiguration emfCC = new EMFCompareConfiguration(cc);
+ emfCC.setEditingDomain(editingDomain);
+ emfCC.setAdapterFactory(composedAdapterFactory);
+
+ return emfCC;
+ }
+
}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/AbstractDifferenceOrderTest.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/AbstractDifferenceOrderTest.java
index e711a1d1a..e8c9adff3 100644
--- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/AbstractDifferenceOrderTest.java
+++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui.tests/src/org/eclipse/emf/compare/uml2/rcp/ui/tests/groups/AbstractDifferenceOrderTest.java
@@ -71,6 +71,8 @@ public abstract class AbstractDifferenceOrderTest {
private AdapterFactoryItemDelegator itemDelegator;
+ protected EventBus eventBus;
+
/**
* Predicate mocking the {@link StructureMergeViewerFilter} behavior.
*/
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 8edefb6f5..636eb96c2 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
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.uml2.rcp.ui.tests.groups;
import static com.google.common.base.Predicates.alwaysTrue;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.List;
@@ -23,6 +24,7 @@ import org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl;
import org.eclipse.emf.compare.postprocessor.IPostProcessor.Descriptor.Registry;
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;
@@ -70,9 +72,11 @@ public class UMLDifferencesOrderTest extends AbstractDifferenceOrderTest {
@Override
protected List<AdapterFactory> getAdaptersFactory() {
+ eventBus = new EventBus();
return Lists.<AdapterFactory> newArrayList(new CompareItemProviderAdapterFactorySpec(),
- new TreeItemProviderAdapterFactorySpec(), new UMLCompareCustomItemProviderAdapterFactory(),
- new UMLItemProviderAdapterFactory(), new UMLCompareItemProviderDecoratorAdapterFactory(),
+ new TreeItemProviderAdapterFactorySpec(new StructureMergeViewerFilter(eventBus)),
+ new UMLCompareCustomItemProviderAdapterFactory(), new UMLItemProviderAdapterFactory(),
+ new UMLCompareItemProviderDecoratorAdapterFactory(),
new ReflectiveItemProviderAdapterFactory());
}
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 fa0277d48..579b92bff 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
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.uml2.rcp.ui.tests.profile;
import static com.google.common.base.Predicates.alwaysTrue;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.List;
@@ -25,6 +26,7 @@ import org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl;
import org.eclipse.emf.compare.postprocessor.IPostProcessor;
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;
@@ -101,9 +103,11 @@ public class DynamicProfileIntegrationDisplayTest extends AbstractDifferenceOrde
@Override
protected List<AdapterFactory> getAdaptersFactory() {
+ eventBus = new EventBus();
return Lists.<AdapterFactory> newArrayList(new ProfiledUMLCompareItemProviderAdapterFactory(),
new UMLProfileItemProviderAdapterFactoryDecorator(),
- new CompareItemProviderAdapterFactorySpec(), new TreeItemProviderAdapterFactorySpec(),
+ new CompareItemProviderAdapterFactorySpec(), new TreeItemProviderAdapterFactorySpec(
+ new StructureMergeViewerFilter(eventBus)),
new UMLCompareCustomItemProviderAdapterFactory(), new UMLItemProviderAdapterFactory(),
new UMLCompareItemProviderDecoratorAdapterFactory(),
new ReflectiveItemProviderAdapterFactory());
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 8b2d76b5f..23585753b 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
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.uml2.rcp.ui.tests.profile;
import static com.google.common.base.Predicates.alwaysTrue;
import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
import java.io.IOException;
import java.util.List;
@@ -24,6 +25,7 @@ import org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl;
import org.eclipse.emf.compare.postprocessor.IPostProcessor;
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;
@@ -80,9 +82,11 @@ public class StaticProfileIntegrationDisplayTest extends AbstractDifferenceOrder
protected List<AdapterFactory> getAdaptersFactory() {
// Adds UML2CompareTestProfileItemProviderAdapterFactory item adapter factory to use the custom icon
// defined in it.
+ eventBus = new EventBus();
return Lists.<AdapterFactory> newArrayList(new ProfiledUMLCompareItemProviderAdapterFactory(),
new UMLProfileItemProviderAdapterFactoryDecorator(),
- new CompareItemProviderAdapterFactorySpec(), new TreeItemProviderAdapterFactorySpec(),
+ new CompareItemProviderAdapterFactorySpec(), new TreeItemProviderAdapterFactorySpec(
+ new StructureMergeViewerFilter(eventBus)),
new UMLCompareCustomItemProviderAdapterFactory(),
new UML2CompareTestProfileItemProviderAdapterFactory(), new UMLItemProviderAdapterFactory(),
new UMLCompareItemProviderDecoratorAdapterFactory(),
diff --git a/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF
index a988aa846..56c7b5ddf 100644
--- a/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Export-Package: org.eclipse.emf.compare,
org.eclipse.emf.compare.conflict,
org.eclipse.emf.compare.diff,
org.eclipse.emf.compare.equi,
+ org.eclipse.emf.compare.graph,
org.eclipse.emf.compare.impl,
org.eclipse.emf.compare.internal;x-friends:="org.eclipse.emf.compare.logical,org.eclipse.emf.compare.ide,org.eclipse.emf.compare.edit",
org.eclipse.emf.compare.internal.dmp;x-friends:="org.eclipse.emf.compare.ide.ui",
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraph.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraph.java
new file mode 100644
index 000000000..ae0fea220
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraph.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.graph;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Interface of a directed graph.
+ *
+ * @author <a href="mailto:laurent.delaigue@obeo.fr">Laurent Delaigue</a>
+ * @param <E>
+ * The type of the graph nodes
+ * @since 3.3
+ */
+public interface IGraph<E> {
+
+ /**
+ * Checks whether this graph already contains the given element.
+ *
+ * @param element
+ * Element we need to check.
+ * @return <code>true</code> if this graph already contains the given elment, <code>false</code>
+ * otherwise.
+ */
+ boolean contains(E element);
+
+ /** Clears this graph and goes back to a pristine state. */
+ void clear();
+
+ /**
+ * Adds a new element to this graph, if it does not exists yet. Elements will initially have no connection
+ * to other elements, and can thus be considered "roots" of the graph.
+ *
+ * @param element
+ * The element to add as a new root to this graph.
+ * @return <code>true</code> if this element did not previously exist in the graph.
+ */
+ boolean add(E element);
+
+ /**
+ * Removes the given element's node from this graph. This will effectively break all connections to that
+ * node.
+ *
+ * @param element
+ * The element which is to be removed from this graph.
+ */
+ void remove(E element);
+
+ /**
+ * Removes the given elements' nodes from this graph. This will effectively break all connections to these
+ * nodes.
+ *
+ * @param elements
+ * The elements which are to be removed from this graph.
+ */
+ void removeAll(Collection<E> elements);
+
+ /**
+ * Connects the given set of elements to a given parent. Note that nodes will be created for all new
+ * elements if they do not exist yet.
+ *
+ * @param element
+ * The element that is to be connected with new children.
+ * @param newChildren
+ * The set of elements to connect to the given parent.
+ */
+ void addChildren(E element, Set<E> newChildren);
+
+ /**
+ * Checks if the given element is a parent of the given potential child, directly or not.
+ *
+ * @param parent
+ * Element that could be a parent of <code>potentialChild</code>.
+ * @param potentialChild
+ * The potential child of <code>parent</code>.
+ * @return <code>true</code> if <code>parent</code> is an ancestor of <code>potentialChild</code>.
+ */
+ boolean hasChild(E parent, E potentialChild);
+
+ /**
+ * Returns the <u>direct</u> parents of the given <code>element</code>.
+ * <p>
+ * <b>Note</b> that the returned set is a view over a sub-graph of this graph, and that changes to it will
+ * not be reflected within the graph itself.
+ * </p>
+ *
+ * @param element
+ * The element which parents we seek.
+ * @return The set of <u>direct</u> parents for the given <code>element</code>.
+ */
+ Set<E> getDirectParents(E element);
+
+ /**
+ * Returns the tree starting from the given root element if it is contained in the graph.
+ * <p>
+ * Contrarily to {@link #getSubgraphContaining(Object)}, this will only iterate over the children (and
+ * recursively) of the given node, without ever "going up" to parents of these children.
+ * </p>
+ * <p>
+ * <b>Note</b> that the returned set is a view over a sub-graph of this graph, and that changes to it will
+ * not be reflected within the graph itself.
+ * </p>
+ *
+ * @param root
+ * The element we are to consider as the root of a tree.
+ * @return The tree starting from the given root element if it is contained in this graph, and empty set
+ * otherwise.
+ */
+ Set<E> getTreeFrom(E root);
+
+ /**
+ * Returns the tree starting from the given root element and ending at the given boundaries..
+ * <p>
+ * Contrarily to {@link #getSubgraphContaining(Object, Set)}, this will only iterate over the children
+ * (and recursively) of the given node, without ever "going up" to parents of these children.
+ * </p>
+ * <p>
+ * <b>Note</b> that the returned set is a view over a sub-graph of this graph, and that changes to it will
+ * not be reflected within the graph itself.
+ * </p>
+ *
+ * @param root
+ * The element we are to consider as the root of a tree.
+ * @param endPoints
+ * Boundaries of the tree.
+ * @return The tree starting from the given root element if it is contained in this graph, and empty set
+ * otherwise.
+ */
+ Set<E> getTreeFrom(E root, Set<E> endPoints);
+
+ /**
+ * Returns the set of all elements of the subgraph containing the given element.
+ * <p>
+ * <b>Note</b> that the returned set is a view over a sub-graph of this graph, and that changes to it will
+ * not be reflected within the graph itself.
+ * </p>
+ *
+ * @param element
+ * Element we need the subgraph of.
+ * @return The set of all elements of the subgraph containing the given element, an empty set if that
+ * element is not present in this graph.
+ */
+ Set<E> getSubgraphContaining(E element);
+
+ /**
+ * Returns the set of all elements of the subgraph containing the given element and ending at the given
+ * boundaries.
+ * <p>
+ * <b>Note</b> that the returned set is a view over a sub-graph of this graph, and that changes to it will
+ * not be reflected within the graph itself.
+ * </p>
+ *
+ * @param element
+ * Element we need the subgraph of.
+ * @param endPoints
+ * Boundaries of the needed subgraph.
+ * @return An iterable over all elements of the subgraph containing the given element, an empty set if
+ * that element is not present in this graph.
+ */
+ Set<E> getSubgraphContaining(E element, Set<E> endPoints);
+
+ /**
+ * Returns a breadth-first iterator over this whole graph. This will begin iteration on this graph's roots
+ * (whether they are linked together (directly or indirectly) or not), then carry on over each depth
+ * level. This will never visit the same element twice, nor will it ever visit an element which parents
+ * haven't all been iterated over yet.
+ * <p>
+ * The returned iterator does not support removal, and will fail or return undefined results if this graph
+ * is modified after the iterator's creation.
+ * </p>
+ *
+ * @return A breadth-first iterator over this whole graph.
+ */
+ PruningIterator<E> breadthFirstIterator();
+
+ /**
+ * Returns a depth first iterator created with the given element as root. If the graph contains cycles,
+ * the same node won't be returned twice.
+ * <p>
+ * The root will be returned first, then the left-most child of that root, then the left-most child of
+ * that child if any, or the closest sibling to the right of the current element. For example, with the
+ * following tree:
+ *
+ * <pre>
+ * A
+ * / \
+ * B C
+ * / / \
+ * D E F
+ * </pre>
+ *
+ * The iteration order will be : A, B, D, C, E, F.
+ * </p>
+ * <p>
+ * The returned iterator does not support removal, and will fail or return undefined results if this graph
+ * is modified after the iterator's creation.
+ * </p>
+ *
+ * @param root
+ * The root of the tree over which we need to iterate.
+ * @return An iterator over the tree starting from the given root.
+ */
+ Iterator<E> depthFirstIterator(E root);
+
+ /**
+ * Get the parent data of the given element.
+ * <p>
+ * The parent data, is the URI of the parent resource's object in case of a containment relationship
+ * between the given element and its parent.
+ * <p>
+ *
+ * @param element
+ * Element we need the parent data of.
+ * @return A parent data of type <code>E</code> if this element has a parent data, <code>null</code>
+ * otherwise.
+ */
+ E getParentData(E element);
+
+ /**
+ * Set the parent data for the given element.
+ * <p>
+ * The parent data, is the URI of the parent resource's object in case of a containment relationship
+ * between the given element and its parent.
+ * </p>
+ * If the given element has several parents, then the addition of a new parent data results in delete the
+ * parent data. If the given element has no parents, then the addition of a new parent data results in
+ * delete the parent data.
+ *
+ * @param element
+ * Element for which we need to set the parent data.
+ * @param parentData
+ * The parent data to set.
+ */
+ void addParentData(E element, E parentData);
+
+}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraphView.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraphView.java
new file mode 100644
index 000000000..6f6cc13e3
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/IGraphView.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.graph;
+
+import com.google.common.collect.ImmutableSet;
+
+import java.util.Set;
+
+/**
+ * Read-only view of a {@link org.eclipse.emf.compare.internal.utils.Graph}.
+ *
+ * @param <E>
+ * Kind of elements used as this graph's nodes.
+ * @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
+ * @since 3.3
+ */
+public interface IGraphView<E> {
+
+ /**
+ * Checks whether this graph already contains the given element.
+ *
+ * @param element
+ * Element we need to check.
+ * @return <code>true</code> if this graph already contains the given elment, <code>false</code>
+ * otherwise.
+ */
+ boolean contains(E element);
+
+ /**
+ * Checks if the given element is a parent of the given potential child, directly or not.
+ *
+ * @param parent
+ * Element that could be a parent of <code>potentialChild</code>.
+ * @param potentialChild
+ * The potential child of <code>parent</code>.
+ * @return <code>true</code> if <code>parent</code> is an ancestor of <code>potentialChild</code>.
+ */
+ boolean hasChild(E parent, E potentialChild);
+
+ /**
+ * Returns the <u>direct</u> parents of the given <code>element</code>.
+ * <p>
+ * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
+ * </p>
+ *
+ * @param element
+ * The element which parents we seek.
+ * @return An immutable set of <u>direct</u> parents for the given <code>element</code>.
+ */
+ ImmutableSet<E> getDirectParents(E element);
+
+ /**
+ * Get the parent data of the given element. If the given element has several parents, then this method
+ * will return <code>null</code>. If the given element has no parents, then then this method will return
+ * <code>null</code>
+ *
+ * @param element
+ * Element we need the parent data of.
+ * @return A parent data of type <code>E</code> if this element has a parent data, <code>null</code>
+ * otherwise.
+ */
+ E getParentData(E element);
+
+ /**
+ * Returns the set of all elements of the subgraph containing the given element.
+ * <p>
+ * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
+ * </p>
+ *
+ * @param element
+ * Element we need the subgraph of.
+ * @return An immutable set of all elements of the subgraph containing the given element, an empty
+ * immutable set if that element is not present in this graph.
+ */
+ ImmutableSet<E> getSubgraphContaining(E element);
+
+ /**
+ * Returns the set of all elements of the subgraph containing the given element and ending at the given
+ * boundaries.
+ * <p>
+ * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
+ * </p>
+ *
+ * @param element
+ * Element we need the subgraph of.
+ * @param endPoints
+ * Boundaries of the needed subgraph.
+ * @return An immutable set over all elements of the subgraph containing the given element, an immutable
+ * empty set if that element is not present in this graph.
+ */
+ ImmutableSet<E> getSubgraphContaining(E element, ImmutableSet<E> endPoints);
+
+ /**
+ * Returns the tree starting from the given root element if it is contained in the graph.
+ * <p>
+ * Contrarily to {@link #getSubgraphContaining(Object)}, this will only iterate over the children (and
+ * recursively) of the given node, without ever "going up" to parents of these children.
+ * </p>
+ * <p>
+ * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
+ * </p>
+ *
+ * @param root
+ * The element we are to consider as the root of a tree.
+ * @return The immutable tree starting from the given root element if it is contained in this graph, and
+ * immutable empty set otherwise.
+ */
+ ImmutableSet<E> getTreeFrom(E root);
+
+ /**
+ * Returns the tree starting from the given root element and ending at the given boundaries..
+ * <p>
+ * Contrarily to {@link #getSubgraphContaining(Object, Set)}, this will only iterate over the children
+ * (and recursively) of the given node, without ever "going up" to parents of these children.
+ * </p>
+ * <p>
+ * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
+ * </p>
+ *
+ * @param root
+ * The element we are to consider as the root of a tree.
+ * @param endPoints
+ * Boundaries of the tree.
+ * @return The immutable tree starting from the given root element if it is contained in this graph, and
+ * immutable empty set otherwise.
+ */
+ ImmutableSet<E> getTreeFrom(E root, Set<E> endPoints);
+
+ /**
+ * Returns a breadth-first iterator over this whole graph. This will begin iteration on this graph's roots
+ * (whether they are linked together (directly or indirectly) or not), then carry on over each depth
+ * level. This will never visit the same element twice, nor will it ever visit an element which parents
+ * haven't all been iterated over yet.
+ * <p>
+ * The returned iterator does not support removal, and will fail or returned undefined results if this
+ * graph is modified after the iterator's creation.
+ * </p>
+ *
+ * @return A breadth-first iterator over this whole graph.
+ */
+ PruningIterator<E> breadthFirstIterator();
+
+}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/PruningIterator.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/PruningIterator.java
index 72107854f..4c241ca8a 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/PruningIterator.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/graph/PruningIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Obeo.
+ * Copyright (c) 2014, 2015 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
@@ -8,7 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.internal.utils;
+package org.eclipse.emf.compare.graph;
import java.util.Iterator;
@@ -21,6 +21,7 @@ import java.util.Iterator;
* @param <E>
* Kind of elements this iterator is for.
* @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ * @since 3.3
*/
public interface PruningIterator<E> extends Iterator<E> {
/**
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
index 8787af54b..9480b65bc 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/merge/MergeDependenciesUtil.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.graph.IGraph;
import org.eclipse.emf.compare.internal.utils.Graph;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.merge.IMerger2;
@@ -56,7 +57,7 @@ public final class MergeDependenciesUtil {
* @return The dependency graph of this comparison's differences.
* @see #mapDifferences(Collection, org.eclipse.emf.compare.merge.IMerger.Registry, boolean, MergeMode)
*/
- public static Graph<Diff> mapDifferences(Comparison comparison, IMerger.Registry mergerRegistry,
+ public static IGraph<Diff> mapDifferences(Comparison comparison, IMerger.Registry mergerRegistry,
boolean mergeRightToLeft, MergeMode mergeMode) {
return mapDifferences(comparison.getDifferences(), mergerRegistry, mergeRightToLeft, mergeMode);
}
@@ -83,9 +84,9 @@ public final class MergeDependenciesUtil {
* The merge mode. If MergeMode is null, then no differences will be filtered.
* @return The dependency graph of this comparison's differences.
*/
- public static Graph<Diff> mapDifferences(Collection<Diff> differences, IMerger.Registry mergerRegistry,
+ public static IGraph<Diff> mapDifferences(Collection<Diff> differences, IMerger.Registry mergerRegistry,
boolean mergeRightToLeft, MergeMode mergeMode) {
- Graph<Diff> differencesGraph = new Graph<Diff>();
+ IGraph<Diff> differencesGraph = new Graph<Diff>();
final Predicate<? super Diff> filter;
if (mergeMode == MergeMode.RIGHT_TO_LEFT) {
filter = fromSide(DifferenceSource.RIGHT);
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
index d77484c7e..cda510f4c 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/Graph.java
@@ -35,6 +35,8 @@ import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.emf.common.util.AbstractTreeIterator;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.PruningIterator;
/**
* This structure will be used to maintain a undirected graph of elements.
@@ -54,7 +56,7 @@ import org.eclipse.emf.common.util.AbstractTreeIterator;
* Kind of elements used as this graph's nodes.
* @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
*/
-public class Graph<E> {
+public class Graph<E> implements IGraph<E> {
/** Keeps track of this graph's individual nodes. */
private final Map<E, Node<E>> nodes;
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ReadOnlyGraph.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ReadOnlyGraph.java
index 3083709b3..c3698c156 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ReadOnlyGraph.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/utils/ReadOnlyGraph.java
@@ -14,6 +14,10 @@ import com.google.common.collect.ImmutableSet;
import java.util.Set;
+import org.eclipse.emf.compare.graph.IGraph;
+import org.eclipse.emf.compare.graph.IGraphView;
+import org.eclipse.emf.compare.graph.PruningIterator;
+
/**
* Read-only version of an already existing {@link org.eclipse.emf.compare.internal.utils.Graph}.
*
@@ -21,10 +25,10 @@ import java.util.Set;
* Kind of elements used as this graph's nodes.
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
-public final class ReadOnlyGraph<E> {
+public final class ReadOnlyGraph<E> implements IGraphView<E> {
/** The writable graph. */
- private final Graph<E> graph;
+ private final IGraph<E> graph;
/**
* Constructor.
@@ -32,7 +36,7 @@ public final class ReadOnlyGraph<E> {
* @param graph
* the graph to convert.
*/
- private ReadOnlyGraph(Graph<E> graph) {
+ private ReadOnlyGraph(IGraph<E> graph) {
this.graph = graph;
}
@@ -45,147 +49,86 @@ public final class ReadOnlyGraph<E> {
* The writable graph to convert.
* @return a read-only graph version of the given graph.
*/
- public static <E> ReadOnlyGraph<E> toReadOnlyGraph(Graph<E> graph) {
+ public static <E> ReadOnlyGraph<E> toReadOnlyGraph(IGraph<E> graph) {
return new ReadOnlyGraph<E>(graph);
}
/**
- * Checks whether this graph already contains the given element.
+ * {@inheritDoc}
*
- * @param element
- * Element we need to check.
- * @return <code>true</code> if this graph already contains the given elment, <code>false</code>
- * otherwise.
+ * @see org.eclipse.emf.compare.graph.IGraphView#contains(Object)
*/
public boolean contains(E element) {
return graph.contains(element);
}
/**
- * Checks if the given element is a parent of the given potential child, directly or not.
+ * {@inheritDoc}
*
- * @param parent
- * Element that could be a parent of <code>potentialChild</code>.
- * @param potentialChild
- * The potential child of <code>parent</code>.
- * @return <code>true</code> if <code>parent</code> is an ancestor of <code>potentialChild</code>.
+ * @see org.eclipse.emf.compare.graph.IGraphView#hasChild(Object, Object)
*/
public boolean hasChild(E parent, E potentialChild) {
return graph.hasChild(parent, potentialChild);
}
/**
- * Returns the <u>direct</u> parents of the given <code>element</code>.
- * <p>
- * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
- * </p>
+ * {@inheritDoc}
*
- * @param element
- * The element which parents we seek.
- * @return An immutable set of <u>direct</u> parents for the given <code>element</code>.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getDirectParents(Object)
*/
public ImmutableSet<E> getDirectParents(E element) {
return ImmutableSet.copyOf(graph.getDirectParents(element));
}
/**
- * Get the parent data of the given element. If the given element has several parents, then this method
- * will return <code>null</code>. If the given element has no parents, then then this method will return
- * <code>null</code>
+ * {@inheritDoc}
*
- * @param element
- * Element we need the parent data of.
- * @return A parent data of type <code>E</code> if this element has a parent data, <code>null</code>
- * otherwise.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getParentData(Object)
*/
public E getParentData(E element) {
return graph.getParentData(element);
}
/**
- * Returns the set of all elements of the subgraph containing the given element.
- * <p>
- * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
- * </p>
+ * {@inheritDoc}
*
- * @param element
- * Element we need the subgraph of.
- * @return An immutable set of all elements of the subgraph containing the given element, an empty
- * immutable set if that element is not present in this graph.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getSubgraphContaining(Object)
*/
public ImmutableSet<E> getSubgraphContaining(E element) {
return getSubgraphContaining(element, ImmutableSet.<E> of());
}
/**
- * Returns the set of all elements of the subgraph containing the given element and ending at the given
- * boundaries.
- * <p>
- * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
- * </p>
+ * {@inheritDoc}
*
- * @param element
- * Element we need the subgraph of.
- * @param endPoints
- * Boundaries of the needed subgraph.
- * @return An immutable set over all elements of the subgraph containing the given element, an immutable
- * empty set if that element is not present in this graph.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getSubgraphContaining(Object, ImmutableSet)
*/
public ImmutableSet<E> getSubgraphContaining(E element, ImmutableSet<E> endPoints) {
return ImmutableSet.copyOf(graph.getSubgraphContaining(element, endPoints));
}
/**
- * Returns the tree starting from the given root element if it is contained in the graph.
- * <p>
- * Contrarily to {@link #getSubgraphContaining(Object)}, this will only iterate over the children (and
- * recursively) of the given node, without ever "going up" to parents of these children.
- * </p>
- * <p>
- * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
- * </p>
+ * {@inheritDoc}
*
- * @param root
- * The element we are to consider as the root of a tree.
- * @return The immutable tree starting from the given root element if it is contained in this graph, and
- * immutable empty set otherwise.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getTreeFrom(Object)
*/
public ImmutableSet<E> getTreeFrom(E root) {
return getTreeFrom(root, ImmutableSet.<E> of());
}
/**
- * Returns the tree starting from the given root element and ending at the given boundaries..
- * <p>
- * Contrarily to {@link #getSubgraphContaining(Object, Set)}, this will only iterate over the children
- * (and recursively) of the given node, without ever "going up" to parents of these children.
- * </p>
- * <p>
- * <b>Note</b> that the returned set is an immutable view over a sub-graph of this graph.
- * </p>
+ * {@inheritDoc}
*
- * @param root
- * The element we are to consider as the root of a tree.
- * @param endPoints
- * Boundaries of the tree.
- * @return The immutable tree starting from the given root element if it is contained in this graph, and
- * immutable empty set otherwise.
+ * @see org.eclipse.emf.compare.graph.IGraphView#getTreeFrom(Object, Set)
*/
public ImmutableSet<E> getTreeFrom(E root, Set<E> endPoints) {
return ImmutableSet.copyOf(graph.getTreeFrom(root, endPoints));
}
/**
- * Returns a breadth-first iterator over this whole graph. This will begin iteration on this graph's roots
- * (whether they are linked together (directly or indirectly) or not), then carry on over each depth
- * level. This will never visit the same element twice, nor will it ever visit an element which parents
- * haven't all been iterated over yet.
- * <p>
- * The returned iterator does not support removal, and will fail or returned undefined results if this
- * graph is modified after the iterator's creation.
- * </p>
+ * {@inheritDoc}
*
- * @return A breadth-first iterator over this whole graph.
+ * @see org.eclipse.emf.compare.graph.IGraphView#breadthFirstIterator()
*/
public PruningIterator<E> breadthFirstIterator() {
return graph.breadthFirstIterator();

Back to the top