@NotNull
  Runnable prepareTable(@NotNull Runnable appendMoreUsageRunnable, @NotNull Runnable showInMaximalScopeRunnable,
                        @NotNull ShowUsagesActionHandler actionHandler) {
    SpeedSearchBase<JTable> speedSearch = MySpeedSearch.installOn(this);
    speedSearch.setComparator(new SpeedSearchComparator(false));

    setRowHeight(IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Class).getIconHeight() + 2);
    setShowGrid(false);
    setShowVerticalLines(false);
    setShowHorizontalLines(false);
    setTableHeader(null);
    setAutoResizeMode(AUTO_RESIZE_LAST_COLUMN);
    setIntercellSpacing(new Dimension(0, 0));

    final AtomicReference<java.util.List<Object>> selectedUsages = new AtomicReference<>();
    final AtomicBoolean moreUsagesSelected = new AtomicBoolean();
    final AtomicBoolean outsideScopeUsagesSelected = new AtomicBoolean();
    final AtomicReference<ShowUsagesAction.FilteredOutUsagesNode> filteredOutUsagesSelected = new AtomicReference<>();
    getSelectionModel().addListSelectionListener(e -> {
      selectedUsages.set(null);
      outsideScopeUsagesSelected.set(false);
      moreUsagesSelected.set(false);
      filteredOutUsagesSelected.set(null);
      java.util.List<Object> usages = null;
      //todo List<Usage>
      for (int i : getSelectedRows()) {
        Object value = getValueAt(i, 0);
        if (value instanceof UsageNode) {
          Usage usage = ((UsageNode)value).getUsage();
          if (usage == USAGES_OUTSIDE_SCOPE_SEPARATOR) {
            outsideScopeUsagesSelected.set(true);
            usages = null;
            break;
          }
          if (usage == MORE_USAGES_SEPARATOR) {
            moreUsagesSelected.set(true);
            usages = null;
            break;
          }
          if (usage == USAGES_FILTERED_OUT_SEPARATOR) {
            filteredOutUsagesSelected.set((ShowUsagesAction.FilteredOutUsagesNode)value);
            usages = null;
            break;
          }
          if (usages == null) usages = new ArrayList<>();
          usages.add(usage instanceof UsageInfo2UsageAdapter ? ((UsageInfo2UsageAdapter)usage).getUsageInfo() : usage);
        }
      }

      selectedUsages.set(usages);
    });

    return () -> {
      if (moreUsagesSelected.get()) {
        appendMoreUsageRunnable.run();
        return;
      }
      if (outsideScopeUsagesSelected.get()) {
        showInMaximalScopeRunnable.run();
        return;
      }
      if (filteredOutUsagesSelected.get() != null) {
        filteredOutUsagesSelected.get().onSelected();
        return;
      }

      List<Object> usages = selectedUsages.get();
      if (usages != null) {
        for (Object usage : usages) {
          if (usage instanceof UsageInfo usageInfo) {
            PsiElement selectedElement = usageInfo.getElement();
            if (selectedElement != null) {
              String recentSearchText = speedSearch.getComparator().getRecentSearchText();
              int numberOfLettersTyped = recentSearchText != null ? recentSearchText.length() : 0;
              Project project = selectedElement.getProject();
              ReadAction.nonBlocking(() -> actionHandler.buildFinishEventData(usageInfo)).submit(AppExecutorUtil.getAppExecutorService())
                .onSuccess(finishEventData ->
                             UsageViewStatisticsCollector.logItemChosenInPopupFeatures(project, myUsageView, selectedElement,
                                                                                       finishEventData));
              UsageViewStatisticsCollector.logItemChosen(project, myUsageView, CodeNavigateSource.ShowUsagesPopup, getSelectedRow(),
                                                         getRowCount(),
                                                         numberOfLettersTyped,
                                                         selectedElement.getLanguage(), false);
            }
            UsageViewUtil.navigateTo(usageInfo, true);
          }
          else if (usage instanceof Navigatable) {
            ((Navigatable)usage).navigate(true);
          }
        }
      }
    };
  }
@NotNull
  Runnable prepareTable(@NotNull Runnable appendMoreUsageRunnable, @NotNull Runnable showInMaximalScopeRunnable,
                        @NotNull ShowUsagesActionHandler actionHandler)