Buggy code:
public class ContainerSelectionGroup extends Composite { private Listener listener ; private boolean allowNewContainerName = true ; private boolean showClosedProjects = true ; private IContainer selectedContainer ; private Text containerNameField ; TreeViewer treeViewer ; private static final String DEFAULT_MSG_NEW_ALLOWED = WorkbenchMessages . getString ( "ContainerGroup.message" ) ; private static final String DEFAULT_MSG_SELECT_ONLY = WorkbenchMessages . getString ( "ContainerGroup.selectFolder" ) ; private static final int SIZING_SELECTION_PANE_WIDTH = 320 ; private static final int SIZING_SELECTION_PANE_HEIGHT = 300 ; public ContainerSelectionGroup ( Composite parent , Listener listener , boolean allowNewContainerName ) { } public ContainerSelectionGroup ( Composite parent , Listener listener , boolean allowNewContainerName , String message ) { } public ContainerSelectionGroup ( Composite parent , Listener listener , boolean allowNewContainerName , String message , boolean showClosedProjects ) { } public ContainerSelectionGroup ( Composite parent , Listener listener , boolean allowNewContainerName , String message , boolean showClosedProjects , int heightHint ) { } public void containerSelectionChanged ( IContainer container ) { } public void createContents ( String message ) { } public void createContents ( String message , int heightHint ) { } protected void createTreeViewer ( int heightHint ) { DrillDownComposite drillDown = new DrillDownComposite ( this , SWT . BORDER ) ; GridData spec = new GridData ( ( ( ( ( GridData . VERTICAL_ALIGN_FILL ) | ( GridData . HORIZONTAL_ALIGN_FILL ) ) | ( GridData . GRAB_HORIZONTAL ) ) | ( GridData . GRAB_VERTICAL ) ) ) ; spec . widthHint = ContainerSelectionGroup . SIZING_SELECTION_PANE_WIDTH ; spec . heightHint = heightHint ; drillDown . setLayoutData ( spec ) ; treeViewer = new TreeViewer ( drillDown , SWT . NONE ) ; drillDown . setChildTree ( treeViewer ) ; ContainerContentProvider cp = new ContainerContentProvider ( ) ; cp . showClosedProjects ( showClosedProjects ) ; treeViewer . setContentProvider ( cp ) ; treeViewer . setLabelProvider ( WorkbenchLabelProvider . getDecoratingWorkbenchLabelProvider ( ) ) ; <START_BUG> treeViewer . setSorter ( new ViewerSorter ( ) { } ) ; <END_BUG> treeViewer . addSelectionChangedListener ( new ISelectionChangedListener ( ) { public void selectionChanged ( SelectionChangedEvent event ) { IStructuredSelection selection = ( ( IStructuredSelection ) ( event . getSelection ( ) ) ) ; containerSelectionChanged ( ( ( IContainer ) ( selection . getFirstElement ( ) ) ) ) ; } } ) ; treeViewer . addDoubleClickListener ( new IDoubleClickListener ( ) { public void doubleClick ( DoubleClickEvent event ) { ISelection selection = event . getSelection ( ) ; if ( selection instanceof IStructuredSelection ) { Object item = ( ( IStructuredSelection ) ( selection ) ) . getFirstElement ( ) ; if ( treeViewer . getExpandedState ( item ) ) treeViewer . collapseToLevel ( item , 1 ) ; else treeViewer . expandToLevel ( item , 1 ) ; } } } ) ; treeViewer . setInput ( ResourcesPlugin . getWorkspace ( ) ) ; } public IPath getContainerFullPath ( ) { } public void setInitialFocus ( ) { } public void setSelectedContainer ( IContainer container ) { } }

Fix:
treeViewer . setSorter ( new ViewerSorter ( ) ) ;