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
 
   9     IBM Corporation - Initial implementation
 
  10     Klaus Hartlage - www.eclipseproject.de
 
  11 **********************************************************************/
 
  12 package net.sourceforge.phpeclipse.phpeditor.util;
 
  14 import java.util.HashMap;
 
  15 import java.util.Iterator;
 
  17 import org.eclipse.swt.graphics.Color;
 
  18 import org.eclipse.swt.graphics.RGB;
 
  19 import org.eclipse.swt.widgets.Display;
 
  22  * Manager for colors used in the Java editor
 
  24 public class PHPColorProvider {
 
  26         public static final RGB MULTI_LINE_COMMENT= new RGB(128, 0, 0);
 
  27         public static final RGB SINGLE_LINE_COMMENT= new RGB(128, 128, 0);
 
  28         public static final RGB KEYWORD= new RGB(0, 0, 128);
 
  29         public static final RGB TYPE= new RGB(0, 0, 128);
 
  30         public static final RGB STRING= new RGB(0, 128, 0);
 
  31         public static final RGB DEFAULT= new RGB(0, 0, 0);
 
  32   public static final RGB HTML_DEFAULT= new RGB(0, 128, 128);
 
  35         protected Map fColorTable= new HashMap(10);
 
  38          * Release all of the color resources held onto by the receiver.
 
  40         public void dispose() {
 
  41                 Iterator e= fColorTable.values().iterator();
 
  43                          ((Color) e.next()).dispose();
 
  47          * Return the Color that is stored in the Color table as rgb.
 
  49         public Color getColor(RGB rgb) {
 
  50                 Color color= (Color) fColorTable.get(rgb);
 
  52                         color= new Color(Display.getCurrent(), rgb);
 
  53                         fColorTable.put(rgb, color);