summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHendrik Still2013-07-25 10:04:29 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-07-25 16:13:08 (EDT)
commit71da37a15ed20cfb2e6d861b48924bb2b2167c07 (patch)
tree8f9f6da4a3de0e07d0098f2569e5bf26228918fd
parent24fd383787a916dcac8d0110e9a3b035877ad29e (diff)
downloadeclipse.platform.ui-71da37a15ed20cfb2e6d861b48924bb2b2167c07.zip
eclipse.platform.ui-71da37a15ed20cfb2e6d861b48924bb2b2167c07.tar.gz
eclipse.platform.ui-71da37a15ed20cfb2e6d861b48924bb2b2167c07.tar.bz2
Bug 413686 - Fix compiler warnings in org.eclipse.jface.resource causedrefs/changes/66/14866/2
by moving JFace to Java 1.5 Change-Id: I25f82c0135c51842c1f4290863e84dfe86ccc137 Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/AbstractResourceManager.java20
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java16
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java4
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java28
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java12
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java8
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceManager.java6
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceRegistry.java2
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java10
10 files changed, 54 insertions, 54 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/AbstractResourceManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/AbstractResourceManager.java
index 33be579..704160b 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/AbstractResourceManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/AbstractResourceManager.java
@@ -13,7 +13,7 @@ package org.eclipse.jface.resource;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
+import java.util.Map.Entry;
/**
* Abstract implementation of ResourceManager. Maintains reference counts for all previously
@@ -28,7 +28,7 @@ abstract class AbstractResourceManager extends ResourceManager {
/**
* Map of ResourceDescriptor onto RefCount. (null when empty)
*/
- private HashMap map = null;
+ private HashMap<DeviceResourceDescriptor, RefCount> map = null;
/**
* Holds a reference count for a previously-allocated resource
@@ -73,11 +73,11 @@ abstract class AbstractResourceManager extends ResourceManager {
// Lazily allocate the map
if (map == null) {
- map = new HashMap();
+ map = new HashMap<DeviceResourceDescriptor, RefCount>();
}
// Get the current reference count
- RefCount count = (RefCount)map.get(descriptor);
+ RefCount count = map.get(descriptor);
if (count != null) {
// If this resource already exists, increment the reference count and return
// the existing resource.
@@ -105,7 +105,7 @@ abstract class AbstractResourceManager extends ResourceManager {
}
// Find the existing resource
- RefCount count = (RefCount)map.get(descriptor);
+ RefCount count = map.get(descriptor);
if (count != null) {
// If the resource exists, decrement the reference count.
count.count--;
@@ -136,13 +136,13 @@ abstract class AbstractResourceManager extends ResourceManager {
return;
}
- Collection entries = map.entrySet();
+ Collection<Entry<DeviceResourceDescriptor, RefCount>> entries = map.entrySet();
- for (Iterator iter = entries.iterator(); iter.hasNext();) {
- Map.Entry next = (Map.Entry) iter.next();
+ for (Iterator<Entry<DeviceResourceDescriptor, RefCount>> iter = entries.iterator(); iter.hasNext();) {
+ Entry<DeviceResourceDescriptor, RefCount> next = iter.next();
Object key = next.getKey();
- RefCount val = (RefCount)next.getValue();
+ RefCount val = next.getValue();
deallocate(val.resource, (DeviceResourceDescriptor)key);
}
@@ -158,7 +158,7 @@ abstract class AbstractResourceManager extends ResourceManager {
if (map == null) {
return null;
}
- RefCount refCount = (RefCount)map.get(descriptor);
+ RefCount refCount = map.get(descriptor);
if (refCount == null)
return null;
return refCount.resource;
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
index 2c2da4d..0880a13 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java
@@ -62,19 +62,19 @@ public class ColorRegistry extends ResourceRegistry {
* Collection of <code>Color</code> that are now stale to be disposed when
* it is safe to do so (i.e. on shutdown).
*/
- private List staleColors = new ArrayList();
+ private List<Color> staleColors = new ArrayList<Color>();
/**
* Table of known colors, keyed by symbolic color name (key type: <code>String</code>,
* value type: <code>org.eclipse.swt.graphics.Color</code>.
*/
- private Map stringToColor = new HashMap(7);
+ private Map<String, Color> stringToColor = new HashMap<String, Color>(7);
/**
* Table of known color data, keyed by symbolic color name (key type:
* <code>String</code>, value type: <code>org.eclipse.swt.graphics.RGB</code>).
*/
- private Map stringToRGB = new HashMap(7);
+ private Map<String, RGB> stringToRGB = new HashMap<String, RGB>(7);
/**
* Runnable that cleans up the manager on disposal of the display.
@@ -151,7 +151,7 @@ public class ColorRegistry extends ResourceRegistry {
*
* @param iterator over <code>Collection</code> of <code>Color</code>
*/
- private void disposeColors(Iterator iterator) {
+ private void disposeColors(Iterator<Color> iterator) {
while (iterator.hasNext()) {
Object next = iterator.next();
((Color) next).dispose();
@@ -191,7 +191,7 @@ public class ColorRegistry extends ResourceRegistry {
* @see org.eclipse.jface.resource.ResourceRegistry#getKeySet()
*/
@Override
- public Set getKeySet() {
+ public Set<String> getKeySet() {
return Collections.unmodifiableSet(stringToRGB.keySet());
}
@@ -204,7 +204,7 @@ public class ColorRegistry extends ResourceRegistry {
*/
public RGB getRGB(String symbolicName) {
Assert.isNotNull(symbolicName);
- return (RGB) stringToRGB.get(symbolicName);
+ return stringToRGB.get(symbolicName);
}
/**
@@ -307,12 +307,12 @@ public class ColorRegistry extends ResourceRegistry {
Assert.isNotNull(symbolicName);
Assert.isNotNull(colorData);
- RGB existing = (RGB) stringToRGB.get(symbolicName);
+ RGB existing = stringToRGB.get(symbolicName);
if (colorData.equals(existing)) {
return;
}
- Color oldColor = (Color) stringToColor.remove(symbolicName);
+ Color oldColor = stringToColor.remove(symbolicName);
stringToRGB.put(symbolicName, colorData);
if (update) {
fireMappingChanged(symbolicName, existing, colorData);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
index 8e3796d..47731e7 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
@@ -36,7 +36,7 @@ class FileImageDescriptor extends ImageDescriptor {
* The class whose resource directory contain the file, or <code>null</code>
* if none.
*/
- private Class location;
+ private Class<?> location;
/**
* The name of the file.
@@ -57,7 +57,7 @@ class FileImageDescriptor extends ImageDescriptor {
* @param filename
* the name of the file
*/
- FileImageDescriptor(Class clazz, String filename) {
+ FileImageDescriptor(Class<?> clazz, String filename) {
this.location = clazz;
this.name = filename;
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
index 52a1778..d41652d 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
@@ -181,21 +181,21 @@ public class FontRegistry extends ResourceRegistry {
* (key type: <code>String</code>,
* value type: <code>FontRecord</code>.
*/
- private Map stringToFontRecord = new HashMap(7);
+ private Map<String, FontRecord> stringToFontRecord = new HashMap<String, FontRecord>(7);
/**
* Table of known font data, keyed by symbolic font name
* (key type: <code>String</code>,
* value type: <code>org.eclipse.swt.graphics.FontData[]</code>).
*/
- private Map stringToFontData = new HashMap(7);
+ private Map<String, FontData[]> stringToFontData = new HashMap<String, FontData[]>(7);
/**
* Collection of Fonts that are now stale to be disposed
* when it is safe to do so (i.e. on shutdown).
* @see List
*/
- private List staleFonts = new ArrayList();
+ private List<Font> staleFonts = new ArrayList<Font>();
/**
* Runnable that cleans up the manager on disposal of the display.
@@ -449,7 +449,7 @@ public class FontRegistry extends ResourceRegistry {
* @since 3.1
*/
public FontData [] filterData(FontData [] fonts, Display display) {
- ArrayList good = new ArrayList(fonts.length);
+ ArrayList<FontData> good = new ArrayList<FontData>(fonts.length);
for (int i = 0; i < fonts.length; i++) {
FontData fd = fonts[i];
@@ -478,7 +478,7 @@ public class FontRegistry extends ResourceRegistry {
return null;
}
- return (FontData[]) good.toArray(new FontData[good.size()]);
+ return good.toArray(new FontData[good.size()]);
}
@@ -556,7 +556,7 @@ public class FontRegistry extends ResourceRegistry {
*/
private FontRecord defaultFontRecord() {
- FontRecord record = (FontRecord) stringToFontRecord
+ FontRecord record = stringToFontRecord
.get(JFaceResources.DEFAULT_FONT);
if (record == null) {
Font defaultFont = calculateDefaultFont();
@@ -693,7 +693,7 @@ public class FontRegistry extends ResourceRegistry {
* @see org.eclipse.jface.resource.ResourceRegistry#getKeySet()
*/
@Override
- public Set getKeySet() {
+ public Set<String> getKeySet() {
return Collections.unmodifiableSet(stringToFontData.keySet());
}
@@ -711,7 +711,7 @@ public class FontRegistry extends ResourceRegistry {
@Override
protected void clearCaches() {
- Iterator iterator = stringToFontRecord.values().iterator();
+ Iterator<FontRecord> iterator = stringToFontRecord.values().iterator();
while (iterator.hasNext()) {
Object next = iterator.next();
((FontRecord) next).dispose();
@@ -728,7 +728,7 @@ public class FontRegistry extends ResourceRegistry {
* Dispose of all of the fonts in this iterator.
* @param iterator over Collection of Font
*/
- private void disposeFonts(Iterator iterator) {
+ private void disposeFonts(Iterator<Font> iterator) {
while (iterator.hasNext()) {
Object next = iterator.next();
((Font) next).dispose();
@@ -808,12 +808,12 @@ public class FontRegistry extends ResourceRegistry {
Assert.isNotNull(symbolicName);
Assert.isNotNull(fontData);
- FontData[] existing = (FontData[]) stringToFontData.get(symbolicName);
+ FontData[] existing = stringToFontData.get(symbolicName);
if (Arrays.equals(existing, fontData)) {
return;
}
- FontRecord oldFont = (FontRecord) stringToFontRecord
+ FontRecord oldFont = stringToFontRecord
.remove(symbolicName);
stringToFontData.put(symbolicName, fontData);
if (update) {
@@ -832,9 +832,9 @@ public class FontRegistry extends ResourceRegistry {
*/
private void readResourceBundle(ResourceBundle bundle, String bundleName)
throws MissingResourceException {
- Enumeration keys = bundle.getKeys();
+ Enumeration<String> keys = bundle.getKeys();
while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
+ String key = keys.nextElement();
int pos = key.lastIndexOf('.');
if (pos == -1) {
stringToFontData.put(key, new FontData[] { makeFontData(bundle
@@ -849,7 +849,7 @@ public class FontRegistry extends ResourceRegistry {
throw new MissingResourceException(
"Wrong key format ", bundleName, key); //$NON-NLS-1$
}
- FontData[] elements = (FontData[]) stringToFontData.get(name);
+ FontData[] elements = stringToFontData.get(name);
if (elements == null) {
elements = new FontData[8];
stringToFontData.put(name, elements);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
index a5419cd..09afe56 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
@@ -74,7 +74,7 @@ public abstract class ImageDescriptor extends DeviceResourceDescriptor {
* @param filename the file name
* @return a new image descriptor
*/
- public static ImageDescriptor createFromFile(Class location, String filename) {
+ public static ImageDescriptor createFromFile(Class<?> location, String filename) {
return new FileImageDescriptor(location, filename);
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
index b24d717..1ce6148 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
@@ -52,7 +52,7 @@ public class ImageRegistry {
private ResourceManager manager;
- private Map table;
+ private Map<String, Entry> table;
private Runnable disposeRunnable = new Runnable() {
public void run() {
@@ -316,16 +316,16 @@ public class ImageRegistry {
}
private Entry getEntry(String key) {
- return (Entry) getTable().get(key);
+ return getTable().get(key);
}
private void putEntry(String key, Entry entry) {
getTable().put(key, entry);
}
- private Map getTable() {
+ private Map<String, Entry> getTable() {
if (table == null) {
- table = new HashMap(10);
+ table = new HashMap<String, Entry>(10);
}
return table;
}
@@ -340,8 +340,8 @@ public class ImageRegistry {
manager.cancelDisposeExec(disposeRunnable);
if (table != null) {
- for (Iterator i = table.values().iterator(); i.hasNext();) {
- Entry entry = (Entry) i.next();
+ for (Iterator<Entry> i = table.values().iterator(); i.hasNext();) {
+ Entry entry = i.next();
if (entry.image != null) {
manager.destroyImage(entry.descriptor);
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
index 6428926..f819139 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
@@ -60,7 +60,7 @@ public class JFaceResources {
* Map of Display onto DeviceResourceManager. Holds all the resources for
* the associated display.
*/
- private static final Map registries = new HashMap();
+ private static final Map<Display,DeviceResourceManager> registries = new HashMap<Display,DeviceResourceManager>();
/**
* The symbolic font name for the banner font (value
@@ -198,12 +198,12 @@ public class JFaceResources {
* @return the global resource manager for the given display
*/
public static ResourceManager getResources(final Display toQuery) {
- ResourceManager reg = (ResourceManager) registries.get(toQuery);
+ ResourceManager reg = registries.get(toQuery);
if (reg == null) {
final DeviceResourceManager mgr = new DeviceResourceManager(toQuery);
reg = mgr;
- registries.put(toQuery, reg);
+ registries.put(toQuery, mgr);
toQuery.disposeExec(new Runnable() {
/*
* (non-Javadoc)
@@ -469,7 +469,7 @@ public class JFaceResources {
*
*/
private static final void declareImage(Object bundle, String key,
- String path, Class fallback, String fallbackPath) {
+ String path, Class<?> fallback, String fallbackPath) {
ImageDescriptor descriptor = null;
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceManager.java
index 14df30f..70da756 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceManager.java
@@ -45,7 +45,7 @@ public abstract class ResourceManager {
* List of Runnables scheduled to run when the ResourceManager is disposed.
* null if empty.
*/
- private List disposeExecs = null;
+ private List<Runnable> disposeExecs = null;
/**
* Returns the Device for which this ResourceManager will create resources
@@ -323,7 +323,7 @@ public abstract class ResourceManager {
// here and throw it at the end of the method.
RuntimeException foundException = null;
- Runnable[] execs = (Runnable[]) disposeExecs.toArray(new Runnable[disposeExecs.size()]);
+ Runnable[] execs = disposeExecs.toArray(new Runnable[disposeExecs.size()]);
for (int i = 0; i < execs.length; i++) {
Runnable exec = execs[i];
@@ -364,7 +364,7 @@ public abstract class ResourceManager {
Assert.isNotNull(r);
if (disposeExecs == null) {
- disposeExecs = new ArrayList();
+ disposeExecs = new ArrayList<Runnable>();
}
disposeExecs.add(r);
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceRegistry.java
index d03439f..9be8c06 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceRegistry.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ResourceRegistry.java
@@ -42,7 +42,7 @@ public abstract class ResourceRegistry extends EventManager {
* @return the set of keys this manager knows about. This collection
* should be immutable.
*/
- public abstract Set getKeySet();
+ public abstract Set<String> getKeySet();
/**
* Return whether or not the receiver has a value for the supplied key.
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
index 35ab2fb..a00b510 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
@@ -93,7 +93,7 @@ public class StringConverter {
* @throws DataFormatException thrown if request string could not seperated
*/
public static String[] asArray(String value) throws DataFormatException {
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
StringTokenizer stok = new StringTokenizer(value);
while (stok.hasMoreTokens()) {
list.add(stok.nextToken());
@@ -306,7 +306,7 @@ public class StringConverter {
if (prop == null || prop.trim().equals("")) { //$NON-NLS-1$
return new String[0];
}
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
StringTokenizer tokens = new StringTokenizer(prop, separator);
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken().trim();
@@ -314,7 +314,7 @@ public class StringConverter {
list.add(token);
}
}
- return list.isEmpty() ? new String[0] : (String[]) list.toArray(new String[list.size()]);
+ return list.isEmpty() ? new String[0] : list.toArray(new String[list.size()]);
}
/**
@@ -326,7 +326,7 @@ public class StringConverter {
*/
public static FontData[] asFontDataArray(String value) {
String[] strings = getArrayFromList(value, FONT_SEPARATOR);
- ArrayList data = new ArrayList(strings.length);
+ ArrayList<FontData> data = new ArrayList<FontData>(strings.length);
for (int i = 0; i < strings.length; i++) {
try {
data.add(StringConverter.asFontData(strings[i]));
@@ -334,7 +334,7 @@ public class StringConverter {
//do-nothing
}
}
- return (FontData[]) data.toArray(new FontData[data.size()]);
+ return data.toArray(new FontData[data.size()]);
}
/**