Generify DLTKColorManager.

Change-Id: Iec19ada5c3c01c2ecaf3f673facaf04868e40f90
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/DLTKColorManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/DLTKColorManager.java
index 4a5aed8..6ee9884 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/DLTKColorManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/DLTKColorManager.java
@@ -8,7 +8,6 @@
  *******************************************************************************/
 package org.eclipse.dltk.internal.ui.text;
 
-
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -24,20 +23,18 @@
  */
 public class DLTKColorManager implements IColorManager, IColorManagerExtension {
 
-	protected Map fKeyTable= new HashMap(10);
-	protected Map fDisplayTable= new HashMap(2);
+	protected Map<String, RGB> fKeyTable = new HashMap<>(10);
+	protected Map<Display, Map<RGB, Color>> fDisplayTable = new HashMap<>(2);
 
 	/**
-	 * Flag which tells if the colors are automatically disposed when
-	 * the current display gets disposed.
+	 * Flag which tells if the colors are automatically disposed when the
+	 * current display gets disposed.
 	 */
 	private boolean fAutoDisposeOnDisplayDispose;
 
-
 	/**
-	 * Creates a new DLTK color manager which automatically
-	 * disposes the allocated colors when the current display
-	 * gets disposed.
+	 * Creates a new DLTK color manager which automatically disposes the
+	 * allocated colors when the current display gets disposed.
 	 */
 	public DLTKColorManager() {
 		this(true);
@@ -46,22 +43,25 @@
 	/**
 	 * Creates a new DLTK color manager.
 	 *
-	 * @param autoDisposeOnDisplayDispose 	if <code>true</code>  the color manager
-	 * automatically disposes all managed colors when the current display gets disposed
-	 * and all calls to {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()} are ignored.
+	 * @param autoDisposeOnDisplayDispose
+	 *            if <code>true</code> the color manager automatically disposes
+	 *            all managed colors when the current display gets disposed and
+	 *            all calls to
+	 *            {@link org.eclipse.jface.text.source.ISharedTextColors#dispose()}
+	 *            are ignored.
 	 *
 	 *
 	 */
 	public DLTKColorManager(boolean autoDisposeOnDisplayDispose) {
-		fAutoDisposeOnDisplayDispose= autoDisposeOnDisplayDispose;
+		fAutoDisposeOnDisplayDispose = autoDisposeOnDisplayDispose;
 	}
 
 	public void dispose(Display display) {
-		Map colorTable= (Map) fDisplayTable.get(display);
+		Map<RGB, Color> colorTable = fDisplayTable.get(display);
 		if (colorTable != null) {
-			Iterator e= colorTable.values().iterator();
+			Iterator<Color> e = colorTable.values().iterator();
 			while (e.hasNext()) {
-				Color color= (Color)e.next();
+				Color color = e.next();
 				if (color != null && !color.isDisposed())
 					color.dispose();
 			}
@@ -74,19 +74,19 @@
 		if (rgb == null)
 			return null;
 
-		final Display display= Display.getCurrent();
-		Map colorTable= (Map) fDisplayTable.get(display);
+		final Display display = Display.getCurrent();
+		Map<RGB, Color> colorTable = fDisplayTable.get(display);
 		if (colorTable == null) {
-			colorTable= new HashMap(10);
+			colorTable = new HashMap<>(10);
 			fDisplayTable.put(display, colorTable);
 			if (fAutoDisposeOnDisplayDispose) {
 				display.disposeExec(() -> dispose(display));
 			}
 		}
 
-		Color color= (Color) colorTable.get(rgb);
+		Color color = colorTable.get(rgb);
 		if (color == null) {
-			color= new Color(Display.getCurrent(), rgb);
+			color = new Color(Display.getCurrent(), rgb);
 			colorTable.put(rgb, color);
 		}
 
@@ -105,13 +105,13 @@
 		if (key == null)
 			return null;
 
-		RGB rgb= (RGB) fKeyTable.get(key);
+		RGB rgb = fKeyTable.get(key);
 		return getColor(rgb);
 	}
 
 	@Override
 	public void bindColor(String key, RGB rgb) {
-		Object value= fKeyTable.get(key);
+		Object value = fKeyTable.get(key);
 		if (value != null)
 			throw new UnsupportedOperationException();