org.symbian.tools.wrttools.jseditors/src/org/symbian/tools/wrttools/jseditors/editors/ColorManager.java
equal
deleted
inserted
replaced
1 /** |
|
2 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Symbian Foundation - initial contribution. |
|
11 * Contributors: |
|
12 * Description: |
|
13 * Overview: |
|
14 * Details: |
|
15 * Platforms/Drives/Compatibility: |
|
16 * Assumptions/Requirement/Pre-requisites: |
|
17 * Failures and causes: |
|
18 */ |
|
19 package org.symbian.tools.wrttools.jseditors.editors; |
|
20 |
|
21 import java.util.HashMap; |
|
22 import java.util.Iterator; |
|
23 import java.util.Map; |
|
24 |
|
25 import org.eclipse.swt.graphics.Color; |
|
26 import org.eclipse.swt.graphics.RGB; |
|
27 import org.eclipse.swt.widgets.Display; |
|
28 |
|
29 public class ColorManager { |
|
30 |
|
31 protected Map fColorTable = new HashMap(10); |
|
32 |
|
33 public void dispose() { |
|
34 Iterator e = fColorTable.values().iterator(); |
|
35 while (e.hasNext()) |
|
36 ((Color) e.next()).dispose(); |
|
37 } |
|
38 public Color getColor(RGB rgb) { |
|
39 Color color = (Color) fColorTable.get(rgb); |
|
40 if (color == null) { |
|
41 color = new Color(Display.getCurrent(), rgb); |
|
42 fColorTable.put(rgb, color); |
|
43 } |
|
44 return color; |
|
45 } |
|
46 } |
|