void () { InputEvent inputEvent = null; AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent(); if (event instanceof InputEvent ie && myPopup != null) { Window window = myPopup.getWindow(); if (window != null && UIUtil.isDescendingFrom(ie.getComponent(), window)) { inputEvent = ie; } } cancel(inputEvent); }