label = null;
break;
}
case SWT.MouseHover:
{
Point mouse_position = new Point(event.x, event.y);
TableItem item = buddy_table.getItem( mouse_position );
if (item != null) {
if (tip != null && !tip.isDisposed()){
tip.dispose();
tip = null;
}
int index = buddy_table.indexOf(item);
if ( index < 0 || index >= buddies.size()){
return;
}
BuddyPluginBuddy buddy = (BuddyPluginBuddy)buddies.get(index);
int item_index = 0;
for (int i=0;i<headers.length;i++){
Rectangle bounds = item.getBounds(i);
if ( bounds.contains( mouse_position )){
item_index = i;
break;
}
}
if( item_index != 0 ){
return;
}
tip = new Shell(buddy_table.getShell(), SWT.ON_TOP | SWT.TOOL);
tip.setLayout(new FillLayout());
label = new Label(tip, SWT.NONE);
label.setForeground(buddy_table.getDisplay()
.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(buddy_table.getDisplay()
.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setData("_TABLEITEM", item);
label.setText( getToolTip( buddy ));
label.addListener(SWT.MouseExit, tt_label_listener);
label.addListener(SWT.MouseDown, tt_label_listener);
Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle rect = item.getBounds(item_index);
Point pt = buddy_table.toDisplay(rect.x, rect.y);
tip.setBounds(pt.x, pt.y, size.x, size.y);
tip.setVisible(true);
}
}
}