Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 135344 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/ColorConstants.java (-18 / +38 lines)
Lines 19-118 Link Here
19
 */
19
 */
20
public interface ColorConstants {
20
public interface ColorConstants {
21
21
22
class Internal {
23
	private static Color getSystemColor(final int which) {
24
		Display display = Display.getCurrent();
25
		if (display != null)
26
			return display.getSystemColor(which);
27
		display = Display.getDefault();
28
		final Color result[] = new Color[1];
29
		display.syncExec(new Runnable() {
30
			public void run() {
31
				synchronized (result) {
32
					result[0] = Display.getCurrent().getSystemColor(which);					
33
				}
34
			}
35
		});
36
		synchronized (result) {
37
			return result[0];
38
		}
39
	}
40
}
41
22
/**
42
/**
23
 * @see SWT#COLOR_WIDGET_HIGHLIGHT_SHADOW
43
 * @see SWT#COLOR_WIDGET_HIGHLIGHT_SHADOW
24
 */
44
 */
25
Color buttonLightest
45
Color buttonLightest
26
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
46
				= Internal.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
27
/**
47
/**
28
 * @see SWT#COLOR_WIDGET_BACKGROUND
48
 * @see SWT#COLOR_WIDGET_BACKGROUND
29
 */
49
 */
30
Color button
50
Color button
31
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
51
				= Internal.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
32
/**
52
/**
33
 * @see SWT#COLOR_WIDGET_NORMAL_SHADOW
53
 * @see SWT#COLOR_WIDGET_NORMAL_SHADOW
34
 */
54
 */
35
Color buttonDarker
55
Color buttonDarker
36
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
56
				= Internal.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
37
/**
57
/**
38
 * @see SWT#COLOR_WIDGET_DARK_SHADOW
58
 * @see SWT#COLOR_WIDGET_DARK_SHADOW
39
 */
59
 */
40
Color buttonDarkest           
60
Color buttonDarkest           
41
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
61
				= Internal.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
42
62
43
/**
63
/**
44
 * @see SWT#COLOR_LIST_BACKGROUND
64
 * @see SWT#COLOR_LIST_BACKGROUND
45
 */
65
 */
46
Color listBackground          
66
Color listBackground          
47
				= Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
67
				= Internal.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
48
/**
68
/**
49
 * @see SWT#COLOR_LIST_FOREGROUND
69
 * @see SWT#COLOR_LIST_FOREGROUND
50
 */
70
 */
51
Color listForeground          
71
Color listForeground          
52
				= Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
72
				= Internal.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
53
73
54
/**
74
/**
55
 * @see SWT#COLOR_WIDGET_BACKGROUND
75
 * @see SWT#COLOR_WIDGET_BACKGROUND
56
 */
76
 */
57
Color menuBackground          
77
Color menuBackground          
58
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
78
				= Internal.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
59
/**
79
/**
60
 * @see SWT#COLOR_WIDGET_FOREGROUND
80
 * @see SWT#COLOR_WIDGET_FOREGROUND
61
 */
81
 */
62
Color menuForeground          
82
Color menuForeground          
63
				= Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
83
				= Internal.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
64
/**
84
/**
65
 * @see SWT#COLOR_LIST_SELECTION
85
 * @see SWT#COLOR_LIST_SELECTION
66
 */
86
 */
67
Color menuBackgroundSelected  
87
Color menuBackgroundSelected  
68
				= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION);
88
				= Internal.getSystemColor(SWT.COLOR_LIST_SELECTION);
69
/**
89
/**
70
 * @see SWT#COLOR_LIST_SELECTION_TEXT
90
 * @see SWT#COLOR_LIST_SELECTION_TEXT
71
 */
91
 */
72
Color menuForegroundSelected  
92
Color menuForegroundSelected  
73
				= Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
93
				= Internal.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
74
94
75
/**
95
/**
76
 * @see SWT#COLOR_TITLE_BACKGROUND
96
 * @see SWT#COLOR_TITLE_BACKGROUND
77
 */
97
 */
78
Color titleBackground         
98
Color titleBackground         
79
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
99
				= Internal.getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
80
/**
100
/**
81
 * @see SWT#COLOR_TITLE_BACKGROUND_GRADIENT
101
 * @see SWT#COLOR_TITLE_BACKGROUND_GRADIENT
82
 */
102
 */
83
Color titleGradient           
103
Color titleGradient           
84
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
104
				= Internal.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
85
/**
105
/**
86
 * @see SWT#COLOR_TITLE_FOREGROUND
106
 * @see SWT#COLOR_TITLE_FOREGROUND
87
 */
107
 */
88
Color titleForeground         
108
Color titleForeground         
89
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
109
				= Internal.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
90
/**
110
/**
91
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
111
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
92
 */
112
 */
93
Color titleInactiveForeground 
113
Color titleInactiveForeground 
94
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
114
				= Internal.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
95
/**
115
/**
96
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
116
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
97
 */
117
 */
98
Color titleInactiveBackground 
118
Color titleInactiveBackground 
99
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
119
				= Internal.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
100
/**
120
/**
101
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
121
 * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND
102
 */
122
 */
103
Color titleInactiveGradient   
123
Color titleInactiveGradient   
104
				= Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
124
				= Internal.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
105
125
106
/**
126
/**
107
 * @see SWT#COLOR_INFO_FOREGROUND
127
 * @see SWT#COLOR_INFO_FOREGROUND
108
 */
128
 */
109
Color tooltipForeground       
129
Color tooltipForeground       
110
				= Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
130
				= Internal.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
111
/**
131
/**
112
 * @see SWT#COLOR_INFO_BACKGROUND
132
 * @see SWT#COLOR_INFO_BACKGROUND
113
 */
133
 */
114
Color tooltipBackground       
134
Color tooltipBackground       
115
				= Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
135
				= Internal.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
116
136
117
/*
137
/*
118
 * Misc. colors
138
 * Misc. colors

Return to bug 135344