~piastucki/bzr-eclipse/history-view-enhancements

« back to all changes in this revision

Viewing changes to src/org/vcs/bazaar/eclipse/editors/ColorManager.java

  • Committer: Guillermo Gonzalez
  • Date: 2007-03-14 12:15:50 UTC
  • Revision ID: guillo.gonzo@gmail.com-20070314121550-tltk3b6f3zblf0dh
Initial commit with the new code layout.
Now starts the real work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.vcs.bazaar.eclipse.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
 
}