org.eclipse.jface.viewers.ITableColorProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.ITableColorProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CContainerViewer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected void doUpdateCell(int index, CContainerCell cell, Object element, String[] properties) {
	IBaseLabelProvider prov = (IBaseLabelProvider) getLabelProvider();
	if(prov != null) {
		Color background = null;
		Color foreground = null;
		if(prov instanceof ITableColorProvider) {
			background = ((ITableColorProvider) prov).getBackground(element, index);
			foreground = ((ITableColorProvider) prov).getForeground(element, index);
		} else if(prov instanceof IColorProvider) {
			background = ((IColorProvider) prov).getBackground(element);
			foreground = ((IColorProvider) prov).getForeground(element);
		}
		if(background != null) cell.setCellBackground(background);
		if(foreground != null) cell.setCellForeground(foreground);
		
		// TODO doUpdateItem - set fonts...
	}
}