Added: PreferencePage; External Browser startup; extended syntax highlighting
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / util / PHPColorProvider.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java
new file mode 100644 (file)
index 0000000..30b61f9
--- /dev/null
@@ -0,0 +1,57 @@
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+    IBM Corporation - Initial implementation
+    Klaus Hartlage - www.eclipseproject.de
+**********************************************************************/
+package net.sourceforge.phpeclipse.phpeditor.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Manager for colors used in the Java editor
+ */
+public class PHPColorProvider {
+
+       public static final RGB MULTI_LINE_COMMENT= new RGB(128, 0, 0);
+       public static final RGB SINGLE_LINE_COMMENT= new RGB(128, 128, 0);
+       public static final RGB KEYWORD= new RGB(0, 0, 128);
+       public static final RGB TYPE= new RGB(0, 0, 128);
+       public static final RGB STRING= new RGB(0, 128, 0);
+       public static final RGB DEFAULT= new RGB(0, 0, 0);
+  public static final RGB HTML_DEFAULT= new RGB(0, 128, 128);
+
+
+       protected Map fColorTable= new HashMap(10);
+
+       /**
+        * Release all of the color resources held onto by the receiver.
+        */     
+       public void dispose() {
+               Iterator e= fColorTable.values().iterator();
+               while (e.hasNext())
+                        ((Color) e.next()).dispose();
+       }
+       
+       /**
+        * Return the Color that is stored in the Color table as rgb.
+        */
+       public Color getColor(RGB rgb) {
+               Color color= (Color) fColorTable.get(rgb);
+               if (color == null) {
+                       color= new Color(Display.getCurrent(), rgb);
+                       fColorTable.put(rgb, color);
+               }
+               return color;
+       }
+}