コード例 #1
0
 public void setErrorMessage(String errorMessage) {
   if (tip == null) {
     tip = new ErrorToolTip(getTree().getShell());
   }
   if (errorMessage != "") {
     tip.setVisible(false);
     TreeItem treeItem = getTree().getSelection()[0];
     TreeColumn column = getTree().getColumn(0);
     tip.setText(errorMessage);
     Point location = new Point(column.getWidth(), treeItem.getBounds().y);
     Point controlPoint = getTree().toDisplay(location);
     tip.autoSize();
     tip.setLocation(controlPoint.x, controlPoint.y - tip.getHeight() - 5);
     tip.setVisible(true);
   } else {
     tip.setVisible(false);
   }
 }