Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.ToolTip


    /* 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 property a TechnicalProperty
   */
  protected void addDefaultVertifyListener(final Control control,
      final TechnicalProperty property) {

    final ToolTip tip = new ToolTip(control.getShell(), SWT.BALLOON
        | SWT.ICON_ERROR);
    if (control instanceof Combo) {

      ((Combo) control).addVerifyListener(new VerifyListener() {


        @Override
        public void verifyText(VerifyEvent e) {
          String text = ((Combo) control).getText(); // calculate new
                                // text
          text = text.substring(0, e.start) + e.text
              + text.substring(e.end, text.length());
          String errorMsg = ConstraintValueValidator.validateValue(
              text, property);
          if (errorMsg != null) {

            tip.setMessage(errorMsg);
            tip.setAutoHide(true);
            tip.setVisible(true);
            ((Combo) control).setBackground( invalidBackgroundColor);
            ((Combo) control).setForeground( Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
            hasValidValue = false;
          } else {
            tip.setVisible(false);
            ((Combo) control).setBackground( Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
            ((Combo) control).setForeground( Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            hasValidValue = true;
          }
        }
      });
    } else if (control instanceof Text) {
      ((Text) control).addVerifyListener(new VerifyListener() {

        @Override
        public void verifyText(VerifyEvent e) {
          String text = ((Text) control).getText(); // calculate new
                                // text
          text = text.substring(0, e.start) + e.text
              + text.substring(e.end, text.length());
          String errorMsg = ConstraintValueValidator.validateValue(
              text, property);
          if (errorMsg != null) {
            tip.setMessage(errorMsg);
            tip.setAutoHide(true);
            tip.setVisible(true);
            ((Text) control).setBackground(invalidBackgroundColor);
            ((Text) control).setForeground( Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
            hasValidValue = false;
          } else {
            tip.setVisible(false);
            ((Text) control).setBackground( Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
            ((Text) control).setForeground( Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
            hasValidValue = true;
          }
        }
View Full Code Here

        trayItem.setImage(new Image(parent.getDisplay(), "img/at.png"));

        String message = "Existem novas atualiza��es disponiveis para download. \nPara maiores informa��es clique aqui.";
        trayItem.setToolTipText(message);
       
        final ToolTip tip = new ToolTip(parent.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION);
      tip.setMessage(message);
      tip.setText("Atualiza��o do Gerente Digital.");
      trayItem.setToolTip(tip);
      tip.setVisible(true);
       
        trayItem.addListener (SWT.Selection, new Listener () {
            public void handleEvent (Event event) {
                new UpdateUI(information.getUpdateList());
            }
        });

        tip.addListener (SWT.Selection, new Listener () {
          public void handleEvent (Event event) {
            new UpdateUI(information.getUpdateList());
          }
        });
  }
View Full Code Here

        trayItem.setImage(new Image(parent.getDisplay(), "img/icoKey.png"));

        String message = "Esta copia do Gerente Digital vai expirar em "+ Anakin.getInstance().getTheForceFoneTime() +" dias. \nClique aqui para ativar na internet.";
        trayItem.setToolTipText(message);
       
        final ToolTip tip = new ToolTip(parent.getShell(), SWT.BALLOON | SWT.ICON_WARNING);
      tip.setMessage(message);
      tip.setText("Ativa��o do Gerente Digital.");
      trayItem.setToolTip(tip);
      tip.setVisible(true);
       
        trayItem.addListener (SWT.Selection, new Listener () {
            public void handleEvent (Event event) {
                new ContactTheDarkSide(new Shell(), getMySelf()).open();
            }
        });

        tip.addListener (SWT.Selection, new Listener () {
          public void handleEvent (Event event) {
            new ContactTheDarkSide(new Shell(), getMySelf()).open();
          }
        });
  }
View Full Code Here

        trayItem.setImage(new Image(parent.getDisplay(), "img/at.png"));

        String message = "Existem novas atualiza��es do Gerente Digital\n disponiveis para download.";
        trayItem.setToolTipText(message);
       
        final ToolTip tip = new ToolTip(parent.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION);
      tip.setMessage(message);
      tip.setText("Atualiza��o do Gerente Digital.");
      trayItem.setToolTip(tip);
      tip.setVisible(true);
       
        trayItem.addListener (SWT.Selection, new Listener () {
            public void handleEvent (Event event) {
                new UpdateUI(information.getUpdateList());
            }
        });

        tip.addListener (SWT.Selection, new Listener () {
          public void handleEvent (Event event) {
            new UpdateUI(information.getUpdateList());
          }
        });
  }
View Full Code Here

  /**
   * Shows an informational "balloon tip" at the bottom of the screen
   */
  private void showUrlBox() {
    Rectangle bounds = shell.getDisplay().getPrimaryMonitor().getClientArea();
    ToolTip tip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_INFORMATION);
    tip.setAutoHide(true);
    tip.setText("Your selection has been copied to to Mystic Paste");
    tip.setMessage("The Url is on your clipboard");
    tip.setLocation(bounds.width, bounds.height);
    tip.setVisible(true);
   
  }
View Full Code Here

      return menu.getParent();
    } else if (widget instanceof ScrollBar) {
      ScrollBar item = (ScrollBar) widget;
      return item.getParent();
    } else if (widget instanceof ToolTip) {
      ToolTip item = (ToolTip) widget;
      return item.getParent();
    } else if (widget instanceof CoolItem) {
      CoolItem item = (CoolItem) widget;
      return item.getParent();
    } else if (widget instanceof CTabItem) {
      CTabItem item = (CTabItem) widget;
      return item.getParent();
    } else if (widget instanceof ExpandItem) {
      ExpandItem item = (ExpandItem) widget;
      return item.getParent();
    } else if (widget instanceof TabItem) {
      TabItem item = (TabItem) widget;
      return item.getParent();
    } else if (widget instanceof TableColumn) {
      TableColumn item = (TableColumn) widget;
      return item.getParent();
    } else if (widget instanceof TableItem) {
      TableItem item = (TableItem) widget;
      return item.getParent();
    } else if (widget instanceof TableTreeItem) {
      TableTreeItem item = (TableTreeItem) widget;
      return item.getParent();
    } else if (widget instanceof ToolItem) {
      ToolItem item = (ToolItem) widget;
      return item.getParent();
    } else if (widget instanceof TreeColumn) {
      TreeColumn item = (TreeColumn) widget;
      return item.getParent();
    } else if (widget instanceof TreeItem) {
      TreeItem item = (TreeItem) widget;
      return item.getParent();
    } else if (widget instanceof Caret) {
      Caret item = (Caret) widget;
      return item.getParent();
    }
    return null;
  }
View Full Code Here

      style |= SWT.ICON_INFORMATION;
    if (iconWarningButton.getSelection())
      style |= SWT.ICON_WARNING;

    /* Create the example widgets */
    toolTip1 = new ToolTip(shell, style);
    toolTip1.setText(ControlExample.getResourceString("ToolTip_Title"));
    toolTip1.setMessage(ControlExample.getResourceString("Example_string"));
  }
View Full Code Here

        this.currentTooltip.setVisible(false);
        this.currentTooltip = null;
      }
      Point cellPosition = currentCellPosition(e.x, e.y);
      if (cellPosition != null) {
        ToolTip tooltip = (ToolTip) ConfigTab.this.toolTips.get(cellPosition);
        if (tooltip != null) {
          Point location = ConfigTab.this.table.toDisplay(new Point(e.x, e.y));
          tooltip.setLocation(location);
          tooltip.setVisible(true);
          this.currentTooltip = tooltip;
        }
      }
    }
    public void mouseEnter(MouseEvent e) {
View Full Code Here

/*
* Create and store a tooltip with the given information and at the given position.
*/
void createToolTip(String toolTipText, String toolTipMessage, int toolTipStyle, Point position) {
  ToolTip toolTip = new ToolTip(this.table.getShell(), toolTipStyle);
  toolTip.setAutoHide(true);
  toolTip.setText(toolTipText);
  toolTip.setMessage(/*"("+col+","+row+") "+*/toolTipMessage);
  this.toolTips.put(position, toolTip);
}
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.