Buggy code:
public final class ColorsAndFontsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String SELECTED_ELEMENT_PREF = "ColorsAndFontsPreferencePage.selectedElement" ; private static final String EXPANDED_ELEMENTS_PREF = "ColorsAndFontsPreferencePage.expandedCategories" ; private static final String EXPANDED_ELEMENTS_TOKEN = "\t" ; private static final char MARKER_CATEGORY = 'T' ; private static final char MARKER_COLOR = 'C' ; private static final char MARKER_FONT = 'F' ; private class ThemeContentProvider implements ITreeContentProvider { private IThemeRegistry registry ; public Object [ ] getChildren ( Object parentElement ) { } private Object [ ] getCategoryChildren ( String categoryId ) { } private boolean parentIsInSameCategory ( ColorDefinition definition ) { } private boolean parentIsInSameCategory ( FontDefinition definition ) { } public Object getParent ( Object element ) { } public boolean hasChildren ( Object element ) { } public Object [ ] getElements ( Object inputElement ) { } public void dispose ( ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } } private class PresentationLabelProvider extends LabelProvider implements IFontProvider { private HashMap fonts = new HashMap ( ) ; private HashMap images = new HashMap ( ) ; private int imageSize = - 1 ; private int usableImageSize = - 1 ; private IPropertyChangeListener listener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { } } ; private Image emptyImage ; public PresentationLabelProvider ( ) { } public void hookListeners ( ) { } public void dispose ( ) { } public void clearFontCache ( ) { } public void clearFontCacheAndUpdate ( ) { } public Font getFont ( Object element ) { } public Image getImage ( Object element ) { } private void ensureImageSize ( ) { } public String getText ( Object element ) { } private boolean isDefault ( IThemeElementDefinition def ) { } } private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle . getBundle ( ColorsAndFontsPreferencePage . class . getName ( ) ) ; private Map categoryMap = new HashMap ( 7 ) ; private Font appliedDialogFont ; private Map colorPreferencesToSet = new HashMap ( 7 ) ; private CascadingColorRegistry colorRegistry ; private Map colorValuesToSet = new HashMap ( 7 ) ; private Composite defaultColorPreview ; private Composite defaultFontPreview ; private Composite defaultNoPreview ; private Font currentFont ; private Color currentColor ; private Canvas colorSampler ; private Canvas fontSampler ; private String fontSampleText ; private List dialogFontWidgets = new ArrayList ( ) ; private Button fontChangeButton ; private Button editDefaultButton ; private Button goToDefaultButton ; private Map fontPreferencesToSet = new HashMap ( 7 ) ; private CascadingFontRegistry fontRegistry ; private Button fontResetButton ; private Button fontSystemButton ; private Map fontValuesToSet = new HashMap ( 7 ) ; private Composite previewComposite ; private Map previewMap = new HashMap ( 7 ) ; private Set previewSet = new HashSet ( 7 ) ; private StackLayout stackLayout ; private final IThemeRegistry themeRegistry ; private ITheme currentTheme ; private ColorsAndFontsPreferencePage . PresentationLabelProvider labelProvider ; private CascadingTheme cascadingTheme ; private IPropertyChangeListener themeChangeListener ; private Workbench workbench ; private FilteredTree tree ; private Text descriptionText ; public ColorsAndFontsPreferencePage ( ) { } public void applyData ( Object data ) { } private void selectAndReveal ( Object selection ) { TreeViewer viewer = tree . getViewer ( ) ; <START_BUG> viewer . setSelection ( new StructuredSelection ( selection ) , true ) ; <END_BUG> viewer . reveal ( selection ) ; viewer . getTree ( ) . setFocus ( ) ; } private static boolean equals ( String string , String string2 ) { } private Button createButton ( Composite parent , String label ) { } private Label createSeparator ( Composite parent ) { } protected Control createContents ( Composite parent ) { } private void createTree ( Composite parent ) { } public void dispose ( ) { } private void clearPreviews ( ) { } private ColorDefinition getColorAncestor ( ColorDefinition definition ) { } private RGB getColorAncestorValue ( ColorDefinition definition ) { } private RGB getColorValue ( ColorDefinition definition ) { } private ColorDefinition [ ] getDescendantColors ( ColorDefinition definition ) { } private FontDefinition [ ] getDescendantFonts ( FontDefinition definition ) { } private FontDefinition getFontAncestor ( FontDefinition definition ) { } private FontData [ ] getFontAncestorValue ( FontDefinition definition ) { } protected FontData [ ] getFontValue ( FontDefinition definition ) { } protected ColorDefinition getSelectedColorDefinition ( ) { } protected FontDefinition getSelectedFontDefinition ( ) { } protected boolean isFontSelected ( ) { } protected boolean isColorSelected ( ) { } private void hookListeners ( ) { } public void init ( IWorkbench aWorkbench ) { } private void updateThemeInfo ( IThemeManager manager ) { } private boolean isDefault ( ColorDefinition definition ) { } private boolean isDefault ( FontDefinition definition ) { } private void myApplyDialogFont ( Control control ) { } protected void performApply ( ) { } private void performColorDefaults ( ) { } private boolean performColorOk ( ) { } protected void performDefaults ( ) { } private void performFontDefaults ( ) { } private boolean performFontOk ( ) { } public boolean performOk ( ) { } private void refreshCategory ( ) { } private boolean resetColor ( ColorDefinition definition ) { } protected boolean resetFont ( FontDefinition definition ) { } protected void setColorPreferenceValue ( ColorDefinition definition , RGB newRGB ) { } private void setDescendantRegistryValues ( ColorDefinition definition , RGB newRGB ) { } private void setDescendantRegistryValues ( FontDefinition definition , FontData [ ] datas ) { } protected void setFontPreferenceValue ( FontDefinition definition , FontData [ ] datas ) { } protected void setRegistryValue ( ColorDefinition definition , RGB newRGB ) { } protected void setRegistryValue ( FontDefinition definition , FontData [ ] datas ) { } private IThemePreview getThemePreview ( ThemeElementCategory category ) throws CoreException { } private ITheme getCascadingTheme ( ) { } private void updateForDialogFontChange ( Font newFont ) { } private void updateTreeSelection ( ISelection selection ) { } private void restoreTreeSelection ( ) { } private void saveTreeSelection ( ) { }

Fix:
viewer . setSelection ( new StructuredSelection ( selection ) , false ) ;