void (@NotNull final FocusEvent e) { if (Registry.is("focus.follows.mouse.workarounds")) { if (myFocusPoint != null) { PointerInfo pointerInfo = MouseInfo.getPointerInfo(); if (pointerInfo != null && myFocusPoint.equals(pointerInfo.getLocation())) { // Ignore the loss of focus if the mouse hasn't moved between the last dropdown resize // and the loss of focus event. This happens in focus follows mouse mode if the mouse is // over the dropdown and it resizes to leave the mouse outside the dropdown. IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true); myFocusPoint = null; return; } } myFocusPoint = null; } cancelListUpdater(); // cancel thread as early as possible myHideAlarm.addRequest(() -> { JBPopup popup = JBPopupFactory.getInstance().getChildFocusedPopup(e.getComponent()); if (popup != null) { popup.addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { if (event.isOk()) { hideHint(); } } }); } else { Component oppositeComponent = e.getOppositeComponent(); if (oppositeComponent == myCheckBox) { IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true); return; } if (oppositeComponent != null && !(oppositeComponent instanceof JFrame) && myList.isShowing() && (oppositeComponent == myList || SwingUtilities.isDescendingFrom(myList, oppositeComponent))) { IdeFocusManager.getInstance(myProject).requestFocus(myTextField, true);// Otherwise me may skip some KeyEvents return; } if (isDescendingFromTemporarilyFocusableToolWindow(oppositeComponent)) { return; // Allow toolwindows to gain focus (used by QuickDoc shown in a toolwindow) } if (UIUtil.haveCommonOwner(oppositeComponent, e.getComponent())) { return; } hideHint(); } }, 5); }