Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-12-03 11:10:18 -0500
committerChristian W. Damus2016-12-03 11:22:22 -0500
commitd166f6032ea983c2f4b639dd6e728d26c7afd712 (patch)
treed41d572de6b9a1a7286e7ab782a09f51a4937e65 /plugins/infra/services
parent4cc473a354549001b380ac6fb963d16f05ffa953 (diff)
downloadorg.eclipse.papyrus-d166f6032ea983c2f4b639dd6e728d26c7afd712.tar.gz
org.eclipse.papyrus-d166f6032ea983c2f4b639dd6e728d26c7afd712.tar.xz
org.eclipse.papyrus-d166f6032ea983c2f4b639dd6e728d26c7afd712.zip
Bug 508629: [Label Provider Service] Label providers do not notify
Fix gaps in the propagation of label updates from EMF item provider adapters through label-providers that delegate to them and the label-provider service that delegates to those, in turn. Add JUnit tests covering various affected label providers, including a new tests plug-in for the Properties UI in the Infra layer. https://bugs.eclipse.org/bugs/show_bug.cgi?id=508629 (🍒-picked from streams/2.0-maintenance) Change-Id: I2e0301db72064fe6899c4d92252d93d9051943f0
Diffstat (limited to 'plugins/infra/services')
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/pom.xml2
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java24
3 files changed, 18 insertions, 10 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
index 7413d92567b..bc36c706660 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.107.0,4.0.0)";visibility:=reex
org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.1.qualifier
Bundle-Localization: plugin
Bundle-Name: LabelProvider service
Bundle-Activator: org.eclipse.papyrus.infra.services.labelprovider.Activator
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/pom.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/pom.xml
index d36e9be6d87..e2adf9ca84d 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/pom.xml
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.services.labelprovider</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
index 673412d45d0..38859883936 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider/src/org/eclipse/papyrus/infra/services/labelprovider/service/ExtensibleLabelProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2013 CEA LIST.
+ * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,15 +10,15 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Workspace-independent model validation view (CDO)
* Mickael ADAM (ALL4TEC) - Bug 500219 - implementation of IStyledLabelProvider
+ * Christian W. Damus - bug 508629
*****************************************************************************/
package org.eclipse.papyrus.infra.services.labelprovider.service;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.IColorProvider;
@@ -28,6 +28,7 @@ import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.papyrus.infra.services.labelprovider.Activator;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -43,14 +44,14 @@ import org.eclipse.swt.graphics.Image;
*/
public class ExtensibleLabelProvider implements ILabelProvider, IQualifierLabelProvider, ILabelProviderListener, IColorProvider, IFontProvider, IStyledLabelProvider {
- private final Set<ILabelProviderListener> listeners;
+ private final CopyOnWriteArrayList<ILabelProviderListener> listeners;
private final SortedMap<Integer, List<IFilteredLabelProvider>> providers;
private final ILabelProvider defaultProvider;
public ExtensibleLabelProvider() {
- listeners = new LinkedHashSet<ILabelProviderListener>();
+ listeners = new CopyOnWriteArrayList<ILabelProviderListener>();
providers = new TreeMap<Integer, List<IFilteredLabelProvider>>();
defaultProvider = new LabelProvider();
@@ -58,7 +59,7 @@ public class ExtensibleLabelProvider implements ILabelProvider, IQualifierLabelP
@Override
public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
+ listeners.addIfAbsent(listener);
}
@Override
@@ -187,8 +188,15 @@ public class ExtensibleLabelProvider implements ILabelProvider, IQualifierLabelP
*/
@Override
public void labelProviderChanged(LabelProviderChangedEvent event) {
- for (ILabelProviderListener listener : listeners) {
- listener.labelProviderChanged(event);
+ if (!listeners.isEmpty()) {
+ LabelProviderChangedEvent myEvent = new LabelProviderChangedEvent(this, event.getElements());
+ for (ILabelProviderListener listener : listeners) {
+ try {
+ listener.labelProviderChanged(myEvent);
+ } catch (Exception e) {
+ Activator.log.error("Uncaught exception in label provider listener", e); //$NON-NLS-1$
+ }
+ }
}
}

Back to the top