private void findUsages(
     @NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor,
     @NotNull final FindUsagesHandler handler,
     final boolean toSkipUsagePanelWhenOneUsage,
     final boolean toOpenInNewTab,
     @NotNull final FindUsagesOptions findUsagesOptions) {
   List<? extends PsiElement> elements = descriptor.getAllElements();
   if (elements.isEmpty()) {
     throw new AssertionError(handler + " " + findUsagesOptions);
   }
   final UsageTarget[] targets = convertToUsageTargets(elements);
   myAnotherManager.searchAndShowUsages(
       targets,
       new Factory<UsageSearcher>() {
         @Override
         public UsageSearcher create() {
           return createUsageSearcher(descriptor, handler, findUsagesOptions, null);
         }
       },
       !toSkipUsagePanelWhenOneUsage,
       true,
       createPresentation(elements.get(0), findUsagesOptions, toOpenInNewTab),
       null);
   addToHistory(elements, findUsagesOptions);
 }
  public void searchAndShowUsages(
      @NotNull UsageViewManager manager,
      @NotNull Factory<UsageSearcher> usageSearcherFactory,
      @NotNull final FindModel findModelCopy,
      @NotNull UsageViewPresentation presentation,
      @NotNull FindUsagesProcessPresentation processPresentation,
      final FindManager findManager) {
    presentation.setMergeDupLinesAvailable(false);
    final ReplaceContext[] context = new ReplaceContext[1];
    manager.searchAndShowUsages(
        new UsageTarget[] {
          new FindInProjectUtil.StringUsageTarget(myProject, findModelCopy.getStringToFind())
        },
        usageSearcherFactory,
        processPresentation,
        presentation,
        new UsageViewManager.UsageViewStateListener() {
          @Override
          public void usageViewCreated(@NotNull UsageView usageView) {
            context[0] = new ReplaceContext(usageView, findModelCopy);
            addReplaceActions(context[0]);
          }

          @Override
          public void findingUsagesFinished(final UsageView usageView) {
            if (context[0] != null && findManager.getFindInProjectModel().isPromptOnReplace()) {
              SwingUtilities.invokeLater(
                  new Runnable() {
                    @Override
                    public void run() {
                      replaceWithPrompt(context[0]);
                      context[0].invalidateExcludedSetCache();
                    }
                  });
            }
          }
        });
  }