private void markFocusedCell(Event event, ViewerCell cell) { Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell) : getSelectedCellBackgroundColorNoFocus(cell); Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell) : getSelectedCellForegroundColorNoFocus(cell);
private void markFocusedCell(Event event, ViewerCell cell) { Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell) : getSelectedCellBackgroundColorNoFocus(cell); Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell) : getSelectedCellForegroundColorNoFocus(cell); if (foreground != null || background != null || onlyTextHighlighting(cell)) { GC gc = event.gc; if (background == null) { background = cell.getItem().getDisplay().getSystemColor( SWT.COLOR_LIST_SELECTION); } if (foreground == null) { foreground = cell.getItem().getDisplay().getSystemColor( SWT.COLOR_LIST_SELECTION_TEXT); } gc.setBackground(background); gc.setForeground(foreground); if (onlyTextHighlighting(cell)) { Rectangle area = event.getBounds(); Rectangle rect = cell.getTextBounds(); if( rect != null ) { area.x = rect.x; } gc.fillRectangle(area); } else { gc.fillRectangle(event.getBounds()); } event.detail &= ~SWT.SELECTED; } }
private void markFocusedCell(Event event, ViewerCell cell) { Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell) : getSelectedCellBackgroundColorNoFocus(cell); Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell) : getSelectedCellForegroundColorNoFocus(cell); if (foreground != null || background != null || onlyTextHighlighting(cell)) { GC gc = event.gc; if (background == null) { background = cell.getItem().getDisplay().getSystemColor( SWT.COLOR_LIST_SELECTION); } if (foreground == null) { foreground = cell.getItem().getDisplay().getSystemColor( SWT.COLOR_LIST_SELECTION_TEXT); } gc.setBackground(background); gc.setForeground(foreground); if (onlyTextHighlighting(cell)) { Rectangle area = event.getBounds(); Rectangle rect = cell.getTextBounds(); if( rect != null ) { area.x = rect.x; } gc.fillRectangle(area); } else { gc.fillRectangle(event.getBounds()); } event.detail &= ~SWT.SELECTED; } }