Buggy code:
static final int DEFAULT_COOLBAR_HEIGHT = 0 ; public CoolBar ( Composite parent , int style ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createItem ( CoolItem item , int index ) { } void createWidget ( ) { } void destroyItem ( CoolItem item ) { } void drawThemeBackground ( int hDC , int hwnd , RECT rect ) { } Control findThemeControl ( ) { } int getMargin ( int index ) { } public CoolItem getItem ( int index ) { } public int getItemCount ( ) { } public int [ ] getItemOrder ( ) { } public CoolItem [ ] getItems ( ) { } public Point [ ] getItemSizes ( ) { } int getLastIndexOfRow ( int index ) { } boolean isLastItemOfRow ( int index ) { } public boolean getLocked ( ) { } public int [ ] getWrapIndices ( ) { } public int indexOf ( CoolItem item ) { } void resizeToPreferredWidth ( int index ) { } void resizeToMaximumWidth ( int index ) { } void releaseChildren ( boolean destroy ) { } void removeControl ( Control control ) { } void setBackgroundPixel ( int pixel ) { } void setForegroundPixel ( int pixel ) { } void setItemColors ( int foreColor , int backColor ) { } public void setItemLayout ( int [ ] itemOrder , int [ ] wrapIndices , Point [ ] sizes ) { } void setItemOrder ( int [ ] itemOrder ) { } void setItemSizes ( Point [ ] sizes ) { } public void setLocked ( boolean locked ) { } public void setWrapIndices ( int [ ] indices ) { } int widgetStyle ( ) { } TCHAR windowClass ( ) { } int windowProc ( ) { } LRESULT WM_COMMAND ( int wParam , int lParam ) { } LRESULT WM_ERASEBKGND ( int wParam , int lParam ) { } LRESULT WM_NOTIFY ( int wParam , int lParam ) { } LRESULT WM_SETREDRAW ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT wmNotifyChild ( NMHDR hdr , int wParam , int lParam ) { switch ( hdr . code ) { case OS . RBN_BEGINDRAG : { int pos = OS . GetMessagePos ( ) ; POINT pt = new POINT ( ) ; OS . POINTSTOPOINT ( pt , pos ) ; OS . ScreenToClient ( handle , pt ) ; int button = ( ( display . lastButton ) != 0 ) ? display . lastButton : 1 ; if ( ! ( sendDragEvent ( button , pt . x , pt . y ) ) ) return LRESULT . ONE ; break ; } case OS . RBN_CHILDSIZE : { NMREBARCHILDSIZE lprbcs = new NMREBARCHILDSIZE ( ) ; OS . MoveMemory ( lprbcs , lParam , sizeof ) ; if ( ( lprbcs . uBand ) != ( - 1 ) ) { CoolItem item = items [ lprbcs . wID ] ; Control control = item . control ; if ( control != null ) { int width = ( lprbcs . rcChild_right ) - ( lprbcs . rcChild_left ) ; int height = ( lprbcs . rcChild_bottom ) - ( lprbcs . rcChild_top ) ; control . setBounds ( lprbcs . rcChild_left , lprbcs . rcChild_top , width , height ) ; } } break ; } case OS . RBN_HEIGHTCHANGE : { if ( ! ( ignoreResize ) ) { Point size = getSize ( ) ; int border = getBorderWidth ( ) ; int barHeight = ( ( int ) ( OS . SendMessage ( handle , RB_GETBARHEIGHT , 0 , 0 ) ) ) ; if ( ( ( style ) & ( SWT . VERTICAL ) ) != 0 ) { setSize ( ( barHeight + ( 2 * border ) ) , size . y ) ; } else { setSize ( size . x , ( barHeight + ( 2 * border ) ) ) ; } } break ; } case OS . RBN_CHEVRONPUSHED : { NMREBARCHEVRON lpnm = new NMREBARCHEVRON ( ) ; OS . MoveMemory ( lpnm , lParam , NMREBARCHEVRON . sizeof ) ; CoolItem item = items [ lpnm . wID ] ; if ( item != null ) { Event event = new Event ( ) ; event . detail = SWT . ARROW ; if ( ( ( style ) & ( SWT . VERTICAL ) ) != 0 ) { event . x = lpnm . right ; event . y = lpnm . top ; } else { event . x = lpnm . left ; event . y = lpnm . bottom ; } <START_BUG> item . postEvent ( Selection , event ) ; <END_BUG> } break ; } case OS . NM_CUSTOMDRAW : { if ( ( OS . COMCTL32_MAJOR ) < 6 ) break ; if ( ( ( findBackgroundControl ( ) ) != null ) || ( ( ( style ) & ( SWT . FLAT ) ) != 0 ) ) { NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW ( ) ; OS . MoveMemory ( nmcd , lParam , NMCUSTOMDRAW . sizeof ) ; switch ( nmcd . dwDrawStage ) { case OS . CDDS_PREERASE : return new LRESULT ( ( ( OS . CDRF_SKIPDEFAULT ) | ( OS . CDRF_NOTIFYPOSTERASE ) ) ) ; case OS . CDDS_POSTERASE : drawBackground ( nmcd . hdc ) ; break ; } } break ; } } return super . wmNotifyChild ( hdr , wParam , lParam ) ; } }

Fix:
item . sendSelectionEvent ( Selection , event , false ) ;