private void initTooltip() {
   if (tooltip == null) {
     tooltip = new DefaultToolTip(canvasContainer);
     tooltip.deactivate();
     tooltip.setHideOnMouseDown(true);
   }
 }
  public void controlResized(ControlEvent e) {

    if (isChecked()) {
      int rate = window.getCurrentZoomRate();
      Rectangle rectangle = tracker.getRectangles()[0];
      Point realSize =
          new Point(getRealValue(rectangle.width, rate), getRealValue(rectangle.height, rate));
      // Point p = new Point( point.x + tracker.getRectangles()[ 0 ].width, point.y +
      // tracker.getRectangles()[ 0 ].height );
      //			canvas.setToolTipText( getMessage(
      //					"action.tracker.canvas.tooltip",
      //					"" + rectangle.width,
      //					"" + rectangle.height,
      //					"" + realSize.x,
      //					"" + realSize.y
      //			) );
      tooltip.setText(
          getMessage(
              "action.tracker.canvas.tooltip",
              "" + rectangle.width,
              "" + rectangle.height,
              "" + realSize.x,
              "" + realSize.y));
      tooltip.show(point);
    }
  }
Exemple #3
0
 /*
  * (non-Javadoc)
  * @see org.eclipse.jface.viewers.ICellEditorListener#editorValueChanged(boolean, boolean)
  */
 @Override
 public void editorValueChanged(boolean oldValidState, boolean newValidState) {
   if (!newValidState) {
     // If it is an invalid input, then display a tool tip showing the error.
     if (tooltip == null) {
       tooltip = new DefaultToolTip(editor.getControl(), ToolTip.RECREATE, true);
       tooltip.setImage(UIPlugin.getImage(ImageConsts.ERROR_IMAGE));
     }
     tooltip.setText(editor.getErrorMessage());
     Control control = editor.getControl();
     Point pOnScr = control.getSize();
     pOnScr.x = 0;
     tooltip.show(pOnScr);
   } else {
     // Dispose the tool tip if it is valid.
     disposeToolTip();
   }
 }
  public void mouseMove(MouseEvent e) {

    if (isChecked()) {
      // System.out.println( "canvas mouse move" );
      // TODO should have better solution!
      Control c = (Control) e.getSource();
      // c.setCursor( window.CURSOR_CROSS );

      tooltip.hide();
    }
  }
  public Snippet031TableStaticTooltip(Shell shell) {
    final TableViewer v = new TableViewer(shell, SWT.BORDER | SWT.FULL_SELECTION);
    v.setLabelProvider(new MyLabelProvider());
    v.setContentProvider(new MyContentProvider());

    TableColumn column = new TableColumn(v.getTable(), SWT.NONE);
    column.setWidth(200);
    column.setText("Column 1");

    column = new TableColumn(v.getTable(), SWT.NONE);
    column.setWidth(200);
    column.setText("Column 2");

    MyModel[] model = createModel();
    v.setInput(model);
    v.getTable().setLinesVisible(true);
    v.getTable().setHeaderVisible(true);

    DefaultToolTip toolTip = new DefaultToolTip(v.getControl(), ToolTip.NO_RECREATE, false);
    toolTip.setText("Hello World\nHello World");
    toolTip.setBackgroundColor(v.getTable().getDisplay().getSystemColor(SWT.COLOR_RED));
    toolTip.setShift(new Point(10, 5));
  }
Exemple #6
0
 /** Dispose the tool tip used to display error message. */
 private void disposeToolTip() {
   if (tooltip != null) {
     tooltip.hide();
     tooltip = null;
   }
 }