Buggy code:
if ( backgroundOnly ) return false ; if ( orderedIndex == 0 ) { gc . setClipping ( cellBounds ) ; Rectangle expanderBounds = getExpanderBounds ( ) ; Color oldForeground = gc . getForeground ( ) ; gc . setForeground ( parent . getConnectorColor ( ) ) ; int lineX = ( expanderBounds . x ) + ( ( expanderBounds . width ) // 2 ) ; int y2 = expanderBounds . y ; if ( ( items . length ) == 0 ) { y2 += ( expanderBounds . height ) // 2 ; } if ( ( ( parentItem ) != null ) || ( ( getIndex ( ) ) != 0 ) ) { gc . drawLine ( lineX , y , lineX , y2 ) ; } if ( ! ( isLastChild ( ) ) ) { if ( ( items . length ) != 0 ) y2 += expanderBounds . height ; gc . drawLine ( lineX , y2 , lineX , ( y + itemHeight ) ) ; } Point [ ] endpoints = getHconnectorEndpoints ( ) ; gc . drawLine ( endpoints [ 0 ] . x , endpoints [ 0 ] . y , ( ( endpoints [ 1 ] . x ) - ( Tree . MARGIN_IMAGE ) ) , endpoints [ 1 ] . y ) ; TreeItem item = parentItem ; while ( item != null ) { if ( ! ( item . isLastChild ( ) ) ) { Rectangle itemExpanderBounds = item . getExpanderBounds ( ) ; lineX = ( itemExpanderBounds . x ) + ( ( itemExpanderBounds . width ) // 2 ) ; gc . drawLine ( lineX , y , lineX , ( y + itemHeight ) ) ; } item = item . parentItem ; } gc . setForeground ( oldForeground ) ; if ( ( items . length ) > 0 ) { Image image = ( expanded ) ? parent . getExpandedImage ( ) : parent . getCollapsedImage ( ) ; gc . drawImage ( image , expanderBounds . x , expanderBounds . y ) ; } if ( ( ( parent . style ) & ( SWT . CHECK ) ) != 0 ) { Image baseImage = ( grayed ) ? parent . getGrayUncheckedImage ( ) : parent . getUncheckedImage ( ) ; Rectangle checkboxBounds = getCheckboxBounds ( ) ; gc . drawImage ( baseImage , checkboxBounds . x , checkboxBounds . y ) ; if ( checked ) { Image checkmarkImage = parent . getCheckmarkImage ( ) ; Rectangle checkmarkBounds = checkmarkImage . getBounds ( ) ; int xInset = ( ( checkboxBounds . width ) - ( checkmarkBounds . width ) ) // 2 ; int yInset = ( ( checkboxBounds . height ) - ( checkmarkBounds . height ) ) // 2 ; gc . drawImage ( checkmarkImage , ( ( checkboxBounds . x ) + xInset ) , ( ( checkboxBounds . y ) + yInset ) ) ; } } } if ( drawContent ) { Image image = getImage ( columnIndex , false ) ; String text = getDisplayText ( columnIndex ) ; Rectangle imageArea = getImageBounds ( columnIndex ) ; int startX = imageArea . x ; int padding = parent . getCellPadding ( ) ; gc . setClipping ( startX , ( ( ( cellBounds . y ) + padding ) - ( parent . linesVisible ? 1 : 0 ) ) , ( ( cellRightX - startX ) - padding ) , ( ( cellBounds . height ) - ( 2 * ( padding - ( parent . linesVisible ? 1 : 0 ) ) ) ) ) ; if ( image != null ) { Rectangle imageBounds = image . getBounds ( ) ; gc . drawImage ( image , 0 , 0 , imageBounds . width , imageBounds . height , imageArea . x , imageArea . y , imageArea . width , imageArea . height ) ; } if ( ( text . length ( ) ) > 0 ) { gc . setFont ( getFont ( columnIndex , false ) ) ; int fontHeight = getFontHeight ( columnIndex ) ; if ( drawSelection && ( ( orderedIndex == 0 ) || ( ( ( parent . style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) ) { gc . setForeground ( display . getSystemColor ( COLOR_LIST_SELECTION_TEXT ) ) ; } else { <START_BUG> if ( ! isSelected ) { <END_BUG> gc . setForeground ( getForeground ( columnIndex ) ) ; } } x = ( getTextX ( columnIndex ) ) + ( TreeItem . MARGIN_TEXT ) ; gc . drawString ( text , x , ( y + ( ( itemHeight - fontHeight ) // 2 ) ) , true ) ; } } if ( parent . hooks ( PaintItem ) ) { int contentWidth = getContentWidth ( columnIndex ) ; int contentX = getContentX ( columnIndex ) ; gc . setFont ( getFont ( ) ) ; if ( isSelected && ( ( columnIndex == 0 ) || ( ( ( parent . style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) ) { gc . setForeground ( display . getSystemColor ( COLOR_LIST_SELECTION_TEXT ) ) ; gc . setBackground ( display . getSystemColor ( COLOR_LIST_SELECTION ) ) ; } else { gc . setForeground ( getForeground ( columnIndex ) ) ; gc . setBackground ( getBackground ( columnIndex ) ) ; } Event event = new Event ( ) ; event . item = this ; event . gc = gc ; event . index = columnIndex ; if ( isSelected ) event . detail |= SWT . SELECTED ; if ( drawFocus ) event . detail |= SWT . FOCUSED ; event . x = contentX ; event . y = cellBounds . y ; event . width = contentWidth ;

Fix:
if ( ( ! isSelected ) || drawSelection ) {