Bug 57425 TreeViewer doesn't implement IFontProvider
TableViewer implements IFontProvider to support the new SWT feature to set the font for items. TreeViewer doesn't provide a corresponding implementation. Patch: Index: TreeViewer.java =================================================================== RCS file: /home/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer. java,v retrieving revision 1.13 diff -u -r1.13 TreeViewer.java --- TreeViewer.java 16 Mar 2004 20:20:40 -0000 1.13 +++ TreeViewer.java 5 Apr 2004 07:30:51 -0000 @@ -119,7 +119,13 @@ TreeItem treeItem = (TreeItem) item; treeItem.setForeground(cp.getForeground(element)); treeItem.setBackground(cp.getBackground(element)); - } + } + if (baseProvider instanceof IFontProvider) { + IFontProvider fprov = (IFontProvider) baseProvider; + TreeItem treeItem = (TreeItem) item; + treeItem.setFont(fprov.getFont(element)); + } + } /* (non-Javadoc)
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
super();
	this.tree = tree;
	hookControl(tree);
}
/* (non-Javadoc)
 * Method declared in AbstractTreeViewer.
 */
protected void addTreeListener(Control c, TreeListener listener) {
	((Tree)c).addTreeListener(listener);
}
/* (non-Javadoc)
 * Method declared in AbstractTreeViewer.
 */
protected void doUpdateItem(final Item item, Object element) {
	
	IBaseLabelProvider baseProvider = getLabelProvider();
	if (baseProvider instanceof IViewerLabelProvider) {
		IViewerLabelProvider provider = (IViewerLabelProvider)baseProvider;
		
		ViewerLabel updateLabel = new ViewerLabel(item.getText(), item.getImage());
		provider.updateLabel(updateLabel, element);
		
		if(updateLabel.hasNewImage())
			item.setImage(updateLabel.getImage());
		if(updateLabel.hasNewText())
			item.setText(updateLabel.getText());
		
	} else {
		ILabelProvider provider = (ILabelProvider)baseProvider;
		item.setText(provider.getText(element));