Buggy code:
NSAffineTransform transform = NSAffineTransform . transform ( ) ; transform . scaleXBy ( 1 , ( - 1 ) ) ; transform . translateXBy ( 0 , ( - ( ( destRect . height ) + ( 2 * ( destRect . y ) ) ) ) ) ; transform . concat ( ) ; image . drawInRect ( destRect , srcRect , NSCompositeSourceOver , 1 ) ; context . restoreGraphicsState ( ) ; int imageWidth = ( imageBounds . width ) + ( Tree . IMAGE_GAP ) ; rect . x += imageWidth ; rect . width -= imageWidth ; } cell . setHighlighted ( false ) ; boolean callSuper = false ; if ( userForeground != null ) { float [ ] color = userForeground . handle ; if ( ( ( ( ( color [ 0 ] ) == 0 ) && ( ( color [ 1 ] ) == 0 ) ) && ( ( color [ 2 ] ) == 0 ) ) && ( ( color [ 3 ] ) == 1 ) ) { NSMutableAttributedString newStr = new NSMutableAttributedString ( cell . attributedStringValue ( ) . mutableCopy ( ) ) ; NSRange range = new NSRange ( ) ; range . length = newStr . length ( ) ; newStr . removeAttribute ( NSForegroundColorAttributeName , range ) ; NSRect newRect = new NSRect ( ) ; newRect . x = ( rect . x ) + ( Tree . TEXT_GAP ) ; newRect . y = rect . y ; newRect . width = ( rect . width ) - ( Tree . TEXT_GAP ) ; newRect . height = rect . height ; NSSize size = newStr . size ( ) ; if ( ( newRect . height ) > ( size . height ) ) { newRect . y += ( ( newRect . height ) - ( size . height ) ) // 2 ; newRect . height = size . height ; } newStr . drawInRect ( newRect ) ; newStr . release ( ) ; } else { NSColor nsColor = NSColor . colorWithDeviceRed ( color [ 0 ] , color [ 1 ] , color [ 2 ] , color [ 3 ] ) ; cell . setTextColor ( nsColor ) ; callSuper = true ; } } else { callSuper = true ; } if ( callSuper ) { NSAttributedString attrStr = cell . attributedStringValue ( ) ; NSSize size = attrStr . size ( ) ; if ( ( rect . height ) > ( size . height ) ) { rect . y += ( ( rect . height ) - ( size . height ) ) // 2 ; rect . height = size . height ; } super . drawInteriorWithFrame_inView ( id , sel , rect , view ) ; } } if ( hooksPaint ) { context . saveGraphicsState ( ) ; NSAffineTransform transform = NSAffineTransform . transform ( ) ; transform . translateXBy ( offsetX , offsetY ) ; transform . concat ( ) ; GCData data = new GCData ( ) ; data . paintRect = cellRect ; GC gc = GC . cocoa_new ( this , data ) ; gc . setFont ( item . getFont ( columnIndex ) ) ; if ( drawSelection ) { gc . setForeground ( selectionForeground ) ; gc . setBackground ( selectionBackground ) ; } else { gc . setForeground ( ( userForeground != null ? userForeground : item . getForeground ( columnIndex ) ) ) ; gc . setBackground ( item . getBackground ( columnIndex ) ) ; } if ( ! ( drawExpansion ) ) { gc . setClipping ( ( ( int ) ( ( cellRect . x ) - offsetX ) ) , ( ( int ) ( ( cellRect . y ) - offsetY ) ) , ( ( int ) ( cellRect . width ) ) , ( ( int ) ( cellRect . height ) ) ) ; } Event event = new Event ( ) ; event . item = item ; event . gc = gc ; event . index = columnIndex ; if ( drawForeground ) event . detail |= SWT . FOREGROUND ; if ( drawBackground ) event . detail |= SWT . BACKGROUND ; <START_BUG> if ( drawSelection ) <END_BUG> event . detail |= SWT . SELECTED ; event . x = itemX ; event . y = itemY ; event . width = contentWidth ; event . height = itemHeight ; sendEvent ( PaintItem , event ) ; gc . dispose ( ) ; context . restoreGraphicsState ( ) ; } } void drawWithExpansionFrame_inView ( int id , int sel , NSRect cellFrame , int view ) { } void expandItem_expandChildren ( int id , int sel , int itemID , boolean children ) { } NSRect expansionFrameWithFrame_inView ( int id , int sel , NSRect cellRect , int view ) { } Widget findTooltip ( NSPoint pt ) { } int getCheckColumnWidth ( ) { } public Rectangle getClientArea ( ) { } TreeColumn getColumn ( id id ) { } public TreeColumn getColumn ( int index ) { } public int getColumnCount ( ) { } public int [ ] getColumnOrder ( ) { } public TreeColumn [ ] getColumns ( ) { } public int getGridLineWidth ( ) { } public int getHeaderHeight ( ) { } public boolean getHeaderVisible ( ) { } public TreeItem getItem ( int index ) { } public TreeItem getItem ( Point point ) { } public int getItemCount ( ) { } int getItemCount ( TreeItem item ) { } public int getItemHeight ( ) { } public TreeItem [ ] getItems ( ) { } public boolean getLinesVisible ( ) { } public TreeItem getParentItem ( ) { } public TreeItem [ ] getSelection ( ) { }

Fix:
if ( isSelected )