@SuppressWarnings("UnusedReturnValue")
  public static boolean chooseAmbiguousTarget(@NotNull Editor editor,
                                              int offset,
                                              @NotNull PsiElementProcessor<? super PsiElement> processor,
                                              @NotNull @PopupTitle String titlePattern,
                                              final PsiElement @Nullable [] elements) {
    if (TargetElementUtil.inVirtualSpace(editor, offset)) {
      return false;
    }

    Ref<PsiReference> ref = Ref.create();
    return new PsiTargetNavigator<>(() -> {
      PsiReference reference = TargetElementUtil.findReference(editor, offset);
      ref.set(reference);
      if (elements == null || elements.length == 0) {
        return reference == null ? Collections.emptyList() : suggestCandidates(reference);
      }
      return Arrays.asList(elements);
    }).elementsConsumer((elements1, navigator) -> {
      String title = getTitle(titlePattern, elements1, ref.get());
      navigator.title(title);
    }).navigate(editor, null, element -> processor.execute(element));
  }
@SuppressWarnings("UnusedReturnValue")
  public static boolean chooseAmbiguousTarget(@NotNull Editor editor,
                                              int offset,
                                              @NotNull PsiElementProcessor<? super PsiElement> processor,
                                              @NotNull @PopupTitle String titlePattern,
                                              final PsiElement @Nullable [] elements)