Buggy code:
public int getSelectionCount ( ) { } public TreeColumn getSortColumn ( ) { } public int getSortDirection ( ) { } public TreeItem getTopItem ( ) { } int helpProc ( int inControl , int inGlobalMouse , int inRequest , int outContentProvided , int ioHelpContent ) { } int hitTestProc ( int browser , int id , int property , int theRect , int mouseRect ) { } void hookEvents ( ) { } public int indexOf ( TreeColumn column ) { } public int indexOf ( TreeItem item ) { } int _indexOf ( TreeItem parentItem , TreeItem item ) { } int itemCompareProc ( int browser , int itemOne , int itemTwo , int sortProperty ) { } int itemDataProc ( int browser , int id , int property , int itemData , int setValue ) { } int itemNotificationProc ( int browser , int id , int message ) { } int kEventControlGetClickActivation ( int nextHandler , int theEvent , int userData ) { } int kEventControlSetCursor ( int nextHandler , int theEvent , int userData ) { } int kEventUnicodeKeyPressed ( int nextHandler , int theEvent , int userData ) { } int kEventMouseDown ( int nextHandler , int theEvent , int userData ) { int result = super . kEventMouseDown ( nextHandler , theEvent , userData ) ; if ( result == ( OS . noErr ) ) return result ; Display display = this . display ; Control oldFocus = display . getFocusControl ( ) ; display . ignoreFocus = true ; wasSelected = wasExpanded = false ; result = OS . CallNextEventHandler ( nextHandler , theEvent ) ; display . ignoreFocus = false ; if ( oldFocus != ( this ) ) { if ( ( oldFocus != null ) && ( ! ( oldFocus . isDisposed ( ) ) ) ) oldFocus . sendFocusEvent ( FocusOut , false ) ; if ( ( ! ( isDisposed ( ) ) ) && ( isEnabled ( ) ) ) sendFocusEvent ( FocusIn , false ) ; } if ( isDisposed ( ) ) return OS . noErr ; if ( ( ! ( wasSelected ) ) && ( ! ( wasExpanded ) ) ) { if ( OS . IsDataBrowserItemSelected ( handle , lastHittest ) ) { if ( ( 0 < ( lastHittest ) ) && ( ( lastHittest ) <= ( items . length ) ) ) { Event event = new Event ( ) ; event . item = _getItem ( lastHittest , true ) ; postEvent ( Selection , event ) ; } } } if ( wasExpanded ) { org . eclipse . swt . internal . carbon . Point outPt = new org . eclipse . swt . internal . carbon . Point ( ) ; OS . GetGlobalMouse ( outPt ) ; Rect rect = new Rect ( ) ; int window = OS . GetControlOwner ( handle ) ; int x ; int y ; if ( OS . HIVIEW ) { CGPoint pt = new CGPoint ( ) ; pt . x = outPt . h ; pt . y = outPt . v ; OS . HIViewConvertPoint ( pt , 0 , handle ) ; x = ( ( int ) ( pt . x ) ) ; y = ( ( int ) ( pt . y ) ) ; OS . GetWindowBounds ( window , ( ( short ) ( kWindowStructureRgn ) ) , rect ) ; } else { OS . GetControlBounds ( handle , rect ) ; x = ( outPt . h ) - ( rect . left ) ; y = ( outPt . v ) - ( rect . top ) ; OS . GetWindowBounds ( window , ( ( short ) ( kWindowContentRgn ) ) , rect ) ; } x -= rect . left ; y -= rect . top ; short [ ] button = new short [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamMouseButton , typeMouseButton , null , 2 , null , button ) ; int chord = OS . GetCurrentEventButtonState ( ) ; int modifiers = OS . GetCurrentEventKeyModifiers ( ) ; <START_BUG> sendMouseEvent ( MouseUp , button [ 0 ] , true , chord , ( ( short ) ( x ) ) , ( ( short ) ( y ) ) , modifiers ) ; <END_BUG> } wasSelected = wasExpanded = false ; return result ; } void releaseItem ( TreeItem item , boolean release ) { } void releaseItems ( int [ ] ids ) { } void releaseChildren ( boolean destroy ) { } void releaseWidget ( ) { } public void removeAll ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void removeTreeListener ( TreeListener listener ) { } void resetVisibleRegion ( int control ) { } public void setInsertMark ( TreeItem item , boolean before ) { } public void selectAll ( ) { } void setBackground ( float [ ] color ) { } int setBounds ( int x , int y , int width , int height , boolean move , boolean resize , boolean events ) { } public void setColumnOrder ( int [ ] order ) { } void setFontStyle ( Font font ) { } public void setHeaderVisible ( boolean show ) { } public void setItemCount ( int count ) { } void setItemCount ( TreeItem parentItem , int count ) { } void setItemHeight ( int itemHeight ) { } void setItemHeight ( Image image ) { } public void setLinesVisible ( boolean show ) { } public void setRedraw ( boolean redraw ) { } boolean setScrollWidth ( TreeItem item ) { } boolean setScrollWidth ( boolean set ) { } public void setSelection ( TreeItem item ) { } public void setSelection ( TreeItem [ ] items ) { }

Fix:
sendMouseEvent ( MouseUp , button [ 0 ] , display . clickCount , true , chord , ( ( short ) ( x ) ) , ( ( short ) ( y ) ) , modifiers ) ;