I'm developing a tree based on TreeViewer and created myLabelProvider which extends LabelProvider
and then use viewer.setLabelProvider(new ViewLabelProvider());
, but all the nodes are still displayed with normal plain style.
Code:
class ViewLabelProvider extends LabelProvider implements ITableLabelProvider, ITableFontProvider{
public String getText(Object obj) {
return obj.toString();
}
public Image getImage(Object obj) {
return null;
}
public Font getFont(Object element, int columnIndex) {
FontRegistry registry = new FontRegistry();
return registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());
}
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
public String getColumnText(Object element, int columnIndex) {
return null;
}
}
References:
http://www.eclipsezone.com/eclipse/forums/t95078.html
How do I make part of a TreeViewer cell bold?
Can anyone give some advice?
Package Explorer
. – Karb