Buggy code:
public class MacGeneratorUI { MacGenerator gen ; Display display ; Shell shell ; Tree nodesTree ; public MacGeneratorUI ( String [ ] xmls ) { } TreeItem lastParent ; TreeItem addChild ( Node node , TreeItem superItem ) { } void checkPath ( TreeItem item , boolean checked , boolean grayed ) { } void checkItem ( Node node , TreeItem item ) { } void checkChildren ( TreeItem item ) { } void checkItems ( TreeItem item , boolean checked ) { } void cleanup ( ) { } int getColumnFor ( String attribute ) { } public void open ( ) { display = new Display ( ) ; shell = new Shell ( display ) ; shell . setLayout ( new GridLayout ( 2 , false ) ) ; Composite parent = shell ; <START_BUG> nodesTree = new Tree ( parent , ( ( ( SWT . MULTI ) | ( SWT . CHECK ) ) | ( SWT . BORDER ) ) ) ; <END_BUG> nodesTree . setLayoutData ( new GridData ( GridData . FILL_BOTH ) ) ; nodesTree . setHeaderVisible ( true ) ; nodesTree . setLinesVisible ( true ) ; TreeColumn nodesColumn = new TreeColumn ( nodesTree , SWT . NONE ) ; nodesColumn . setText ( "Name" ) ; String [ ] extraAttributes = gen . getExtraAttributeNames ( ) ; for ( int i = 0 ; i < ( extraAttributes . length ) ; i ++ ) { if ( extraAttributes [ i ] . equals ( "swt_gen" ) ) continue ; TreeColumn column = new TreeColumn ( nodesTree , SWT . NONE ) ; column . setText ( extraAttributes [ i ] ) ; } nodesTree . addListener ( Selection , new Listener ( ) { public void handleEvent ( Event event ) { if ( ( event . detail ) != ( SWT . CHECK ) ) return ; TreeItem item = ( ( TreeItem ) ( event . item ) ) ; if ( item == null ) return ; boolean checked = item . getChecked ( ) ; checkItems ( item , checked ) ; checkPath ( item . getParentItem ( ) , checked , false ) ; } } ) ; nodesTree . addListener ( Expand , new Listener ( ) { public void handleEvent ( Event event ) { checkChildren ( ( ( TreeItem ) ( event . item ) ) ) ; } } ) ; final Text editorTx = new Text ( nodesTree , SWT . SINGLE ) ; final TreeEditor editor = new TreeEditor ( nodesTree ) ; editor . grabHorizontal = true ; editor . setEditor ( editorTx ) ; Listener memberTextListener = new Listener ( ) { public void handleEvent ( Event e ) { if ( ( e . type ) == ( SWT . Traverse ) ) { switch ( e . detail ) { case SWT . TRAVERSE_ESCAPE : editor . setItem ( null ) ; break ; default : return ; } } editorTx . setVisible ( false ) ; TreeItem item = editor . getItem ( ) ; if ( item == null ) return ; int column = editor . getColumn ( ) ; String value = editorTx . getText ( ) ; item . setText ( column , value ) ; Element node = ( ( Element ) ( item . getData ( ) ) ) ; String name = nodesTree . getColumn ( column ) . getText ( ) ; if ( ( value . length ( ) ) != 0 ) { node . setAttribute ( name , value ) ; } else { node . removeAttribute ( name ) ; } } } ; editorTx . addListener ( DefaultSelection , memberTextListener ) ; editorTx . addListener ( FocusOut , memberTextListener ) ; editorTx . addListener ( Traverse , memberTextListener ) ; nodesTree . addListener ( MouseDown , new Listener ( ) { public void handleEvent ( final Event e ) { e . display . asyncExec ( new Runnable ( ) { public void run ( ) { if ( nodesTree . isDisposed ( ) ) return ; if ( ( e . button ) != 1 ) return ; Point pt = new Point ( e . x , e . y ) ; TreeItem item = nodesTree . getItem ( pt ) ; if ( item == null ) return ; if ( ! ( ( item . getData ( ) ) instanceof Element ) ) return ; int column = - 1 ; for ( int i = 0 ; i < ( nodesTree . getColumnCount ( ) ) ; i ++ ) { if ( item . getBounds ( i ) . contains ( pt ) ) { column = i ; break ; } } if ( column == ( - 1 ) ) return ; if ( ! ( nodesTree . getColumn ( column ) . getText ( ) . startsWith ( "swt_" ) ) ) return ; editor . setColumn ( column ) ; editor . setItem ( item ) ; editorTx . setText ( item . getText ( column ) ) ; editorTx . selectAll ( ) ; editorTx . setVisible ( true ) ; editorTx . setFocus ( ) ; } } ) ; } } ) ; Composite panel = new Composite ( parent , SWT . NONE ) ; panel . setLayout ( new GridLayout ( 1 , true ) ) ; Button generate = new Button ( panel , SWT . PUSH ) ; generate . setText ( "Generate" ) ; generate . addListener ( Selection , new Listener ( ) { public void handleEvent ( Event event ) { TreeItem [ ] items = nodesTree . getItems ( ) ; for ( int i = 0 ; i < ( items . length ) ; i ++ ) { updateGenAttribute ( items [ i ] ) ; }

Fix:
nodesTree = new Tree ( parent , ( ( ( ( SWT . MULTI ) | ( SWT . CHECK ) ) | ( SWT . BORDER ) ) | ( SWT . FULL_SELECTION ) ) ) ;