private static @NotNull Predicate<? super Usage> originUsageCheck(@Nullable Editor editor) {
    if (editor != null) {
      PsiReference reference = TargetElementUtil.findReference(editor);
      if (reference != null) {
        UsageInfo originUsageInfo = new UsageInfo(reference);
        return usage -> usage instanceof UsageInfo2UsageAdapter &&
                        ((UsageInfo2UsageAdapter)usage).getUsageInfo().equals(originUsageInfo);
      }

      VirtualFile file = editor.getVirtualFile();
      int offset = editor.getCaretModel().getOffset();
      if (file == null || offset <= 0) {
        return __ -> false;
      }

      int line = editor.getDocument().getLineNumber(offset);
      return usage -> {
        if (usage instanceof Psi2UsageInfo2UsageAdapter adapter) {
          if (line != adapter.getLine() || !file.equals(adapter.getFile())) {
            return false;
          }

          for (UsageInfo info : adapter.getMergedInfos()) {
            Segment range = doIfNotNull(info.getPsiFileRange(), it -> ReadAction.compute(it::getRange));
            if (range != null && range.getStartOffset() <= offset && offset <= range.getEndOffset()) {
              return true;
            }
          }
        }

        return false;
      };
    }
    return __ -> false;
  }
private static @NotNull Predicate<? super Usage> originUsageCheck(@Nullable Editor editor)