Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ToolTip


*/
private void disposeTable() {
  if (this.toolTips != null) {
    Iterator cells = this.toolTips.keySet().iterator();
    while (cells.hasNext()) {
      ToolTip toolTip = (ToolTip) this.toolTips.get(cells.next());
      toolTip.dispose();
    }
  }
  this.table.dispose();
  this.tableOrigin = null;
  this.firstLine = null;
View Full Code Here


    /* 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();
        }
      });
    }

View Full Code Here

   * @param component
   *          component above which the tool tip shall be displayed
   */
  public static void showToolTip(int style, String text, String message, final Control component) {
    Shell parent = component.getShell();
    final ToolTip tooltip = new ToolTip(parent, style);
    tooltip.setText(text);
    tooltip.setMessage(message);

    Point componentLocation = component.toDisplay(parent.getLocation());
    tooltip.setLocation(componentLocation.x, componentLocation.y + (component.getSize().y / 2));

    Listener listener = new Listener() {
      public void handleEvent(Event event) {
        tooltip.setVisible(false);
        component.removeListener(SWT.KeyDown, this);
        component.removeListener(SWT.FocusOut, this);
      }
    };
    component.addListener(SWT.KeyDown, listener);
    component.addListener(SWT.FocusOut, listener);

    tooltip.setAutoHide(true);
    tooltip.setVisible(true);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.ToolTip

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.