a7a662cac0205ff99bd1ec56b6640d6a470bd80c
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / editors / ColorManager.java
1 package com.quantum.editors;
2
3 import java.util.HashMap;
4 import java.util.Iterator;
5 import java.util.Map;
6
7 import org.eclipse.swt.graphics.Color;
8 import org.eclipse.swt.graphics.RGB;
9 import org.eclipse.swt.widgets.Display;
10
11 public class ColorManager {
12
13         protected Map fColorTable = new HashMap(10);
14
15         public void dispose() {
16                 Iterator e= fColorTable.values().iterator();
17                 while (e.hasNext())
18                         ((Color) e.next()).dispose();
19         }
20         public Color getColor(RGB rgb) {
21                 Color color= (Color) fColorTable.get(rgb);
22                 if (color == null) {
23                         color= new Color(Display.getCurrent(), rgb);
24                         fColorTable.put(rgb, color);
25                 }
26                 return color;
27         }
28 }