Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fleck2016-10-24 03:50:55 -0400
committerLaurent Delaigue2017-01-13 05:54:04 -0500
commita6cb5f1bd528d972fc41cc14907375aeb5ea13dc (patch)
tree41418caf321337aa34566e918cade551b5b81278
parent9a46d2ecdbb0f059ebaef665edb1671de246e327 (diff)
downloadorg.eclipse.emf.compare-a6cb5f1bd528d972fc41cc14907375aeb5ea13dc.tar.gz
org.eclipse.emf.compare-a6cb5f1bd528d972fc41cc14907375aeb5ea13dc.tar.xz
org.eclipse.emf.compare-a6cb5f1bd528d972fc41cc14907375aeb5ea13dc.zip
[483798] Introduce and use context in adapter factories
- Provide context tester for fine-grained selection of adapter factory - Extend extension point with optional context tester - Allow context to be given during creation of adapter factory registry - Fire event on adapter factory change in compare configuration - Add listeners to propagate new adapter factory after context change Includes tests. Bug: 483798 Change-Id: Ib0a1a3538a8cf705ea82620bde625cebfd68636c Signed-off-by: Martin Fleck <mfleck@eclipsesource.com> Signed-off-by: Philip Langer <planger@eclipsesource.com>
-rw-r--r--plugins/org.eclipse.emf.compare.edit/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/schema/adapterFactory.exsd12
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/AbstractContextTester.java51
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/IContextTester.java36
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptor.java11
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptorRegistryImpl.java52
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/context/ContextUtil.java70
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/EMFComparisonSourceActionHandler.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java50
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java14
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/EMFCompareRCPPlugin.java26
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/extension/AbstractRegistryEventListener.java7
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/AdapterFactoryDescriptorRegistryListener.java26
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/RankedAdapterFactoryDescriptorImpl.java32
-rw-r--r--plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/emfcomparercpmessages.properties5
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/adapterfactory/EMFCompareAdapterFactoryTest.java8
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/registry/RankedAdapterFactoryRegistryTest.java340
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java3
22 files changed, 748 insertions, 41 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.edit/META-INF/MANIFEST.MF
index cea9572b6..5dc67a634 100644
--- a/plugins/org.eclipse.emf.compare.edit/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.compare.edit/META-INF/MANIFEST.MF
@@ -8,12 +8,14 @@ Bundle-Activator: org.eclipse.emf.compare.provider.EMFCompareEditPlugin$Implemen
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.emf.compare.command,
+Export-Package: org.eclipse.emf.compare.adapterfactory.context,
+ org.eclipse.emf.compare.command,
org.eclipse.emf.compare.command.impl,
org.eclipse.emf.compare.domain,
org.eclipse.emf.compare.domain.impl,
org.eclipse.emf.compare.internal,
org.eclipse.emf.compare.internal.adapterfactory;x-friends:="org.eclipse.emf.compare.rcp,org.eclipse.emf.compare.rcp.ui",
+ org.eclipse.emf.compare.internal.adapterfactory.context;x-internal:=true,
org.eclipse.emf.compare.internal.domain;x-friends:="org.eclipse.emf.compare.ide.ui",
org.eclipse.emf.compare.provider,
org.eclipse.emf.compare.provider.spec,
diff --git a/plugins/org.eclipse.emf.compare.edit/schema/adapterFactory.exsd b/plugins/org.eclipse.emf.compare.edit/schema/adapterFactory.exsd
index dbfaf5fd1..9d7ffe43f 100644
--- a/plugins/org.eclipse.emf.compare.edit/schema/adapterFactory.exsd
+++ b/plugins/org.eclipse.emf.compare.edit/schema/adapterFactory.exsd
@@ -6,7 +6,7 @@
<meta.schema plugin="org.eclipse.emf.compare.rcp" id="adapterFactory" name="EMF Compare Adapter Factory"/>
</appinfo>
<documentation>
- The aim is to provide a mechanism that allow users to provide their own adapter factory with a specific rank.
+ The aim is to provide a mechanism that allow users to provide their own adapter factory with a specific rank and for a specific context.
With this mechanism you will able to provide, for example, your own CompareItemProviderAdapterFactory in order to provide your own labels of the emf compare metamodel, or provide your own EcoreItemProviderAdapterFactory if you just want to overrides the labels of ecore metamodel.
</documentation>
</annotation>
@@ -81,6 +81,16 @@ With this mechanism you will able to provide, for example, your own CompareItemP
</documentation>
</annotation>
</attribute>
+ <attribute name="context" type="string">
+ <annotation>
+ <documentation>
+ The tester that evaluates in which context this factory should be applied. If no context tester is given, the factory is applied in all contexts.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.compare.adapterfactory.context.IContextTester"/>
+ </appinfo>
+ </annotation>
+ </attribute>
<attribute name="label" type="string">
<annotation>
<documentation>
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/AbstractContextTester.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/AbstractContextTester.java
new file mode 100644
index 000000000..6430c3cfe
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/AbstractContextTester.java
@@ -0,0 +1,51 @@
+package org.eclipse.emf.compare.adapterfactory.context;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.Comparison;
+
+/**
+ * An abstract implementation of {@link IContextTester} that provides convenience methods for retrieving
+ * values from the context map.
+ *
+ * @author Martin Fleck <mfleck@eclipsesource.com>
+ * @since 4.3
+ */
+public abstract class AbstractContextTester implements IContextTester {
+
+ /**
+ * Returns the comparison stored under the {@link IContextTester#CTX_COMPARISON} key.
+ *
+ * @param context
+ * context map
+ * @return comparison or null, if no comparison is stored in the context
+ */
+ protected Comparison getComparison(Map<Object, Object> context) {
+ return getValue(context, CTX_COMPARISON, Comparison.class);
+ }
+
+ /**
+ * Returns the value of the context map stored under the given key, if it is an instance of the given
+ * class.
+ *
+ * @param context
+ * context map
+ * @param key
+ * the key for the context map
+ * @param expectedClass
+ * expected class for the value stored under the key
+ * @param <T>
+ * expected type of the value stored under the key
+ * @return stored value or null, if no matching value is stored under the key
+ */
+ protected static <T> T getValue(Map<Object, Object> context, Object key, Class<T> expectedClass) {
+ if (context == null || key == null || expectedClass == null) {
+ return null;
+ }
+ Object value = context.get(key);
+ if (value != null && expectedClass.isInstance(value)) {
+ return expectedClass.cast(value);
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/IContextTester.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/IContextTester.java
new file mode 100644
index 000000000..fa5ea99ba
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/adapterfactory/context/IContextTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EclipseSource Muenchen GmbH and others.
+ * 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:
+ * Martin Fleck - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.adapterfactory.context;
+
+import java.util.Map;
+
+/**
+ * A tester to evaluate whether a given context matches certain criteria.
+ *
+ * @author Martin Fleck <mfleck@eclipsesource.com>
+ * @since 4.3
+ */
+public interface IContextTester {
+
+ /**
+ * Key used to store the comparison object in the context.
+ */
+ String CTX_COMPARISON = "comparison"; //$NON-NLS-1$
+
+ /**
+ * Returns the result of applying this tester to the given {@code context}.
+ *
+ * @param context
+ * a map of context elements stored under specific keys.
+ * @return {@code true} if the given {@code comparison} is of a certain context, {@code false} otherwise.
+ */
+ boolean apply(Map<Object, Object> context);
+}
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptor.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptor.java
index d9fbc60a0..5b3816427 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptor.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Obeo.
+ * Copyright (c) 2013, 2016 Obeo and others.
* 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
@@ -7,11 +7,13 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.internal.adapterfactory;
import java.util.Set;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
/**
@@ -30,6 +32,13 @@ public interface RankedAdapterFactoryDescriptor extends ComposedAdapterFactory.D
int getRanking();
/**
+ * The context tester of the adapter factory binded to this descriptor. The context tester may be null.
+ *
+ * @return the context tester of the adapter factory binded to this descriptor.
+ */
+ IContextTester getContextTester();
+
+ /**
* Gets a unique id for this descriptor.
*
* @return an unique id.
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptorRegistryImpl.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptorRegistryImpl.java
index 65611f23e..0deb5e556 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptorRegistryImpl.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/RankedAdapterFactoryDescriptorRegistryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Obeo.
+ * Copyright (c) 2013, 2016 Obeo and others.
* 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
@@ -7,18 +7,23 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.internal.adapterfactory;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import org.eclipse.emf.compare.internal.adapterfactory.context.ContextUtil;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory.Descriptor;
@@ -36,6 +41,9 @@ public class RankedAdapterFactoryDescriptorRegistryImpl implements RankedAdapter
/** The store of registered adapter factory descriptors. */
private final Multimap<Collection<?>, RankedAdapterFactoryDescriptor> emfCompareAdapterFactoryRegistry;
+ /** The context for which factories can be registered. */
+ private final Map<Object, Object> context;
+
/**
* Creates an instance.
*
@@ -47,8 +55,28 @@ public class RankedAdapterFactoryDescriptorRegistryImpl implements RankedAdapter
public RankedAdapterFactoryDescriptorRegistryImpl(
ComposedAdapterFactory.Descriptor.Registry delegateRegistry,
Multimap<Collection<?>, RankedAdapterFactoryDescriptor> adapterFactoryRegistryBackingMultimap) {
+ this(delegateRegistry, adapterFactoryRegistryBackingMultimap, Maps.newLinkedHashMap());
+ }
+
+ /**
+ * Creates an instance.
+ *
+ * @param delegateRegistry
+ * <code>null</code> or a registration that should act as the delegate.
+ * @param adapterFactoryRegistryBackingMultimap
+ * Multimap backing all {@link RankedAdapterFactoryDescriptor} registered into EMF Compare.
+ * @param context
+ * context for which factories can be registered. This context cannot be null but may be empty.
+ * @throws NullPointerException
+ * if <code>context</code> is null.
+ */
+ public RankedAdapterFactoryDescriptorRegistryImpl(
+ ComposedAdapterFactory.Descriptor.Registry delegateRegistry,
+ Multimap<Collection<?>, RankedAdapterFactoryDescriptor> adapterFactoryRegistryBackingMultimap,
+ Map<Object, Object> context) {
this.delegateRegistry = delegateRegistry;
this.emfCompareAdapterFactoryRegistry = adapterFactoryRegistryBackingMultimap;
+ this.context = Collections.unmodifiableMap(context);
}
/**
@@ -100,25 +128,25 @@ public class RankedAdapterFactoryDescriptorRegistryImpl implements RankedAdapter
* @return {@link RankedAdapterFactoryDescriptor}
*/
private RankedAdapterFactoryDescriptor getHighestRankedDescriptor(List<String> stringTypes) {
- final RankedAdapterFactoryDescriptor result;
+ RankedAdapterFactoryDescriptor result = null;
Iterator<? extends RankedAdapterFactoryDescriptor> descriptors = emfCompareAdapterFactoryRegistry
.get(stringTypes).iterator();
- if (descriptors.hasNext()) {
- RankedAdapterFactoryDescriptor highestRanking = descriptors.next();
- while (descriptors.hasNext()) {
- RankedAdapterFactoryDescriptor descriptor = descriptors.next();
- if (descriptor.getRanking() > highestRanking.getRanking()) {
- highestRanking = descriptor;
+ while (descriptors.hasNext()) {
+ RankedAdapterFactoryDescriptor descriptor = descriptors.next();
+ if (ContextUtil.apply(descriptor, context)) {
+ boolean firstMatch = result == null;
+ boolean higherRank = result != null && descriptor.getRanking() > result.getRanking();
+ boolean equalRankButContextTester = result != null
+ && descriptor.getRanking() == result.getRanking() && result.getContextTester() == null
+ && descriptor.getContextTester() != null;
+ if (firstMatch || higherRank || equalRankButContextTester) {
+ result = descriptor;
}
}
- result = highestRanking;
- } else {
- result = null;
}
return result;
-
}
/**
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/context/ContextUtil.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/context/ContextUtil.java
new file mode 100644
index 000000000..08a352ef8
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/internal/adapterfactory/context/ContextUtil.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EclipseSource Muenchen GmbH and others.
+ * 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:
+ * Martin Fleck - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.internal.adapterfactory.context;
+
+import static com.google.common.base.Predicates.isNull;
+import static com.google.common.collect.Iterables.all;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
+import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+
+/**
+ * Utility class for evaluating context testers in adapter factory descriptors.
+ *
+ * @author Martin Fleck <mfleck@eclipsesource.com>
+ * @since 4.3
+ */
+public final class ContextUtil {
+
+ /**
+ * Private constructor for utility class.
+ */
+ private ContextUtil() {
+ }
+
+ /**
+ * Returns whether the adapter factory should be applied in the given context.
+ *
+ * @param adapterFactoryDescriptor
+ * the {@link ComposedAdapterFactory.Descriptor} containing the adapter factory and possibly a
+ * context tester
+ * @param context
+ * the context
+ * @return {@code false} if the descriptor's context tester indicates no responsibility for the given
+ * {@code comparison}, {@code true} otherwise.
+ * @see IContextTester#apply(Map)
+ */
+ public static boolean apply(ComposedAdapterFactory.Descriptor adapterFactoryDescriptor,
+ Map<Object, Object> context) {
+ if (!(adapterFactoryDescriptor instanceof RankedAdapterFactoryDescriptor)) {
+ return true;
+ }
+ RankedAdapterFactoryDescriptor rankedDescriptor = (RankedAdapterFactoryDescriptor)adapterFactoryDescriptor;
+ // if we have a context tester, the context must not be null
+ return rankedDescriptor.getContextTester() == null
+ || (!isNullContext(context) && rankedDescriptor.getContextTester().apply(context));
+ }
+
+ /**
+ * Evaluates whether the given context is a null context, i.e., the context itself is null, it has no
+ * entries or all its values are null.
+ *
+ * @param context
+ * the context
+ * @return {@code true} if the context is null, empty or all its values are null, {@code false} otherwise.
+ */
+ public static boolean isNullContext(Map<Object, Object> context) {
+ return context == null || context.isEmpty() || all(context.values(), isNull());
+ }
+}
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 34288e3d8..cefe2265f 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
@@ -8,6 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
* Conor O'Mahony - bug 507465
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.configuration;
@@ -30,6 +31,7 @@ import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.internal.merge.MergeMode;
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.AdapterFactoryChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.impl.CompareEditingDomainChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.impl.ComparisonAndScopeChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.impl.EMFComparatorChange;
@@ -286,7 +288,9 @@ public class EMFCompareConfiguration extends ForwardingCompareConfiguration impl
}
public void setAdapterFactory(AdapterFactory adapterFactory) {
+ AdapterFactory oldValue = getAdapterFactory();
setProperty(ADAPTER_FACTORY, adapterFactory);
+ getEventBus().post(new AdapterFactoryChange(oldValue, adapterFactory));
}
private class PropertyChangeListener implements IPropertyChangeListener {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
index c67530e14..27f878812 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
+ * Copyright (c) 2012, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.table;
@@ -16,10 +17,13 @@ import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import java.util.Map;
import java.util.ResourceBundle;
import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
@@ -77,8 +81,12 @@ public class TableContentMergeViewer extends EMFCompareContentMergeViewer {
*/
protected TableContentMergeViewer(Composite parent, EMFCompareConfiguration config) {
super(SWT.NONE, ResourceBundle.getBundle(BUNDLE_NAME), config);
+
+ Map<Object, Object> context = Maps.newLinkedHashMap();
+ context.put(IContextTester.CTX_COMPARISON, config.getComparison());
+
fAdapterFactory = new ComposedAdapterFactory(
- EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry());
+ EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry(context));
fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
index c95fcfe12..54bc3d8b0 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
@@ -8,6 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
* Stefan Dirix - bug 487595
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.tree;
@@ -20,8 +21,10 @@ import static org.eclipse.emf.compare.utils.EMFComparePredicates.ofKind;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
import java.util.List;
+import java.util.Map;
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -31,6 +34,7 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.tree.provider.TreeContentMergeViewerItemContentProvider;
@@ -114,8 +118,11 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
EMFCompareConfiguration config) {
super(style, bundle, config);
+ Map<Object, Object> context = Maps.newLinkedHashMap();
+ context.put(IContextTester.CTX_COMPARISON, config.getComparison());
+
fAdapterFactory = new ComposedAdapterFactory(
- EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry());
+ EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry(context));
fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
fSyncExpandedState = new AtomicBoolean();
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/EMFComparisonSourceActionHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/EMFComparisonSourceActionHandler.java
index c1edb55f0..ebc350122 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/EMFComparisonSourceActionHandler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/EMFComparisonSourceActionHandler.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.compare.ide.ui.internal.handler;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
import java.text.MessageFormat;
import java.util.Collection;
@@ -71,8 +72,8 @@ public class EMFComparisonSourceActionHandler extends AbstractHandler {
final IEMFComparisonSource[] sources = adaptSelection(selection.toList());
- final AdapterFactory adapterFactory = new ComposedAdapterFactory(
- EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry());
+ final AdapterFactory adapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
+ .createFilteredAdapterFactoryRegistry(Maps.newLinkedHashMap()));
final IEMFComparisonSource leftSource;
final IEMFComparisonSource rightSource;
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 83bf038c6..479dfd951 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
@@ -9,6 +9,7 @@
* Obeo - initial API and implementation
* Stefan Dirix - bug 473985
* Conor O'Mahony - bug 507465
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
@@ -34,6 +35,7 @@ import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.merge.IMerger;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IAdapterFactoryChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.ICompareEditingDomainChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IComparisonAndScopeChange;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
@@ -230,6 +232,16 @@ public class CompareToolBar implements ISelectionChangedListener {
}
@Subscribe
+ public void adapterFactoryChange(IAdapterFactoryChange event) {
+ for (MergeAction mergeAction : mergeActions) {
+ mergeAction.setAdapterFactory(event.getNewValue());
+ }
+ for (MergeAction mergeAction : mergeAllNonConflictingActions) {
+ mergeAction.setAdapterFactory(event.getNewValue());
+ }
+ }
+
+ @Subscribe
public void comparisonAndScopeChange(final IComparisonAndScopeChange event) {
SWTUtil.safeAsyncExec(new Runnable() {
public void run() {
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 9c2a507c4..a13d292fc 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
@@ -11,6 +11,7 @@
* Philip Langer - bug 462884
* Stefan Dirix - bugs 473985 and 474030
* Martin Fleck - bug 497066
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
@@ -27,6 +28,7 @@ import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.eventbus.Subscribe;
@@ -77,6 +79,7 @@ import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.EMFCompare.Builder;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.MatchResource;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
@@ -514,19 +517,31 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
*/
@Override
protected void preHookCreateControlAndViewer() {
- fAdapterFactory = new ComposedAdapterFactory(
- EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry());
- fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec(
- getCompareConfiguration().getStructureMergeViewerFilter()));
- fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
- fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
-
+ fAdapterFactory = initAdapterFactory(getCompareConfiguration().getComparison());
getCompareConfiguration().setAdapterFactory(fAdapterFactory);
inputChangedTask = new CompareInputChangedJob(EMFCompareIDEUIMessages
.getString("EMFCompareStructureMergeViewer.computingModelDifferences")); //$NON-NLS-1$
}
+ /**
+ * Creates a new adapter factory based on the current compare configuration.
+ *
+ * @return adapter factory
+ */
+ protected ComposedAdapterFactory initAdapterFactory(Comparison comparison) {
+ Map<Object, Object> context = Maps.newLinkedHashMap();
+ context.put(IContextTester.CTX_COMPARISON, comparison);
+
+ ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(
+ EMFCompareRCPPlugin.getDefault().createFilteredAdapterFactoryRegistry(context));
+ adapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec(
+ getCompareConfiguration().getStructureMergeViewerFilter()));
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ return adapterFactory;
+ }
+
@Subscribe
public void colorChanged(
@SuppressWarnings("unused") /* necessary for @Subscribe */IColorChangeEvent changeColorEvent) {
@@ -651,6 +666,11 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
return (EMFCompareStructureMergeViewerContentProvider)super.getContentProvider();
}
+ @Override
+ public DelegatingStyledCellLabelProvider getLabelProvider() {
+ return (DelegatingStyledCellLabelProvider)super.getLabelProvider();
+ }
+
private CTabItem createItem(int index, Control control) {
CTabItem item = new CTabItem((CTabFolder)control.getParent(), SWT.NONE, index);
item.setControl(control);
@@ -994,12 +1014,24 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
void compareInputChanged(final IComparisonScope scope, final Comparison comparison) {
if (!getControl().isDisposed()) { // guard against disposal
+ final EMFCompareConfiguration config = getCompareConfiguration();
+
+ // re-initialize adapter factory due to new comparison
+ if (fAdapterFactory != null) {
+ fAdapterFactory.dispose();
+ }
+ fAdapterFactory = initAdapterFactory(comparison);
+
+ // propagate new adapter factory
+ config.setAdapterFactory(fAdapterFactory);
+ getContentProvider().setAdapterFactory(fAdapterFactory);
+ ((EMFCompareStructureMergeViewerLabelProvider)getLabelProvider().getStyledStringProvider())
+ .setAdapterFactory(fAdapterFactory);
+
final TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
treeNode.setData(comparison);
final Object input = fAdapterFactory.adapt(treeNode, ICompareInput.class);
- final EMFCompareConfiguration config = getCompareConfiguration();
-
// this will set to the EMPTY difference group provider, but necessary to avoid NPE while setting
// input.
IDifferenceGroupProvider groupProvider = config.getStructureMergeViewerGrouper().getProvider();
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 692b76635..c19e830ea 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
@@ -8,6 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
* Michael Borkowski - bug 462237
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
@@ -267,6 +268,19 @@ public class MergeAction extends BaseSelectionListenerAction {
}
/**
+ * Set the adapter factory used by this action.
+ *
+ * @param adapterFactory
+ * adapter factory
+ */
+ public final void setAdapterFactory(AdapterFactory adapterFactory) {
+ this.adapterFactory = adapterFactory;
+ if (adapterFactory != null) {
+ contextualizeTooltip();
+ }
+ }
+
+ /**
* @return the leftToRight
*/
protected final boolean isLeftToRight() {
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 f85b4422e..0b47d2508 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 Obeo.
+ * Copyright (c) 2013, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.rcp;
@@ -22,6 +23,7 @@ import static org.eclipse.emf.compare.rcp.internal.preferences.EMFComparePrefere
import com.google.common.base.Predicate;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
@@ -45,6 +47,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChang
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.Comparison;
import org.eclipse.emf.compare.conflict.IConflictDetector;
import org.eclipse.emf.compare.diff.IDiffEngine;
import org.eclipse.emf.compare.equi.IEquiEngine;
@@ -578,21 +581,38 @@ public class EMFCompareRCPPlugin extends Plugin {
*
* @return the the adapter factory descriptor registry to which extension will be registered
* @since 2.3
+ * @deprecated Use {@link #createFilteredAdapterFactoryRegistry(Comparison)} to take the context into
+ * consideration. If no comparison context is available, use an empty context.
*/
+ @Deprecated
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() {
+ return createFilteredAdapterFactoryRegistry(Maps.newLinkedHashMap());
+ }
+
+ /**
+ * Returns a new instance of EMF Compare adapter factory descriptor registry to which extension will be
+ * registered. It filters available adapter factories using preferences.
+ *
+ * @param context
+ * context for the adapter factories. This context cannot be null but may be empty.
+ * @return the adapter factory descriptor registry to which extension will be registered
+ * @since 2.5
+ */
+ public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry(
+ Map<Object, Object> context) {
final List<String> disabledAdapterFactories = EMFComparePreferences
.getDisabledAdapterFacotryDescriptorIds(getEMFComparePreferences());
// Filters disabled adapter factories
Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredBackingMultimap = ImmutableMultimap
.copyOf(Multimaps.filterValues(adapterFactoryRegistryBackingMultimap,
new Predicate<RankedAdapterFactoryDescriptor>() {
-
public boolean apply(RankedAdapterFactoryDescriptor input) {
return !disabledAdapterFactories.contains(input.getId());
}
}));
+
return new RankedAdapterFactoryDescriptorRegistryImpl(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredBackingMultimap);
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredBackingMultimap, context);
}
/**
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/extension/AbstractRegistryEventListener.java b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/extension/AbstractRegistryEventListener.java
index 8cc1b1fda..74136b11f 100644
--- a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/extension/AbstractRegistryEventListener.java
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/extension/AbstractRegistryEventListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
+ * Copyright (c) 2012, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.rcp.extension;
@@ -18,6 +19,7 @@ import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IRegistryEventListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.compare.rcp.internal.EMFCompareRCPMessages;
/**
* Abstract utility class to listen to the {@link IExtensionRegistry}. It provides base implementation to
@@ -185,7 +187,8 @@ public abstract class AbstractRegistryEventListener implements IRegistryEventLis
* the name of the missing attribute.
*/
protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- log(IStatus.ERROR, element, "The required attribute '" + attributeName + "' not defined"); //$NON-NLS-1$ //$NON-NLS-2$
+ log(IStatus.ERROR, element, EMFCompareRCPMessages.getString("missing.extension.attribute", //$NON-NLS-1$
+ attributeName));
}
/**
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/AdapterFactoryDescriptorRegistryListener.java b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/AdapterFactoryDescriptorRegistryListener.java
index bd2136776..d3b090c2c 100644
--- a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/AdapterFactoryDescriptorRegistryListener.java
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/AdapterFactoryDescriptorRegistryListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Obeo.
+ * Copyright (c) 2013, 2016 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.rcp.internal.adapterfactory;
@@ -18,11 +19,14 @@ import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
import org.eclipse.emf.compare.rcp.extension.AbstractRegistryEventListener;
+import org.eclipse.emf.compare.rcp.internal.EMFCompareRCPMessages;
/**
* This listener will allow us to be aware of contribution changes against the emf compare adapter factory
@@ -47,6 +51,9 @@ public class AdapterFactoryDescriptorRegistryListener extends AbstractRegistryEv
/** ATT_RANKING. */
static final String ATT_RANKING = "ranking"; //$NON-NLS-1$
+ /** ATT_CONTEXT. */
+ static final String ATT_CONTEXT = "context"; //$NON-NLS-1$
+
/** The adapter factory descriptor registry against which extension will be registered. */
private final Multimap<Collection<?>, RankedAdapterFactoryDescriptor> adapterFactoryRegistry;
@@ -91,7 +98,9 @@ public class AdapterFactoryDescriptorRegistryListener extends AbstractRegistryEv
try {
Integer.parseInt(ordinalStr);
} catch (NumberFormatException nfe) {
- log(IStatus.ERROR, element, "Attribute ranking is malformed, should be an integer."); //$NON-NLS-1$
+ log(IStatus.ERROR, element,
+ EMFCompareRCPMessages.getString("malformed.extension.attribute", //$NON-NLS-1$
+ ATT_RANKING));
return false;
}
valid = true;
@@ -121,7 +130,18 @@ public class AdapterFactoryDescriptorRegistryListener extends AbstractRegistryEv
@Override
protected boolean addedValid(IConfigurationElement element) {
int ranking = Integer.parseInt(element.getAttribute(ATT_RANKING));
- RankedAdapterFactoryDescriptor descriptor = new RankedAdapterFactoryDescriptorImpl(element, ranking);
+ IContextTester contextTester = null;
+ if (element.getAttribute(ATT_CONTEXT) != null) {
+ try {
+ contextTester = (IContextTester)element.createExecutableExtension(ATT_CONTEXT);
+ } catch (CoreException e) {
+ log(IStatus.WARNING, element,
+ EMFCompareRCPMessages.getString("malformed.extension.executable", //$NON-NLS-1$
+ ATT_CONTEXT, element.getAttribute(ATT_CONTEXT)));
+ }
+ }
+ RankedAdapterFactoryDescriptor descriptor = new RankedAdapterFactoryDescriptorImpl(element, ranking,
+ contextTester);
String supportedTypes = element.getAttribute(ATT_SUPPORTED_TYPES);
for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer
diff --git a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/RankedAdapterFactoryDescriptorImpl.java b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/RankedAdapterFactoryDescriptorImpl.java
index 7beaf861c..333e5de45 100644
--- a/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/RankedAdapterFactoryDescriptorImpl.java
+++ b/plugins/org.eclipse.emf.compare.rcp/src/org/eclipse/emf/compare/rcp/internal/adapterfactory/RankedAdapterFactoryDescriptorImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Obeo.
+ * Copyright (c) 2013, 2016 Obeo and others.
* 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
@@ -7,11 +7,13 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.rcp.internal.adapterfactory;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
import org.eclipse.emf.compare.rcp.extension.PluginClassDescriptor;
@@ -34,6 +36,9 @@ public class RankedAdapterFactoryDescriptorImpl extends PluginClassDescriptor<Ad
/** Ranking of this adapter factory. */
private final int ranking;
+ /** ContextTester of this adapter factory. */
+ private final IContextTester contextTester;
+
/** Holds the id of this descriptor. */
private final String id;
@@ -46,8 +51,24 @@ public class RankedAdapterFactoryDescriptorImpl extends PluginClassDescriptor<Ad
* The ranking of the adapter factory.
*/
public RankedAdapterFactoryDescriptorImpl(IConfigurationElement element, int ranking) {
+ this(element, ranking, null);
+ }
+
+ /**
+ * Creates a descriptor corresponding to the information of the given <em>element</em>.
+ *
+ * @param element
+ * Configuration element from which to create this descriptor.
+ * @param ranking
+ * The ranking of the adapter factory.
+ * @param contextTester
+ * The context tester of the adapter factory.
+ */
+ public RankedAdapterFactoryDescriptorImpl(IConfigurationElement element, int ranking,
+ IContextTester contextTester) {
super(element, AdapterFactoryDescriptorRegistryListener.ATT_CLASS);
this.ranking = ranking;
+ this.contextTester = contextTester;
this.id = element.getAttribute(AdapterFactoryDescriptorRegistryListener.ATT_CLASS);
}
@@ -72,6 +93,15 @@ public class RankedAdapterFactoryDescriptorImpl extends PluginClassDescriptor<Ad
/**
* {@inheritDoc}
*
+ * @see org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor#getContextTester()
+ */
+ public IContextTester getContextTester() {
+ return contextTester;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see RankedAdapterFactoryDescriptor#getId()
*/
public String getId() {
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 c17e9c04e..679a6e30b 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, 2015 Obeo.
+# Copyright (c) 2011, 2016 Obeo and others.
# 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
@@ -7,9 +7,12 @@
#
# Contributors:
# Obeo - initial API and implementation
+# Martin Fleck - bug 483798
################################################################################
## note : apostrophes need to be doubled in these messages or they'll be ignored
malformed.extension.attribute = Attribute {0} is malformed, should be an integer.
+malformed.extension.executable = Attribute {0} is malformed, unable to create a new instance for "{1}".
+missing.extension.attribute = The required attribute "{0}" is not defined.
duplicate.merger = The merger {0} is registered twice.
duplicate.extension = The extension {0} is registered twice
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/adapterfactory/EMFCompareAdapterFactoryTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/adapterfactory/EMFCompareAdapterFactoryTest.java
index 95718cb3f..7c5179bcc 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/adapterfactory/EMFCompareAdapterFactoryTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/adapterfactory/EMFCompareAdapterFactoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Obeo.
+ * Copyright (c) 2013, 2016 Obeo and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Martin Fleck - bug 483798
*******************************************************************************/
package org.eclipse.emf.compare.tests.adapterfactory;
@@ -24,6 +25,7 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.CompareFactory;
import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl;
import org.eclipse.emf.compare.provider.IItemStyledLabelProvider;
@@ -98,6 +100,10 @@ public class EMFCompareAdapterFactoryTest {
return ranking;
}
+ public IContextTester getContextTester() {
+ return null;
+ }
+
public String getId() {
return this.adapterFactory.getClass().getName();
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/registry/RankedAdapterFactoryRegistryTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/registry/RankedAdapterFactoryRegistryTest.java
new file mode 100644
index 000000000..c5d961cc2
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/registry/RankedAdapterFactoryRegistryTest.java
@@ -0,0 +1,340 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EclipseSource Muenchen GmbH and others.
+ * 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:
+ * Martin Fleck - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.tests.registry;
+
+import static org.junit.Assert.assertEquals;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.CompareFactory;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.adapterfactory.context.AbstractContextTester;
+import org.eclipse.emf.compare.adapterfactory.context.IContextTester;
+import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptor;
+import org.eclipse.emf.compare.internal.adapterfactory.RankedAdapterFactoryDescriptorRegistryImpl;
+import org.eclipse.emf.compare.provider.IItemStyledLabelProvider;
+import org.eclipse.emf.compare.provider.spec.CompareItemProviderAdapterFactorySpec;
+import org.eclipse.emf.compare.provider.spec.ComparisonItemProviderSpec;
+import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString.IComposedStyledString;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.junit.Test;
+
+@SuppressWarnings({"restriction", "nls" })
+public class RankedAdapterFactoryRegistryTest {
+
+ /** registry map */
+ private Multimap<Collection<?>, RankedAdapterFactoryDescriptor> registry;
+
+ /** ranked registry */
+ private RankedAdapterFactoryDescriptor.Registry rankedRegistry;
+
+ private void setUpAdapterFactoryRegistry(Comparison comparison) {
+ registry = ArrayListMultimap.create();
+ HashMap<Object, Object> context = Maps.newLinkedHashMap();
+ context.put(IContextTester.CTX_COMPARISON, comparison);
+ rankedRegistry = new RankedAdapterFactoryDescriptorRegistryImpl(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE, registry, context);
+ }
+
+ private Comparison createNullComparison() {
+ return null;
+ }
+
+ private Comparison createComparison() {
+ final Comparison comparison = CompareFactory.eINSTANCE.createComparison();
+ comparison.setThreeWay(true);
+ return comparison;
+ }
+
+ private IContextTester createMatchingContextTester() {
+ return new AbstractContextTester() {
+ public boolean apply(Map<Object, Object> context) {
+ Comparison comparison = getComparison(context);
+ return comparison != null && comparison.isThreeWay();
+ }
+ };
+ }
+
+ private IContextTester createNonMatchingContextTester() {
+ return new AbstractContextTester() {
+ public boolean apply(Map<Object, Object> context) {
+ Comparison comparison = getComparison(context);
+ return comparison == null || !comparison.isThreeWay();
+ }
+ };
+ }
+
+ /**
+ * Tests that the registry returns the adapter factory with the highest rank when no context tester is
+ * present.
+ */
+ @Test
+ public void testNoContextTesterRankConsidered() {
+ final Comparison comparison = CompareFactory.eINSTANCE.createComparison();
+ setUpAdapterFactoryRegistry(createNullComparison());
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-NoContextTester", 50, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-NoContextTester", 70, null));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank70-NoContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that adapter factories with matching and non-matching context testers are ignored if no context
+ * is provided.
+ */
+ @Test
+ public void testNoContextContextTesterIgnored() {
+ final Comparison comparison = CompareFactory.eINSTANCE.createComparison();
+ setUpAdapterFactoryRegistry(createNullComparison());
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-MatchingContextTester", 50,
+ createMatchingContextTester()));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-NonMatchingContextTester", 70,
+ createNonMatchingContextTester()));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank20-NoContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that the registry returns the adapter factory with a lower rank if the context tester for a
+ * higher-ranking factory does not match.
+ */
+ @Test
+ public void testNonMatchingContextTesterSkipped() {
+ final Comparison comparison = createComparison();
+ setUpAdapterFactoryRegistry(comparison);
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-NoContextTester", 50, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-NonMatchingContextTester", 70,
+ createNonMatchingContextTester()));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank50-NoContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that the registry returns the adapter factory with the highest rank if the context tester for the
+ * highest-ranking factory does match.
+ */
+ @Test
+ public void testMatchingContextTesterConsidered() {
+ final Comparison comparison = createComparison();
+ setUpAdapterFactoryRegistry(comparison);
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-NoContextTester", 50, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-MatchingContextTester", 70,
+ createMatchingContextTester()));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank70-MatchingContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that the registry returns the adapter factory with the highest rank and context tester if
+ * multiple factories with context testers exist.
+ */
+ @Test
+ public void testContextTesterRanksConsidered() {
+ final Comparison comparison = createComparison();
+ setUpAdapterFactoryRegistry(comparison);
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-MatchingContextTester", 50,
+ createMatchingContextTester()));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-MatchingContextTester", 70,
+ createMatchingContextTester()));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank70-MatchingContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that the registry favors higher rank over matching context tester.
+ */
+ @Test
+ public void testHigherRankBeatsContextTester() {
+ final Comparison comparison = createComparison();
+ setUpAdapterFactoryRegistry(comparison);
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank50-MatchingContextTester", 50,
+ createMatchingContextTester()));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-NoContextTester", 70, null));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank70-NoContextTester", styledText.getString());
+ }
+
+ /**
+ * Tests that the registry favors a factory with context tester when factories have an equal rank.
+ */
+ @Test
+ public void testEqualRankContextTesterPreferred() {
+ final Comparison comparison = createComparison();
+ setUpAdapterFactoryRegistry(comparison);
+
+ final Collection<String> key = new ArrayList<String>();
+ key.add("http://www.eclipse.org/emf/compare");
+ key.add("org.eclipse.emf.compare.provider.IItemStyledLabelProvider");
+
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank20-NoContextTester", 20, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-NoContextTester", 70, null));
+ registry.put(key, new TestAdapterFactoryDescriptor("Rank70-MatchingContextTester", 70,
+ createMatchingContextTester()));
+
+ final AdapterFactory fAdapterFactory = new ComposedAdapterFactory(rankedRegistry);
+ Adapter adapter = fAdapterFactory.adapt(comparison, IItemStyledLabelProvider.class);
+ IComposedStyledString styledText = ((IItemStyledLabelProvider)adapter).getStyledText(comparison);
+
+ assertEquals("Rank70-MatchingContextTester", styledText.getString());
+ }
+
+ /**
+ * Descriptor used for test ranking.
+ */
+ public class TestAdapterFactoryDescriptor implements RankedAdapterFactoryDescriptor {
+
+ AdapterFactory adapterFactory;
+
+ int ranking;
+
+ IContextTester contextTester;
+
+ public TestAdapterFactoryDescriptor(String text, int ranking, IContextTester contextTester) {
+ this.adapterFactory = new TestCompareItemProviderAdapterFactorySpec(text);
+ this.ranking = ranking;
+ this.contextTester = contextTester;
+ }
+
+ public AdapterFactory createAdapterFactory() {
+ return adapterFactory;
+ }
+
+ public int getRanking() {
+ return ranking;
+ }
+
+ public IContextTester getContextTester() {
+ return contextTester;
+ }
+
+ public String getId() {
+ return this.adapterFactory.getClass().getName();
+ }
+
+ public String getLabel() {
+ return "";
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public boolean isOptional() {
+ return false;
+ }
+
+ }
+
+ /**
+ * Specialized CompareItemProviderAdapterFactorySpec used for testing.
+ */
+ public class TestCompareItemProviderAdapterFactorySpec extends CompareItemProviderAdapterFactorySpec {
+
+ private String text;
+
+ public TestCompareItemProviderAdapterFactorySpec(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public Adapter createComparisonAdapter() {
+ return new TestComparisonItemProviderSpec(this, text);
+ }
+ }
+
+ /**
+ * Specialized ComparisonItemProviderSpec used for testing.
+ */
+ public class TestComparisonItemProviderSpec extends ComparisonItemProviderSpec {
+
+ private String text;
+
+ public TestComparisonItemProviderSpec(AdapterFactory adapterFactory, String text) {
+ super(adapterFactory);
+ this.text = text;
+ }
+
+ @Override
+ public IComposedStyledString getStyledText(Object object) {
+ return new ComposedStyledString(text);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
index 4a1003a90..8e093a4b3 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/suite/AllTests.java
@@ -58,6 +58,7 @@ import org.eclipse.emf.compare.tests.monitor.MonitorCancelTest;
import org.eclipse.emf.compare.tests.nodes.NodesPackage;
import org.eclipse.emf.compare.tests.nodes.util.NodesResourceFactoryImpl;
import org.eclipse.emf.compare.tests.postprocess.PostProcessorTest;
+import org.eclipse.emf.compare.tests.registry.RankedAdapterFactoryRegistryTest;
import org.eclipse.emf.compare.tests.req.ReqComputingTest;
import org.eclipse.emf.compare.tests.scope.ComparisonScopeAdapterTest;
import org.eclipse.emf.compare.tests.scope.DefaultComparisonScopeTest;
@@ -97,7 +98,7 @@ import junit.textui.TestRunner;
MultiLineAttributeMergeTest.class, MonitorCancelTest.class, IdentifierEObjectMatcherTest.class,
MatchUtilFeatureContainsTest.class, RefineMergeTest.class, Bug484557ConflictTest.class,
Bug485266_MoveDeleteConflict_Test.class, ResourceAttachmentChangeBug492261.class,
- ComparisonScopeAdapterTest.class, EMFComparePredicatesTest.class, })
+ ComparisonScopeAdapterTest.class, EMFComparePredicatesTest.class, RankedAdapterFactoryRegistryTest.class })
public class AllTests {
/**
* Standalone launcher for all of compare's tests.

Back to the top