Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2016-10-21 08:52:15 -0400
committerAxel Richard2016-10-24 09:23:50 -0400
commite23418ba774fcdfbf97e13edc7e9bf4119b17231 (patch)
treefa804dc8588ec647dc5de44a0f8db12d60079717
parent95ea7167697dd565e3ca2e8c4bc7d7078bd348c7 (diff)
downloadorg.eclipse.emf.compare-e23418ba774fcdfbf97e13edc7e9bf4119b17231.tar.gz
org.eclipse.emf.compare-e23418ba774fcdfbf97e13edc7e9bf4119b17231.tar.xz
org.eclipse.emf.compare-e23418ba774fcdfbf97e13edc7e9bf4119b17231.zip
[506344] Multiple TooltipProvider instantiated for each difference3.3.0M3
Check for existing adapter before adapt to ITooltipLabelProvider in MergeAction#contextualizeTooltip. Bug: 506344 Change-Id: I884c904d65b5493b5ac9e2290d49f61cbf80a0c1 Signed-off-by: Axel Richard <axel.richard@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AbstractTooltipProvider.java18
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java5
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/FeatureMapChangeTooltipProvider.java5
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ReferenceChangeTooltipProvider.java3
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceAttachmentChangeTooltipProvider.java5
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceLocationChangeTooltipProvider.java5
6 files changed, 25 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AbstractTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AbstractTooltipProvider.java
index ce0240153..ba8111d91 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AbstractTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AbstractTooltipProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo and others.
+ * Copyright (c) 2015, 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
@@ -20,6 +20,7 @@ import org.eclipse.emf.compare.ResourceAttachmentChange;
import org.eclipse.emf.compare.ResourceLocationChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
import org.eclipse.emf.compare.provider.ISemanticObjectLabelProvider;
+import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.compare.utils.ReferenceUtil;
import org.eclipse.emf.ecore.EObject;
@@ -34,7 +35,7 @@ import org.eclipse.emf.edit.provider.IItemLabelProvider;
* The parametric type of the class
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public abstract class AbstractTooltipProvider<T extends Diff> extends AdapterImpl {
+public abstract class AbstractTooltipProvider<T extends Diff> extends AdapterImpl implements ITooltipLabelProvider {
/**
* The line separator used to compute tooltips.
@@ -52,6 +53,19 @@ public abstract class AbstractTooltipProvider<T extends Diff> extends AdapterImp
protected IItemLabelProvider labelProvider;
/**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.notify.impl.AdapterImpl#isAdapterForType(Object)
+ */
+ @Override
+ public boolean isAdapterForType(Object type) {
+ if (type == ITooltipLabelProvider.class) {
+ return true;
+ }
+ return super.isAdapterForType(type);
+ }
+
+ /**
* Create the final tooltip for an accepted change which lead to a modification of the left side.
*
* @param value
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
index b3cf69b7e..e7b8d518e 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo.
+ * Copyright (c) 2015, 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
@@ -15,7 +15,6 @@ import static org.eclipse.emf.compare.utils.ReferenceUtil.safeEGet;
import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
@@ -26,7 +25,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
*
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public class AttributeChangeTooltipProvider extends AbstractTooltipProvider<AttributeChange> implements ITooltipLabelProvider {
+public class AttributeChangeTooltipProvider extends AbstractTooltipProvider<AttributeChange> {
/**
* The constructor.
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/FeatureMapChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/FeatureMapChangeTooltipProvider.java
index f2a7ac697..5015f93ce 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/FeatureMapChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/FeatureMapChangeTooltipProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo.
+ * Copyright (c) 2015, 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
@@ -12,7 +12,6 @@ package org.eclipse.emf.compare.tooltip;
import org.eclipse.emf.compare.FeatureMapChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
@@ -21,7 +20,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
*
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public class FeatureMapChangeTooltipProvider extends AbstractTooltipProvider<FeatureMapChange> implements ITooltipLabelProvider {
+public class FeatureMapChangeTooltipProvider extends AbstractTooltipProvider<FeatureMapChange> {
/**
* The constructor.
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ReferenceChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ReferenceChangeTooltipProvider.java
index 576efc6a3..3305473b5 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ReferenceChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ReferenceChangeTooltipProvider.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.compare.utils.ReferenceUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
@@ -27,7 +26,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
*
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public class ReferenceChangeTooltipProvider extends AbstractTooltipProvider<ReferenceChange> implements ITooltipLabelProvider {
+public class ReferenceChangeTooltipProvider extends AbstractTooltipProvider<ReferenceChange> {
/**
* The constructor.
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceAttachmentChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceAttachmentChangeTooltipProvider.java
index 08fdf7bec..4510b1669 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceAttachmentChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceAttachmentChangeTooltipProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo.
+ * Copyright (c) 2015, 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
@@ -15,7 +15,6 @@ import static org.eclipse.emf.compare.internal.EMFCompareEditMessages.getString;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.ResourceAttachmentChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
@@ -26,7 +25,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
*
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public class ResourceAttachmentChangeTooltipProvider extends AbstractTooltipProvider<ResourceAttachmentChange> implements ITooltipLabelProvider {
+public class ResourceAttachmentChangeTooltipProvider extends AbstractTooltipProvider<ResourceAttachmentChange> {
/**
* The constructor.
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceLocationChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceLocationChangeTooltipProvider.java
index 09f7056cf..fd3a09971 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceLocationChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/ResourceLocationChangeTooltipProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Obeo.
+ * Copyright (c) 2015, 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
@@ -13,7 +13,6 @@ package org.eclipse.emf.compare.tooltip;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.ResourceLocationChange;
import org.eclipse.emf.compare.internal.merge.MergeMode;
-import org.eclipse.emf.compare.provider.ITooltipLabelProvider;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
@@ -22,7 +21,7 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
*
* @author <a href="mailto:mathieu.cartaud@obeo.fr">Mathieu Cartaud</a>
*/
-public class ResourceLocationChangeTooltipProvider extends AbstractTooltipProvider<ResourceLocationChange> implements ITooltipLabelProvider {
+public class ResourceLocationChangeTooltipProvider extends AbstractTooltipProvider<ResourceLocationChange> {
/**
* The constructor.

Back to the top