17
17
package org .eclipse .jface .viewers ;
18
18
19
19
import org .eclipse .core .runtime .Assert ;
20
+ import org .eclipse .jface .resource .ColorRegistry ;
21
+ import org .eclipse .jface .resource .JFaceResources ;
20
22
import org .eclipse .swt .SWT ;
21
23
import org .eclipse .swt .graphics .Color ;
22
24
import org .eclipse .swt .graphics .GC ;
@@ -110,9 +112,11 @@ private void removeSelectionInformation(Event event, ViewerCell cell) {
110
112
// On GTK, the line is highlighted even though the SELECTED flag is removed. To
111
113
// fix this issue, the background must be overwridden
112
114
gc .setBackground (cell .getViewerRow ().getBackground (cell .getColumnIndex ()));
113
- gc .fillRectangle (cell .getBounds ());
115
+ } else {
116
+ gc .setAlpha (0 ); // Don't draw background to keep cell coloring of theme
114
117
}
115
118
gc .setForeground (cell .getViewerRow ().getForeground (cell .getColumnIndex ()));
119
+ gc .fillRectangle (cell .getBounds ());
116
120
event .detail &= ~SWT .SELECTED ;
117
121
}
118
122
@@ -150,8 +154,8 @@ private void hookListener(final ColumnViewer viewer) {
150
154
* @return the color or <code>null</code> to use the default
151
155
*/
152
156
protected Color getSelectedCellBackgroundColor (ViewerCell cell ) {
153
- return removeNonFocusedSelectionInformation ? null
154
- : cell . getItem (). getDisplay (). getSystemColor ( SWT . COLOR_LIST_SELECTION );
157
+ ColorRegistry colorRegistry = JFaceResources . getColorRegistry ();
158
+ return colorRegistry . get ( "org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND" ); //$NON-NLS-1$
155
159
}
156
160
157
161
/**
@@ -163,7 +167,8 @@ protected Color getSelectedCellBackgroundColor(ViewerCell cell) {
163
167
* @return the color or <code>null</code> to use the default
164
168
*/
165
169
protected Color getSelectedCellForegroundColor (ViewerCell cell ) {
166
- return null ;
170
+ ColorRegistry colorRegistry = JFaceResources .getColorRegistry ();
171
+ return colorRegistry .get ("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND" ); //$NON-NLS-1$
167
172
}
168
173
169
174
/**
@@ -177,7 +182,8 @@ protected Color getSelectedCellForegroundColor(ViewerCell cell) {
177
182
* @since 3.4
178
183
*/
179
184
protected Color getSelectedCellForegroundColorNoFocus (ViewerCell cell ) {
180
- return null ;
185
+ ColorRegistry colorRegistry = JFaceResources .getColorRegistry ();
186
+ return colorRegistry .get ("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS" ); //$NON-NLS-1$
181
187
}
182
188
183
189
/**
@@ -191,7 +197,8 @@ protected Color getSelectedCellForegroundColorNoFocus(ViewerCell cell) {
191
197
* @since 3.4
192
198
*/
193
199
protected Color getSelectedCellBackgroundColorNoFocus (ViewerCell cell ) {
194
- return null ;
200
+ ColorRegistry colorRegistry = JFaceResources .getColorRegistry ();
201
+ return colorRegistry .get ("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS" ); //$NON-NLS-1$
195
202
}
196
203
197
204
/**
0 commit comments