public static void highlightElements(final @NotNull Collection<? extends PsiElement> elementCollection,
                                       @NlsContexts.StatusBarText String statusBarText,
                                       @Nullable Editor editor) {
    if (elementCollection.isEmpty()) {
      return;
    }

    if (!checkEditor(editor)) return;

    if (elementCollection.contains(null)) {
      throw new IllegalArgumentException("Nulls passed in collection: " + elementCollection);
    }
    final Application application = ApplicationManager.getApplication();
    application.invokeLater(() -> {
      final PsiElement[] elements = PsiUtilCore.toPsiElementArray(elementCollection);
      if (ContainerUtil.exists(elements, element -> !element.isValid())) {
        return;
      }
      final PsiElement firstElement = elements[0];
      final Project project = firstElement.getProject();
      if (project.isDisposed() || editor.isDisposed()) return;
      HighlightManager.getInstance(project).addOccurrenceHighlights(editor, elements, EditorColors.SEARCH_RESULT_ATTRIBUTES, true, null);
      WindowManager.getInstance().getStatusBar(project).setInfo(statusBarText);
      final FindManager findmanager = FindManager.getInstance(project);
      FindModel findmodel = findmanager.getFindNextModel();
      if (findmodel == null) {
        findmodel = findmanager.getFindInFileModel();
      }
      findmodel.setSearchHighlighters(true);
      findmanager.setFindWasPerformed();
      findmanager.setFindNextModel(findmodel);
    });
  }
public static void highlightElements(final @NotNull Collection<? extends PsiElement> elementCollection,
                                       @NlsContexts.StatusBarText String statusBarText,
                                       @Nullable Editor editor)