1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.model;
|
11
|
|
12
|
import org.eclipse.jface.resource.ColorRegistry;
|
13
|
import org.eclipse.swt.graphics.Color;
|
14
|
import org.eclipse.swt.graphics.RGB;
|
15
|
|
16
|
import eu.etaxonomy.taxeditor.preference.Resources;
|
17
|
|
18
|
/**
|
19
|
*
|
20
|
* @author pplitzner
|
21
|
* @since Nov 1, 2017
|
22
|
*
|
23
|
*/
|
24
|
public class ColorResources {
|
25
|
|
26
|
private static ColorResources instance;
|
27
|
|
28
|
public static ColorResources getInstance(){
|
29
|
if(instance == null){
|
30
|
instance = new ColorResources();
|
31
|
}
|
32
|
return instance;
|
33
|
}
|
34
|
|
35
|
private static ColorRegistry colorRegistry;
|
36
|
|
37
|
public ColorRegistry getColorRegistry() {
|
38
|
if (colorRegistry == null) {
|
39
|
colorRegistry = new ColorRegistry();
|
40
|
initializeColorRegistry(colorRegistry);
|
41
|
}
|
42
|
return colorRegistry;
|
43
|
}
|
44
|
|
45
|
public static Color getColor(String key){
|
46
|
return getInstance().getColorRegistry().get(key);
|
47
|
}
|
48
|
|
49
|
protected void initializeColorRegistry(ColorRegistry registry) {
|
50
|
registerColor(registry, Resources.COLOR_SWT_BG_DEFAULT, 214, 214, 214);
|
51
|
registerColor(registry, Resources.COLOR_MATRIX_SUMMARY_BG, 255, 255, 153);
|
52
|
registerColor(registry, Resources.COLOR_BULK_EDITOR_CANDIDATE, 243, 240, 165);
|
53
|
registerColor(registry, Resources.COLOR_BULK_EDITOR_TARGET, 135, 255, 135);
|
54
|
registerColor(registry, Resources.COLOR_COMPOSITE_BACKGROUND, 255,255,255);
|
55
|
registerColor(registry, Resources.COLOR_CONTROL_BACKGROUND, 220, 220, 220);
|
56
|
registerColor(registry, Resources.COLOR_CONTROL_SELECTED, 210, 210, 210);
|
57
|
registerColor(registry, Resources.COLOR_CONTROL_SELECTED_FOCUS, 232,242,254);
|
58
|
registerColor(registry, Resources.COLOR_COMPOSITE_IRRELEVANT, 241,139,18);
|
59
|
registerColor(registry, Resources.SEARCH_VIEW_FOREGROUND, 192, 192, 192);
|
60
|
registerColor(registry, Resources.SEARCH_VIEW_FOCUS, 0, 0, 0);
|
61
|
registerColor(registry, Resources.BLACK, 0, 0, 0);
|
62
|
registerColor(registry, Resources.COLOR_LIST_BACKGROUND, 150,150,150);
|
63
|
registerColor(registry, Resources.COLOR_FONT_DEFAULT, 0,0,0);
|
64
|
registerColor(registry, Resources.COLOR_TEXT_DISABLED, 150,150,150);
|
65
|
registerColor(registry, Resources.COLOR_TEXT_DISABLED_BACKGROUND, 230,230,230);
|
66
|
registerColor(registry, Resources.COLOR_DRAG_ENTER, 185,255,133);
|
67
|
registerColor(registry, Resources.COLOR_LIST_EVEN, 255,255,255);
|
68
|
registerColor(registry, Resources.COLOR_LIST_ODD, 230,230,230);
|
69
|
registerColor(registry, Resources.COLOR_PARSE_ERROR, 255,0,0);
|
70
|
registerColor(registry, Resources.COLOR_DISABLED_EDITOR, 105,114,124);
|
71
|
registerColor(registry, Resources.COLOR_EDITOR_ERROR, 255,0,0);
|
72
|
}
|
73
|
|
74
|
private void registerColor(ColorRegistry registry, String key,
|
75
|
int red, int green, int blue) {
|
76
|
registry.put(key, new RGB(red, green, blue));
|
77
|
}
|
78
|
}
|