How to change a treeitems background color of a CheckboxTreeViewer? [message #97989] |
Mon, 14 July 2008 10:45  |
Eclipse User |
|
|
|
Originally posted by: mary.tetracom.com
Hello,
I have CheckboxTreeViewer control. There is a search into a treeitems and
I need to mark the result. I have the following label provider:
public class TreeLabelProvider extends LabelProvider implements
IColorProvider {
public Image getImage(Object element) {
return null;
}
public String getText(Object element) {
return ((CTTreeItem)element).getText();
}
public Color getBackground( Object element ) {
if ( foundObjectsIds != null
&& foundObjectsIds.containsKey( ( ( CTTreeItem )element ).getID() ) ) {
return Display.getDefault().getSystemColor( SWT.COLOR_DARK_BLUE );
} else {
return null;
}
}
public Color getForeground( Object element ) {
return null;
}
}
When I debug, I see that the method is called and a color is returned.
But the found items are not marked.
Any help
Regards
|
|
|
Re: How to change a treeitems background color of a CheckboxTreeViewer? [message #98033 is a reply to message #97989] |
Mon, 14 July 2008 11:34  |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
Hi,
I am aware that there are issues with the foreground color,
described in more detail here:
218420: [TreeItem] setForeground(Color), setForeground(int,
Color), setBackground(int, Color) does not work
https://bugs.eclipse.org/bugs/show_bug.cgi?id=218420
and here:
193933: [TreeItem] Text is not grayed out when disabled if
custom foreground color is set
https://bugs.eclipse.org/bugs/show_bug.cgi?id=193933
Basically they are related to the way the client-side library
represents TreeItems.
I could imagine the for similar reasons, the background color does
not work either.
Feel free to file a bugzilla.
Cheers,
Rüdiger
Marija Kalinova wrote:
> Hello,
> I have CheckboxTreeViewer control. There is a search into a treeitems
> and I need to mark the result. I have the following label provider:
>
> public class TreeLabelProvider extends LabelProvider implements
> IColorProvider {
>
> public Image getImage(Object element) {
> return null;
> }
>
> public String getText(Object element) {
> return ((CTTreeItem)element).getText();
> }
>
> public Color getBackground( Object element ) {
> if ( foundObjectsIds != null && foundObjectsIds.containsKey(
> ( ( CTTreeItem )element ).getID() ) ) {
>
> return Display.getDefault().getSystemColor( SWT.COLOR_DARK_BLUE );
>
> } else {
> return null;
> }
> }
>
> public Color getForeground( Object element ) {
> return null;
> }
> }
>
> When I debug, I see that the method is called and a color is returned.
> But the found items are not marked.
> Any help
>
>
> Regards
>
|
|
|
Powered by
FUDForum. Page generated in 0.04095 seconds