public void focusLost(final FocusEvent e) { if (myPanel.getProject().isDisposed()) { myPanel.setContextComponent(null); myPanel.hideHint(); return; } final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent()); shouldFocusEditor = dialog != null; if (dialog != null) { Disposer.register( dialog.getDisposable(), new Disposable() { @Override public void dispose() { if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) { shouldFocusEditor = false; } } }); } // required invokeLater since in current call sequence KeyboardFocusManager is not initialized // yet // but future focused component //noinspection SSBasedInspection SwingUtilities.invokeLater( new Runnable() { public void run() { processFocusLost(e); } }); }
@Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { if (shouldSkipAction(action)) return; if (myPanel.isInFloatingMode()) { myPanel.hideHint(); } else { myPanel.cancelPopup(); } }
private void processFocusLost(FocusEvent e) { final Component opposite = e.getOppositeComponent(); if (myPanel.isInFloatingMode() && opposite != null && DialogWrapper.findInstance(opposite) != null) { myPanel.hideHint(); return; } final boolean nodePopupInactive = !myPanel.isNodePopupActive(); boolean childPopupInactive = !JBPopupFactory.getInstance().isChildPopupFocused(myPanel); if (nodePopupInactive && childPopupInactive) { if (opposite != null && opposite != myPanel && !myPanel.isAncestorOf(opposite) && !e.isTemporary()) { myPanel.setContextComponent(null); myPanel.hideHint(); } } myPanel.updateItems(); }