@Override
  public UsageView showUsages(
      UsageInfo[] usages,
      UsageViewPresentation presentation,
      UsageViewManager manager,
      PsiElement[] elements) {
    final List<PsiElement> overridingMethods = new ArrayList<>();
    final List<UsageInfo> others = new ArrayList<>();
    for (UsageInfo usage : usages) {
      if (usage instanceof SafeDeleteOverridingMethodUsageInfo) {
        overridingMethods.add(((SafeDeleteOverridingMethodUsageInfo) usage).getOverridingMethod());
      } else {
        others.add(usage);
      }
    }

    UsageTarget[] targets = new UsageTarget[elements.length + overridingMethods.size()];
    for (int i = 0; i < targets.length; i++) {
      if (i < elements.length) {
        targets[i] = new PsiElement2UsageTargetAdapter(elements[i]);
      } else {
        targets[i] = new PsiElement2UsageTargetAdapter(overridingMethods.get(i - elements.length));
      }
    }

    return manager.showUsages(
        targets,
        UsageInfoToUsageConverter.convert(elements, others.toArray(new UsageInfo[others.size()])),
        presentation);
  }
  private UsageView showUsages(
      UsageInfo[] usages, UsageViewPresentation presentation, UsageViewManager manager) {
    for (SafeDeleteProcessorDelegate delegate :
        Extensions.getExtensions(SafeDeleteProcessorDelegate.EP_NAME)) {
      if (delegate instanceof SafeDeleteProcessorDelegateBase) {
        final UsageView view =
            ((SafeDeleteProcessorDelegateBase) delegate)
                .showUsages(usages, presentation, manager, myElements);
        if (view != null) return view;
      }
    }
    UsageTarget[] targets = new UsageTarget[myElements.length];
    for (int i = 0; i < targets.length; i++) {
      targets[i] = new PsiElement2UsageTargetAdapter(myElements[i]);
    }

    return manager.showUsages(
        targets, UsageInfoToUsageConverter.convert(myElements, usages), presentation);
  }
  private void showUsages(final UsageInfo[] usages) {
    UsageViewPresentation presentation = new UsageViewPresentation();
    presentation.setTabText("Safe Delete Conflicts");
    presentation.setTargetsNodeText(
        RefactoringBundle.message("attempting.to.delete.targets.node.text"));
    presentation.setShowReadOnlyStatusAsRed(true);
    presentation.setShowCancelButton(true);
    presentation.setCodeUsagesString(RefactoringBundle.message("references.found.in.code"));
    presentation.setUsagesInGeneratedCodeString(
        RefactoringBundle.message("references.found.in.generated.code"));
    presentation.setNonCodeUsagesString(
        RefactoringBundle.message("occurrences.found.in.comments.strings.and.non.java.files"));
    presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText"));

    UsageViewManager manager = UsageViewManager.getInstance(myProject);
    final UsageView usageView = showUsages(usages, presentation, manager);
    usageView.addPerformOperationAction(
        new RerunSafeDelete(myProject, myElements, usageView),
        RefactoringBundle.message("retry.command"),
        null,
        RefactoringBundle.message("rerun.safe.delete"));
    usageView.addPerformOperationAction(
        () -> {
          UsageInfo[] preprocessedUsages = usages;
          for (SafeDeleteProcessorDelegate delegate :
              Extensions.getExtensions(SafeDeleteProcessorDelegate.EP_NAME)) {
            preprocessedUsages = delegate.preprocessUsages(myProject, preprocessedUsages);
            if (preprocessedUsages == null) return;
          }
          final UsageInfo[] filteredUsages =
              UsageViewUtil.removeDuplicatedUsages(preprocessedUsages);
          execute(filteredUsages);
        },
        "Delete Anyway",
        RefactoringBundle.message("usageView.need.reRun"),
        RefactoringBundle.message("usageView.doAction"));
  }