void () { MouseAdapter listMouseListener = new MouseAdapter() { private int currentDescriptionIndex = -1; @Override public void mouseClicked(MouseEvent e) { onMouseClicked(e); } @Override public void mouseMoved(MouseEvent e) { int index = myResultsList.locationToIndex(e.getPoint()); indexChanged(index); } @Override public void mouseExited(MouseEvent e) { int index = myResultsList.getSelectedIndex(); indexChanged(index); } private void indexChanged(int index) { if (index != currentDescriptionIndex) { currentDescriptionIndex = index; showDescriptionForIndex(index); } } }; myResultsList.addMouseMotionListener(listMouseListener); myResultsList.addMouseListener(listMouseListener); ScrollingUtil.redirectExpandSelection(myResultsList, mySearchField); Consumer<AnActionEvent> nextTabAction = e -> { myHeader.switchToNextTab(); triggerTabSwitched(e); }; Consumer<AnActionEvent> prevTabAction = e -> { myHeader.switchToPrevTab(); triggerTabSwitched(e); }; registerAction(SearchEverywhereActions.AUTOCOMPLETE_COMMAND, CompleteCommandAction::new); registerAction(SearchEverywhereActions.SWITCH_TO_NEXT_TAB, nextTabAction); registerAction(SearchEverywhereActions.SWITCH_TO_PREV_TAB, prevTabAction); registerAction(IdeActions.ACTION_NEXT_TAB, nextTabAction); registerAction(IdeActions.ACTION_PREVIOUS_TAB, prevTabAction); registerAction(IdeActions.ACTION_SWITCHER, e -> { if (e.getInputEvent().isShiftDown()) { myHeader.switchToPrevTab(); } else { myHeader.switchToNextTab(); } triggerTabSwitched(e); }); registerAction(SearchEverywhereActions.NAVIGATE_TO_NEXT_GROUP, e -> { scrollList(true); SearchEverywhereUsageTriggerCollector.GROUP_NAVIGATE.log(myProject, e); }); registerAction(SearchEverywhereActions.NAVIGATE_TO_PREV_GROUP, e -> { scrollList(false); SearchEverywhereUsageTriggerCollector.GROUP_NAVIGATE.log(myProject, e); }); registerSelectItemAction(); AnAction escape = ActionManager.getInstance().getAction("EditorEscape"); DumbAwareAction.create(__ -> sendStatisticsAndClose()) .registerCustomShortcutSet(escape == null ? CommonShortcuts.ESCAPE : escape.getShortcutSet(), this); mySearchField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { String newSearchString = getSearchPattern(); if (myNotFoundString != null) { boolean newPatternContainsPrevious = myNotFoundString.length() > 1 && newSearchString.contains(myNotFoundString); if (myHeader.canSetEverywhere() && myHeader.isEverywhere() && !newPatternContainsPrevious) { myNotFoundString = null; myHeader.autoSetEverywhere(false); return; } } scheduleRebuildList(SearchRestartReason.TEXT_CHANGED); } }); myResultsList.addListSelectionListener(e -> { Object selectedValue = myResultsList.getSelectedValue(); if (selectedValue != null && myHint != null && myHint.isVisible()) { updateHint(selectedValue); } showDescriptionForIndex(myResultsList.getSelectedIndex()); if (isExtendedInfoEnabled()) { if (selectedValue != null && myExtendedInfoComponent != null) { myExtendedInfoComponent.updateElement(selectedValue, this); } } if (isPreviewEnabled() && myProject != null && selectedValue != null && myUsagePreviewPanel != null) { schedulePreview(selectedValue); } }); MessageBusConnection busConnection = myProject != null ? myProject.getMessageBus().connect(this) : ApplicationManager.getApplication().getMessageBus().connect(this); busConnection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void exitDumbMode() { ApplicationManager.getApplication().invokeLater(() -> { updateSearchFieldAdvertisement(); scheduleRebuildList(SearchRestartReason.EXIT_DUMB_MODE); }); } }); (myProject == null ? busConnection : ApplicationManager.getApplication().getMessageBus().connect(this)) .subscribe(ProgressWindow.TOPIC, pw -> Disposer.register(pw, () -> myResultsList.repaint())); mySearchField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { Component oppositeComponent = e.getOppositeComponent(); if (!isHintComponent(oppositeComponent) && !UIUtil.haveCommonOwner(SearchEverywhereUI.this, oppositeComponent)) { sendStatisticsAndClose(); } } }); }