public Point getLocationOn(JComponent c) { Point location; if (isRealPopup()) { location = myPopup.getLocationOnScreen(); SwingUtilities.convertPointFromScreen(location, c); } else { if (myCurrentIdeTooltip != null) { Point tipPoint = myCurrentIdeTooltip.getPoint(); Component tipComponent = myCurrentIdeTooltip.getComponent(); return SwingUtilities.convertPoint(tipComponent, tipPoint, c); } else { location = SwingUtilities.convertPoint(myComponent.getParent(), myComponent.getLocation(), c); } } return location; }
@Override public void setLocation(@NotNull RelativePoint point) { if (isRealPopup()) { myPopup.setLocation(point.getScreenPoint()); } else { if (myCurrentIdeTooltip != null) { Point screenPoint = point.getScreenPoint(); if (!screenPoint.equals( new RelativePoint(myCurrentIdeTooltip.getComponent(), myCurrentIdeTooltip.getPoint()) .getScreenPoint())) { myCurrentIdeTooltip.setPoint(point.getPoint()); myCurrentIdeTooltip.setComponent(point.getComponent()); IdeTooltipManager.getInstance().show(myCurrentIdeTooltip, true, false); } } else { Point targetPoint = point.getPoint(myComponent.getParent()); myComponent.setLocation(targetPoint); myComponent.revalidate(); myComponent.repaint(); } } }