Buggy code:
public class ShowViewDialog extends Dialog implements IDoubleClickListener , ISelectionChangedListener { private static final String DIALOG_SETTING_SECTION_NAME = "ShowViewDialog" ; private static final int LIST_HEIGHT = 300 ; private static final int LIST_WIDTH = 250 ; private static final String STORE_EXPANDED_CATEGORIES_ID = ( ShowViewDialog . DIALOG_SETTING_SECTION_NAME ) + ".STORE_EXPANDED_CATEGORIES_ID" ; private static final String STORE_SELECTED_VIEW_ID = ( ShowViewDialog . DIALOG_SETTING_SECTION_NAME ) + ".STORE_SELECTED_VIEW_ID" ; private FilteredTree filteredTree ; private Button okButton ; private IViewDescriptor [ ] viewDescs = new IViewDescriptor [ 0 ] ; private IViewRegistry viewReg ; private IWorkbenchWindow window ; private Color dimmedForeground ; public ShowViewDialog ( IWorkbenchWindow window , IViewRegistry viewReg ) { } protected void buttonPressed ( int buttonId ) { } protected void cancelPressed ( ) { } protected void configureShell ( Shell shell ) { } protected void createButtonsForButtonBar ( Composite parent ) { } protected Control createDialogArea ( Composite parent ) { } private static RGB blend ( RGB c1 , RGB c2 , int ratio ) { } private static int blend ( int v1 , int v2 , int ratio ) { } private void createFilteredTreeViewer ( Composite parent ) { PatternFilter filter = new ViewPatternFilter ( ) ; int styleBits = ( ( ( SWT . MULTI ) | ( SWT . H_SCROLL ) ) | ( SWT . V_SCROLL ) ) | ( SWT . BORDER ) ; filteredTree = new FilteredTree ( parent , styleBits , filter ) ; filteredTree . setBackground ( parent . getDisplay ( ) . getSystemColor ( COLOR_WIDGET_BACKGROUND ) ) ; TreeViewer treeViewer = filteredTree . getViewer ( ) ; Control treeControl = treeViewer . getControl ( ) ; RGB dimmedRGB = ShowViewDialog . blend ( treeControl . getForeground ( ) . getRGB ( ) , treeControl . getBackground ( ) . getRGB ( ) , 60 ) ; dimmedForeground = new Color ( treeControl . getDisplay ( ) , dimmedRGB ) ; treeControl . addDisposeListener ( new DisposeListener ( ) { public void widgetDisposed ( DisposeEvent e ) { dimmedForeground . dispose ( ) ; } } ) ; treeViewer . setLabelProvider ( new ViewLabelProvider ( window , dimmedForeground ) ) ; treeViewer . setContentProvider ( new ViewContentProvider ( ) ) ; <START_BUG> treeViewer . setComparator ( new ViewSorter ( ( ( ViewRegistry ) ( viewReg ) ) ) ) ; <END_BUG> treeViewer . setInput ( viewReg ) ; treeViewer . addSelectionChangedListener ( this ) ; treeViewer . addDoubleClickListener ( this ) ; treeViewer . addFilter ( new CapabilityFilter ( ) ) ; if ( hasAtMostOneView ( filteredTree . getViewer ( ) ) ) { Text filterText = filteredTree . getFilterControl ( ) ; if ( filterText != null ) { filterText . setEnabled ( false ) ; } } applyDialogFont ( filteredTree ) ; } private boolean hasAtMostOneView ( TreeViewer tree ) { } public void doubleClick ( DoubleClickEvent event ) { } protected IDialogSettings getDialogSettings ( ) { } public IViewDescriptor [ ] getSelection ( ) { } private void layoutTopControl ( Control control ) { } protected void restoreWidgetValues ( ) { } protected void saveWidgetValues ( ) { } public void selectionChanged ( SelectionChangedEvent event ) { } protected void updateButtons ( ) { } protected void updateSelection ( SelectionChangedEvent event ) { } }

Fix:
treeViewer . setComparator ( new ViewComparator ( ( ( ViewRegistry ) ( viewReg ) ) ) ) ;