1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / util / PHPColorProvider.java
1 /**********************************************************************
2  Copyright (c) 2000, 2002 IBM Corp. and others.
3  All rights reserved. This program and the accompanying materials
4  are made available under the terms of the Common Public License v1.0
5  which accompanies this distribution, and is available at
6  http://www.eclipse.org/legal/cpl-v10.html
7
8  Contributors:
9  IBM Corporation - Initial implementation
10  www.phpeclipse.de
11  **********************************************************************/
12 package net.sourceforge.phpeclipse.phpeditor.util;
13
14 import java.util.HashMap;
15 import java.util.Iterator;
16 import java.util.Map;
17
18 import org.eclipse.swt.graphics.Color;
19 import org.eclipse.swt.graphics.RGB;
20 import org.eclipse.swt.widgets.Display;
21
22 /**
23  * Manager for colors used in the Java editor
24  */
25 public class PHPColorProvider {
26
27         public static final RGB MULTI_LINE_COMMENT = new RGB(63, 127, 95);
28
29         public static final RGB SINGLE_LINE_COMMENT = new RGB(63, 127, 95);
30
31         public static final RGB TAG = new RGB(255, 0, 128);
32
33         public static final RGB KEYWORD = new RGB(127, 0, 85);
34
35         public static final RGB VARIABLE = new RGB(127, 159, 191);
36
37         public static final RGB FUNCTION_NAME = new RGB(127, 127, 159);
38
39         public static final RGB STRING_DQ = new RGB(42, 0, 255);
40
41         public static final RGB STRING_SQ = new RGB(42, 0, 255);
42
43         public static final RGB DEFAULT = new RGB(0, 0, 0);
44
45         public static final RGB TYPE = new RGB(127, 0, 85);
46
47         public static final RGB CONSTANT = new RGB(127, 0, 85);
48
49         public static final RGB BACKGROUND = new RGB(255, 255, 255);
50
51         // public static final RGB LINKED_POSITION_COLOR = new RGB(0, 0, 0);
52
53         // public static final RGB LINE_NUMBER_COLOR = new RGB(0, 0, 0);
54         // public static final RGB BACKGROUND_COLOR = new RGB(255, 255, 255);
55
56         public static final RGB PHPDOC_TAG = new RGB(63, 127, 95);
57
58         public static final RGB PHPDOC_LINK = new RGB(63, 63, 191);
59
60         public static final RGB PHPDOC_DEFAULT = new RGB(63, 95, 191);
61
62         public static final RGB PHPDOC_KEYWORD = new RGB(127, 159, 191);
63
64         protected Map fColorTable = new HashMap(10);
65
66         /**
67          * Release all of the color resources held onto by the receiver.
68          */
69         public void dispose() {
70                 Iterator e = fColorTable.values().iterator();
71                 while (e.hasNext())
72                         ((Color) e.next()).dispose();
73         }
74
75         /**
76          * Return the Color that is stored in the Color table as rgb.
77          */
78         public Color getColor(RGB rgb) {
79                 Color color = (Color) fColorTable.get(rgb);
80                 if (color == null) {
81                         color = new Color(Display.getCurrent(), rgb);
82                         fColorTable.put(rgb, color);
83                 }
84                 return color;
85         }
86 }