Project: Eclipse_Platform_UI
Bug 174355 [Viewers] IViewerLabelProvider isn't supported by the TreeViewer anymore
Reported: 2007-02-15 13:51:58 | Status: resolved fixed

Build ID: I20070209-1006 Steps To Reproduce: 1. Register following label provider to a TreeViewer: private class TestLabelProvider extends LabelProvider implements IViewerLabelProvider { @Override public String getText(Object element) { return super.getText(element); } public void updateLabel(ViewerLabel label, Object element) { ... // update the label } } 2. If you set a breakpoint in both methods, you see that updateLabel() is never called but getText() is. More information: Here is the stacktrace on the getText() breakpoint: Thread [main] (Suspended (breakpoint at line 283 in EditCategoriesView$TestLabelProvider)) EditCategoriesView$TestLabelProvider.getText(Object) line: 283 WrappedViewerLabelProvider.getText(Object) line: 95 WrappedViewerLabelProvider(ColumnLabelProvider).update(ViewerCell) line: 35 ColumnViewer$3(ViewerColumn).refresh(ViewerCell) line: 139 TreeViewer(AbstractTreeViewer).doUpdateItem(Item, Object) line: 887 AbstractTreeViewer$UpdateItemSafeRunnable.run() line: 97 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 850 JFaceUtil$1.run(ISafeRunnable) line: 52 SafeRunnable.run(ISafeRunnable) line: 153 TreeViewer(AbstractTreeViewer).doUpdateItem(Widget, Object, boolean) line: 962 StructuredViewer$UpdateItemSafeRunnable.run() line: 465 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 850 JFaceUtil$1.run(ISafeRunnable) line: 52 SafeRunnable.run(ISafeRunnable) line: 153 TreeViewer(StructuredViewer).updateItem(Widget, Object) line: 1983 TreeViewer(AbstractTreeViewer).createTreeItem(Widget, Object, int) line: 799 AbstractTreeViewer$1.run() line: 777 BusyIndicator.showWhile(Display, Runnable) line: 67 TreeViewer(AbstractTreeViewer).createChildren(Widget) line: 751 TreeViewer.createChildren(Widget) line: 526 TreeViewer(AbstractTreeViewer).internalInitializeTree(Control) line: 1419 TreeViewer.internalInitializeTree(Control) line: 705 AbstractTreeViewer$5.run() line: 1406 TreeViewer(StructuredViewer).preservingSelection(Runnable) line: 1332 TreeViewer(AbstractTreeViewer).inputChanged(Object, Object) line: 1395 TreeViewer(ContentViewer).setInput(Object) line: 251 TreeViewer(StructuredViewer).setInput(Object) line: 1570 EditCategoriesView.create(Composite) line: 235 EditCategoriesDialog.createDialogArea(Composite) line: 38 EditCategoriesDialog(Dialog).createContents(Composite) line: 780 EditCategoriesDialog(Window).create() line: 426 EditCategoriesDialog(Dialog).create() line: 1111 EditCategoriesDialog(Window).open() line: 785 EditCategoriesAction$1.runInUI(IProgressMonitor) line: 77 UIUpdateManager$ForegroundJob.runInUIThread(IProgressMonitor) line: 94 UIJob$1.run() line: 94 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123 Display.runAsyncMessages(boolean) line: 3215 Display.readAndDispatch() line: 2908 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2264 Workbench.runUI() line: 2228 Workbench.access$4(Workbench) line: 2103 Workbench$4.run() line: 457 Realm.runWithDefault(Realm, Runnable) line: 289 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 452 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 101 EclipseAppHandle.run(Object) line: 146 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 354 EclipseStarter.run(String[], Runnable) line: 169 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 339 Main.basicRun(String[]) line: 283 Main.run(String[]) line: 984 Main.main(String[]) line: 959 The culprit seems to be ColumnLabelProvider.update(ViewerCell cell) and CellLabelProvider.createViewerLabelProvider() which simply are not considering the IViewerLabelProvider interface. This is a blocker for us since we are using this interface for most of our label providers.

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerRow.java bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewerRow.java bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerRow.java bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/WrappedViewerLabelProvider.java