2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.model
;
12 import org
.eclipse
.jface
.resource
.ColorRegistry
;
13 import org
.eclipse
.swt
.graphics
.Color
;
14 import org
.eclipse
.swt
.graphics
.RGB
;
16 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
24 public class ColorResources
{
26 private static ColorResources instance
;
28 public static ColorResources
getInstance(){
30 instance
= new ColorResources();
35 private static ColorRegistry colorRegistry
;
37 public ColorRegistry
getColorRegistry() {
38 if (colorRegistry
== null) {
39 colorRegistry
= new ColorRegistry();
40 initializeColorRegistry(colorRegistry
);
45 public static Color
getColor(String key
){
46 return getInstance().getColorRegistry().get(key
);
49 protected void initializeColorRegistry(ColorRegistry registry
) {
50 registerColor(registry
, Resources
.COLOR_COMPOSITE_BACKGROUND
, 255,255,255);
51 registerColor(registry
, Resources
.COLOR_CONTROL_BACKGROUND
, 220, 220, 220);
52 registerColor(registry
, Resources
.COLOR_CONTROL_SELECTED
, 210, 210, 210);
53 registerColor(registry
, Resources
.COLOR_CONTROL_SELECTED_FOCUS
, 232,242,254);
54 registerColor(registry
, Resources
.COLOR_COMPOSITE_IRRELEVANT
, 241,139,18);
55 registerColor(registry
, Resources
.SEARCH_VIEW_FOREGROUND
, 192, 192, 192);
56 registerColor(registry
, Resources
.SEARCH_VIEW_FOCUS
, 0, 0, 0);
57 registerColor(registry
, Resources
.COLOR_LIST_BACKGROUND
, 150,150,150);
58 registerColor(registry
, Resources
.COLOR_FONT_DEFAULT
, 0,0,0);
59 registerColor(registry
, Resources
.COLOR_TEXT_DISABLED
, 150,150,150);
60 registerColor(registry
, Resources
.COLOR_TEXT_DISABLED_BACKGROUND
, 230,230,230);
61 registerColor(registry
, Resources
.COLOR_DRAG_ENTER
, 185,255,133);
62 registerColor(registry
, Resources
.COLOR_LIST_EVEN
, 255,255,255);
63 registerColor(registry
, Resources
.COLOR_LIST_ODD
, 230,230,230);
64 registerColor(registry
, Resources
.COLOR_PARSE_ERROR
, 255,0,0);
65 registerColor(registry
, Resources
.COLOR_DISABLED_EDITOR
, 105,114,124);
66 registerColor(registry
, Resources
.COLOR_EDITOR_ERROR
, 255,0,0);
69 private void registerColor(ColorRegistry registry
, String key
,
70 int red
, int green
, int blue
) {
71 registry
.put(key
, new RGB(red
, green
, blue
));