source: java/FramclipsePlugin/src/main/java/com/framsticks/framclipse/syntaxColoring/ColorManager.java @ 193

Last change on this file since 193 was 193, checked in by Maciej Komosinski, 10 years ago

Set svn:eol-style native for all textual files

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain
File size: 698 bytes
Line 
1package com.framsticks.framclipse.syntaxColoring;
2
3import java.util.HashMap;
4import java.util.Iterator;
5import java.util.Map;
6
7import org.eclipse.swt.graphics.Color;
8import org.eclipse.swt.graphics.RGB;
9import org.eclipse.swt.widgets.Display;
10
11@SuppressWarnings("unchecked")
12public class ColorManager {
13
14        protected Map fColorTable = new HashMap(10);
15
16        public void dispose() {
17                Iterator e = fColorTable.values().iterator();
18                while (e.hasNext()) {
19                        ((Color) e.next()).dispose();
20                }
21        }
22
23        public Color getColor(RGB rgb) {
24                Color color = (Color) fColorTable.get(rgb);
25                if (color == null) {
26                        color = new Color(Display.getCurrent(), rgb);
27                        fColorTable.put(rgb, color);
28                }
29                return color;
30        }
31}
Note: See TracBrowser for help on using the repository browser.