X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaColorManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaColorManager.java
index 3c57e1d..7578353 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaColorManager.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/JavaColorManager.java
@@ -4,7 +4,7 @@ package net.sourceforge.phpdt.internal.ui.text;
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
-
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -20,21 +20,20 @@ import org.eclipse.swt.widgets.Display;
* Java color manager.
*/
public class JavaColorManager implements IColorManager, IColorManagerExtension {
- protected Map fKeyTable= new HashMap(10);
- protected Map fDisplayTable= new HashMap(2);
+ protected Map fKeyTable = new HashMap(10);
+
+ protected Map 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 Java color manager which automatically
- * disposes the allocated colors when the current display
- * gets disposed.
- */
+ * Creates a new Java color manager which automatically disposes the
+ * allocated colors when the current display gets disposed.
+ */
public JavaColorManager() {
this(true);
}
@@ -42,40 +41,43 @@ public class JavaColorManager implements IColorManager, IColorManagerExtension {
/**
* Creates a new Java color manager.
*
- * @param autoDisposeOnDisplayDispose if true
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 true
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.
*
* @since 2.1
*/
public JavaColorManager(boolean autoDisposeOnDisplayDispose) {
- fAutoDisposeOnDisplayDispose= autoDisposeOnDisplayDispose;
+ fAutoDisposeOnDisplayDispose = autoDisposeOnDisplayDispose;
}
-
+
public void dispose(Display display) {
- Map colorTable= (Map) fDisplayTable.get(display);
+ Map colorTable = (Map) fDisplayTable.get(display);
if (colorTable != null) {
- Iterator e= colorTable.values().iterator();
+ Iterator e = colorTable.values().iterator();
while (e.hasNext()) {
- Color color= (Color)e.next();
+ Color color = (Color) e.next();
if (color != null && !color.isDisposed())
color.dispose();
}
}
}
-
+
/*
* @see IColorManager#getColor(RGB)
*/
public Color getColor(RGB rgb) {
-
+
if (rgb == null)
return null;
-
- final Display display= Display.getCurrent();
- Map colorTable= (Map) fDisplayTable.get(display);
+
+ final Display display = Display.getCurrent();
+ Map colorTable = (Map) fDisplayTable.get(display);
if (colorTable == null) {
- colorTable= new HashMap(10);
+ colorTable = new HashMap(10);
fDisplayTable.put(display, colorTable);
if (fAutoDisposeOnDisplayDispose) {
display.disposeExec(new Runnable() {
@@ -85,16 +87,16 @@ public class JavaColorManager implements IColorManager, IColorManagerExtension {
});
}
}
-
- Color color= (Color) colorTable.get(rgb);
+
+ Color color = (Color) colorTable.get(rgb);
if (color == null) {
- color= new Color(Display.getCurrent(), rgb);
+ color = new Color(Display.getCurrent(), rgb);
colorTable.put(rgb, color);
}
-
+
return color;
}
-
+
/*
* @see IColorManager#dispose
*/
@@ -102,27 +104,27 @@ public class JavaColorManager implements IColorManager, IColorManagerExtension {
if (!fAutoDisposeOnDisplayDispose)
dispose(Display.getCurrent());
}
-
+
/*
* @see IColorManager#getColor(String)
*/
public Color getColor(String key) {
-
+
if (key == null)
return null;
-
- RGB rgb= (RGB) fKeyTable.get(key);
+
+ RGB rgb = (RGB) fKeyTable.get(key);
return getColor(rgb);
}
-
+
/*
* @see IColorManagerExtension#bindColor(String, RGB)
*/
public void bindColor(String key, RGB rgb) {
- Object value= fKeyTable.get(key);
+ Object value = fKeyTable.get(key);
if (value != null)
throw new UnsupportedOperationException();
-
+
fKeyTable.put(key, rgb);
}