SearchEverywhereUI (Project project, List<SearchEverywhereContributor<?>> contributors, @Nullable SearchEverywhereSpellingCorrector spellingCorrector) { if (LightEdit.owns(project)) { contributors = ContainerUtil.filter(contributors, (contributor) -> contributor instanceof LightEditCompatible); } SearchEverywhereUI view = new SearchEverywhereUI(project, contributors, myTabsShortcutsMap::get, spellingCorrector); view.setSearchFinishedHandler(() -> { if (isShown()) { myBalloon.cancel(); } }); view.addViewTypeListener(viewType -> { if (!isShown()) { return; } ApplicationManager.getApplication().invokeLater(() -> { if (myBalloon == null || myBalloon.isDisposed()) return; Dimension minSize = view.getMinimumSize(); JBInsets.addTo(minSize, myBalloon.getContent().getInsets()); myBalloon.setMinimumSize(minSize); if (viewType == BigPopupUI.ViewType.SHORT) { myBalloonFullSize = myBalloon.getSize(); JBInsets.removeFrom(myBalloonFullSize, myBalloon.getContent().getInsets()); myBalloon.pack(false, true); } else { if (myBalloonFullSize == null) { myBalloonFullSize = view.getPreferredSize(); JBInsets.addTo(myBalloonFullSize, myBalloon.getContent().getInsets()); } myBalloonFullSize.height = Integer.max(myBalloonFullSize.height, minSize.height); myBalloonFullSize.width = Integer.max(myBalloonFullSize.width, minSize.width); myBalloon.setSize(myBalloonFullSize); } }); }); DumbAwareAction.create(__ -> showHistoryItem(true)) .registerCustomShortcutSet(SearchTextField.SHOW_HISTORY_SHORTCUT, view); DumbAwareAction.create(__ -> showHistoryItem(false)) .registerCustomShortcutSet(SearchTextField.ALT_SHOW_HISTORY_SHORTCUT, view); return view; }