aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Still2013-09-18 05:20:32 (EDT)
committerHendrik Still2013-09-18 05:22:44 (EDT)
commit4821302fabf4f316b32d55acd083484863a9ce3f (patch)
tree5e14799531d2777c721c4a409f68f29fbee07586
parent010d666b30813f3485b4098eb0466967903214a3 (diff)
downloadeclipse.platform.ui-4821302fabf4f316b32d55acd083484863a9ce3f.zip
eclipse.platform.ui-4821302fabf4f316b32d55acd083484863a9ce3f.tar.gz
eclipse.platform.ui-4821302fabf4f316b32d55acd083484863a9ce3f.tar.bz2
Bug 416339 - [JFace] The used input types for the generic JFace API arerefs/changes/39/16539/1
too restrictive! [JFace] added generics to the ArrayContetProvider Changed synchronized block for ArrayContentProvider.getInstance() to provide a threadsafe access Change-Id: I7fe2cc110cac548e59bdbb987361efa2867d3ce8 Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java
index ebee2c2..73439a1 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java
@@ -97,17 +97,17 @@ public class ArrayContentProvider<E> implements IStructuredContentProvider<E,Obj
*/
public static <E> ArrayContentProvider<E> getInstance(Class<E> componentType) {
- @SuppressWarnings("unchecked")
- ArrayContentProvider<E> arrayContentProvider = (ArrayContentProvider<E>) instanceMap.get(componentType);
- if (arrayContentProvider == null) {
- synchronized (ArrayContentProvider.class) {
+ synchronized (instanceMap) {
+ @SuppressWarnings("unchecked")
+ ArrayContentProvider<E> arrayContentProvider = (ArrayContentProvider<E>) instanceMap
+ .get(componentType);
+ if (arrayContentProvider == null) {
arrayContentProvider = new ArrayContentProvider<E>(
componentType);
instanceMap.put(componentType, arrayContentProvider);
}
+ return arrayContentProvider;
}
-
- return arrayContentProvider;
}
/**
* Returns the elements in the input, which must be either an array or a