Program: 138261
Project: 138261
Buggy source:
private void init(){
  final Listener labelListener=new Listener(){
    public void handleEvent(    Event event){
      Label label=(Label)event.widget;
      Shell shell=label.getShell();
switch (event.type) {
case SWT.MouseDown:
        Event e=new Event();
      e.item=(TreeItem)label.getData(TREEITEM);
    setSelection(new TreeItem[]{(TreeItem)e.item});
  notifyListeners(SWT.Selection,e);
shell.dispose();
setFocus();
break;
case SWT.MouseExit:
shell.dispose();
break;
default :
}
}
}
;
Listener treeListener=new Listener(){
Shell tip=null;
Label label=null;
public void handleEvent(Event event){
switch (event.type) {
case SWT.Dispose:
case SWT.KeyDown:
case SWT.MouseMove:
if (tip == null) {
break;
}
tip.dispose();
tip=null;
label=null;
break;
case SWT.MouseHover:
TreeItem item=getItem(new Point(event.x,event.y));
if (isValidItem(item)) {
if (tip != null && !tip.isDisposed()) {
tip.dispose();
}
tip=new Shell(parent.getShell(),SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tip.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
FillLayout layout=new FillLayout();
layout.marginWidth=2;
tip.setLayout(layout);
label=new Label(tip,SWT.WRAP);
label.setForeground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setData(TREEITEM,item);
String displayedText=getItemTooltipText(item);
label.setText(displayedText);
label.addListener(SWT.MouseExit,labelListener);
label.addListener(SWT.MouseDown,labelListener);
int widthHit=SWT.DEFAULT;
if (displayedText.length() > 100) {
widthHit=500;
}
Point size=tip.computeSize(widthHit,SWT.DEFAULT);
Rectangle rect=item.getBounds(0);
Point pt=toDisplay(rect.x,rect.y);
tip.setBounds(pt.x,pt.y,size.x,size.y);
tip.setVisible(true);
}
default :
}
}
}
;
this.addListener(SWT.Dispose,treeListener);
this.addListener(SWT.KeyDown,treeListener);
this.addListener(SWT.MouseMove,treeListener);
this.addListener(SWT.MouseHover,treeListener);
}

Fixed version (ground truth):
private void init(){
  final Listener labelListener=new Listener(){
    public void handleEvent(    Event event){
      Label label=(Label)event.widget;
      Shell shell=label.getShell();
switch (event.type) {
case SWT.MouseDown:
        Event e=new Event();
      e.item=(TreeItem)label.getData(TREEITEM);
    setSelection(new TreeItem[]{(TreeItem)e.item});
  notifyListeners(SWT.Selection,e);
shell.dispose();
break;
case SWT.MouseExit:
shell.dispose();
break;
default :
}
}
}
;
Listener treeListener=new Listener(){
Shell tip=null;
Label label=null;
public void handleEvent(Event event){
switch (event.type) {
case SWT.Dispose:
case SWT.KeyDown:
case SWT.MouseMove:
if (tip == null) {
break;
}
tip.dispose();
tip=null;
label=null;
break;
case SWT.MouseHover:
TreeItem item=getItem(new Point(event.x,event.y));
if (isValidItem(item)) {
if (tip != null && !tip.isDisposed()) {
tip.dispose();
}
tip=new Shell(parent.getShell(),SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tip.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
FillLayout layout=new FillLayout();
layout.marginWidth=2;
tip.setLayout(layout);
label=new Label(tip,SWT.WRAP);
label.setForeground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setData(TREEITEM,item);
String displayedText=getItemTooltipText(item);
label.setText(displayedText);
label.addListener(SWT.MouseExit,labelListener);
label.addListener(SWT.MouseDown,labelListener);
int widthHit=SWT.DEFAULT;
if (displayedText.length() > 100) {
widthHit=500;
}
Point size=tip.computeSize(widthHit,SWT.DEFAULT);
Rectangle rect=item.getBounds(0);
Point pt=toDisplay(rect.x,rect.y);
tip.setBounds(pt.x,pt.y,size.x,size.y);
tip.setVisible(true);
}
default :
}
}
}
;
this.addListener(SWT.Dispose,treeListener);
this.addListener(SWT.KeyDown,treeListener);
this.addListener(SWT.MouseMove,treeListener);
this.addListener(SWT.MouseHover,treeListener);
}