|CSS styling a specific TreeItems text color [message #1739016]
||Tue, 26 July 2016 20:21
| Sean Horton
Registered: June 2016
Hi guys, |
I'm playing around with css styling and came across a problem I'm not sure how to solve.
We have a TreeViewer that has a custom css style set to it using WidgetElement.setCSSClass(), which is working great.
However, in the the TreeViewers ViewLabelProvider if the item is in a specific state we'd like to color that one specific items text color differently than the rest. For example, if we are showing a list of files in the TreeViewer and one of the files is deleted, we'd change that TreeItem to have 'red' text instead of 'black'.
This can be done in the ViewLabelProvider's update(ViewerCell cell) method by doing cell.setForeground(getSystemColor(SWT.COLOR_RED)); This works, but we'd like to remove the getSystemColor() call with a css styled color.
Another thing we tried was setting the css styling on the ViewerCell's item (a TreeItem). This would look like WidgetElement.setCSSClass(cell.getItem(), "someclass"); this had no effect in the ViewLabelProviders update(ViewerCell) method. It seemed the TreeItem was taking the values we set for the TreeViewers css.
1) Can we read a color value directly from the css file without creating a widget, so we can set it directly using ViewerCell.setForeground(<color from css file>)?
2) Do TreeViewers support the changing of a single specific TreeItem using css styling?
Any help would be appreciated,
Powered by FUDForum
. Page generated in 0.01401 seconds