private void elementsSelected(int[] indexes, int modifiers) {
    stopSearching();
    if (indexes.length == 1 && myListModel.isMoreElement(indexes[0])) {
      SearchEverywhereContributor contributor = myListModel.getContributorForIndex(indexes[0]);
      showMoreElements(contributor);
      return;
    }
    if (indexes.length == 1 && myListModel.getElementAt(indexes[0]) instanceof SearchListModel.ResultsNotificationElement) {
      return;
    }

    boolean hasNotificationElement = ContainerUtil.find(
      myListModel.getItems(), element -> element instanceof SearchListModel.ResultsNotificationElement) != null;

    indexes = Arrays.stream(indexes)
      .filter(i -> !myListModel.isMoreElement(i))
      .filter(i -> !(myListModel.getElementAt(i) instanceof SearchListModel.ResultsNotificationElement))
      .toArray();

    String searchText = getSearchPattern();
    if (searchText.startsWith(SearchTopHitProvider.getTopHitAccelerator()) && searchText.contains(" ")) {
      SearchEverywhereUsageTriggerCollector.COMMAND_USED.log(myProject);
    }

    boolean closePopup = false;
    List<Object> selectedItems = new ArrayList<>();
    for (int i : indexes) {
      SearchEverywhereContributor<Object> contributor = myListModel.getContributorForIndex(i);
      Object value = myListModel.getElementAt(i);
      selectedItems.add(value);

      SearchEverywhereContributor<?> effectiveContributor =
        contributor instanceof SearchEverywhereContributorWrapper wrapper ? wrapper.getEffectiveContributor() : contributor;

      String selectedTabContributorID = myHeader.getSelectedTab().getReportableID();
      //noinspection ConstantConditions
      String reportableContributorID = getReportableContributorID(contributor);
      List<EventPair<?>> data = new ArrayList<>();
      data.add(SearchEverywhereUsageTriggerCollector.CONTRIBUTOR_ID_FIELD.with(reportableContributorID));
      if (selectedTabContributorID != null) {
        data.add(SearchEverywhereUsageTriggerCollector.CURRENT_TAB_FIELD.with(selectedTabContributorID));
      }
      data.add(SearchEverywhereUsageTriggerCollector.SELECTED_ITEM_NUMBER.with(hasNotificationElement ? (i - 1) : i));
      data.add(SearchEverywhereUsageTriggerCollector.HAS_ONLY_SIMILAR_ELEMENT.with(hasNotificationElement));
      data.add(SearchEverywhereUsageTriggerCollector.IS_ELEMENT_SEMANTIC.with(
        effectiveContributor instanceof SemanticSearchEverywhereContributor semanticContributor &&
        semanticContributor.isElementSemantic(value)));
      PsiElement psi = toPsi(value);
      if (psi != null) {
        data.add(EventFields.Language.with(psi.getLanguage()));
      }
      SearchEverywhereUsageTriggerCollector.CONTRIBUTOR_ITEM_SELECTED.log(myProject, data);
      closePopup |= contributor.processSelectedItem(value, modifiers, searchText);
    }

    if (myMlService != null) {
      var tabId = myHeader.getSelectedTab().getID();
      var correctIndexes = hasNotificationElement ? Arrays.stream(indexes).map(i -> (i - 1)).toArray() : indexes;
      myMlService.onItemSelected(
        myProject, tabId, correctIndexes, selectedItems, () -> myListModel.getFoundElementsInfo(), closePopup, searchText);
    }

    for (int i : indexes) {
      SearchEverywhereContributor<Object> contributor = myListModel.getContributorForIndex(i);
      String selectedTabContributorID = myHeader.getSelectedTab().getReportableID();
      String reportableContributorID = getReportableContributorID(contributor);
      ContributorsLocalSummary.getInstance().updateContributorsLocalSummary(reportableContributorID,
                                                                            selectedTabContributorID.equals(ALL_CONTRIBUTORS_GROUP_ID));
    }

    if (closePopup) {
      closePopup();
    }
    else {
      ApplicationManager.getApplication().invokeLater(() -> myResultsList.repaint());
    }
  }
private void elementsSelected(int[] indexes, int modifiers)