void (LightweightHint hint) { Disposable disposable = Disposer.newDisposable(); IdeEventQueue.getInstance().addDispatcher(e -> { if (e.getID() == MouseEvent.MOUSE_PRESSED) { myKeepHint = true; Disposer.dispose(disposable); } else if (e.getID() == MouseEvent.MOUSE_MOVED && !hint.isInsideHint(new RelativePoint((MouseEvent)e))) { hint.hide(); Disposer.dispose(disposable); } return false; }, disposable); }