/* Use Balloon Tooltip on Windows and Linux */
else {
/* Use a Tooltip to help the user understand the State Semantic */
final ToolTip newStateToolTip = new ToolTip(getShell(), SWT.BALLOON);
newStateToolTip.setMessage(Messages.StateConditionControl_NEW_HINT);
newStateToolTip.setAutoHide(false);
final ToolTip unreadStateToolTip = new ToolTip(getShell(), SWT.BALLOON);
unreadStateToolTip.setMessage(Messages.StateConditionControl_UNREAD_HINT);
unreadStateToolTip.setAutoHide(false);
fNewState.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (fNewState.getSelection() && !fUnreadState.getSelection()) {
Point toolTipLocation = toDisplay(fUnreadState.getLocation());
toolTipLocation.y += fUnreadState.getSize().y;
if (Application.IS_WINDOWS)
toolTipLocation.x += 5;
else if (Application.IS_LINUX)
toolTipLocation.x += 12;
unreadStateToolTip.setLocation(toolTipLocation);
unreadStateToolTip.setVisible(true);
} else {
unreadStateToolTip.setVisible(false);
}
}
});
fUnreadState.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (fUnreadState.getSelection() && !fNewState.getSelection()) {
Point toolTipLocation = toDisplay(fNewState.getLocation());
toolTipLocation.y += fNewState.getSize().y;
if (Application.IS_WINDOWS)
toolTipLocation.x += 5;
else if (Application.IS_LINUX)
toolTipLocation.x += 12;
newStateToolTip.setLocation(toolTipLocation);
newStateToolTip.setVisible(true);
} else {
newStateToolTip.setVisible(false);
}
}
});
fNewState.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
newStateToolTip.setVisible(false);
}
@Override
public void focusLost(FocusEvent e) {
unreadStateToolTip.setVisible(false);
}
});
fUnreadState.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
unreadStateToolTip.setVisible(false);
}
@Override
public void focusLost(FocusEvent e) {
newStateToolTip.setVisible(false);
}
});
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
unreadStateToolTip.dispose();
newStateToolTip.dispose();
}
});
}