@Override
  public void eventDispatched(AWTEvent event) {
    if (!myIsEnabled.asBoolean()) return;

    MouseEvent me = (MouseEvent) event;
    Component c = me.getComponent();
    if (me.getID() == MouseEvent.MOUSE_ENTERED) {
      boolean canShow = true;
      if (me.getComponent() != myCurrentComponent) {
        canShow = hideCurrent(me, null, null);
      }
      if (canShow) {
        maybeShowFor(c, me);
      }
    } else if (me.getID() == MouseEvent.MOUSE_EXITED) {
      if (me.getComponent() == myCurrentComponent || me.getComponent() == myQueuedComponent) {
        hideCurrent(me, null, null);
      }
    } else if (me.getID() == MouseEvent.MOUSE_MOVED) {
      if (me.getComponent() == myCurrentComponent || me.getComponent() == myQueuedComponent) {
        if (myCurrentTipUi != null && myCurrentTipUi.wasFadedIn()) {
          if (hideCurrent(me, null, null)) {
            maybeShowFor(c, me);
          }
        } else {
          if (!myCurrentTipIsCentered) {
            myX = me.getX();
            myY = me.getY();
            if (c instanceof JComponent
                && ((JComponent) c).getToolTipText(me) == null
                && (myQueuedTooltip == null || !myQueuedTooltip.isHint())) {
              hideCurrent(
                  me, null,
                  null); // There is no tooltip or hint here, let's proceed it as MOUSE_EXITED
            } else {
              maybeShowFor(c, me);
            }
          }
        }
      } else if (myCurrentComponent == null && myQueuedComponent == null) {
        maybeShowFor(c, me);
      }
    } else if (me.getID() == MouseEvent.MOUSE_PRESSED) {
      if (me.getComponent() == myCurrentComponent) {
        hideCurrent(me, null, null);
      }
    } else if (me.getID() == MouseEvent.MOUSE_DRAGGED) {
      hideCurrent(me, null, null);
    }
  }
  public IdeTooltip show(final IdeTooltip tooltip, boolean now, final boolean animationEnabled) {
    myAlarm.cancelAllRequests();

    hideCurrent(null, null, null);

    myQueuedComponent = tooltip.getComponent();
    myQueuedTooltip = tooltip;

    myShowRequest =
        new Runnable() {
          @Override
          public void run() {
            if (myShowRequest == null) {
              return;
            }

            if (myQueuedComponent != tooltip.getComponent()
                || !tooltip.getComponent().isShowing()) {
              hideCurrent(null, null, null, animationEnabled);
              return;
            }

            if (tooltip.beforeShow()) {
              show(tooltip, null, animationEnabled);
            } else {
              hideCurrent(null, null, null, animationEnabled);
            }
          }
        };

    if (now) {
      myShowRequest.run();
    } else {
      myAlarm.addRequest(
          myShowRequest, myShowDelay ? tooltip.getShowDelay() : tooltip.getInitialReshowDelay());
    }

    return tooltip;
  }
 public void hide(@Nullable IdeTooltip tooltip) {
   if (myCurrentTooltip == tooltip || tooltip == null || tooltip == myQueuedTooltip) {
     hideCurrent(null, null, null);
   }
 }