@NotNull
 private static UsageViewPresentation createPresentation(
     @NotNull PsiElement psiElement,
     @NotNull FindUsagesOptions findUsagesOptions,
     boolean toOpenInNewTab) {
   UsageViewPresentation presentation = new UsageViewPresentation();
   String scopeString =
       findUsagesOptions.searchScope == null
           ? null
           : findUsagesOptions.searchScope.getDisplayName();
   presentation.setScopeText(scopeString);
   String usagesString = generateUsagesString(findUsagesOptions);
   presentation.setUsagesString(usagesString);
   String title =
       scopeString == null
           ? FindBundle.message(
               "find.usages.of.element.panel.title",
               usagesString,
               UsageViewUtil.getLongName(psiElement))
           : FindBundle.message(
               "find.usages.of.element.in.scope.panel.title",
               usagesString,
               UsageViewUtil.getLongName(psiElement),
               scopeString);
   presentation.setTabText(title);
   presentation.setTabName(
       FindBundle.message(
           "find.usages.of.element.tab.name",
           usagesString,
           UsageViewUtil.getShortName(psiElement)));
   presentation.setTargetsNodeText(StringUtil.capitalize(UsageViewUtil.getType(psiElement)));
   presentation.setOpenInNewTab(toOpenInNewTab);
   return 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"));
  }