Project: Eclipse_Platform_UI
Bug 82496 [Preferences] Custom PreferenceNode fails in R3.1 M4
Reported: 2005-01-10 13:17:50 | Status: verified fixed

!ENTRY org.eclipse.core.runtime 4 2 2005-01-10 12:53:50.312 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.runtime". !STACK 0 java.lang.ClassCastException: com.ibm.lpex.alef.LpexViewPreferenceNode at org.eclipse.ui.internal.dialogs.GroupedPreferenceLabelProvider.getBackground(GroupedPreferenceLabelProvider.java:55) at org.eclipse.jface.viewers.StructuredViewer$ColorAndFontCollector.setFontsAndColors(StructuredViewer.java:200) at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java:104) . . . I'm adding PreferenceNodes dynamically to the Workbench preference dialog. R3.1 M4 fails in (at least) GroupedPreferenceLabelProvider#getBackground(), which only expects internal WorkbenchPreferenceNode or WorkbenchPreferenceGroup for their #isHighlighted() method: public Color getBackground(Object element) { boolean highlight = false; if(element instanceof WorkbenchPreferenceNode) highlight = ((WorkbenchPreferenceNode)element).isHighlighted(); else highlight = ((WorkbenchPreferenceGroup)element).isHighlighted(); . . . } Either #isHighlighted() should be part of the regular PreferenceNode, or GroupedPreferenceLabelProvider should survive a regular PreferenceNode...

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GroupedPreferenceLabelProvider.java