public boolean checkConflicts(final ExtractSuperclassDialog dialog) {
   final MemberInfo[] infos =
       ArrayUtil.toObjectArray(dialog.getSelectedMemberInfos(), MemberInfo.class);
   final PsiDirectory targetDirectory = dialog.getTargetDirectory();
   final PsiPackage targetPackage;
   if (targetDirectory != null) {
     targetPackage = JavaDirectoryService.getInstance().getPackage(targetDirectory);
   } else {
     targetPackage = null;
   }
   final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
   if (!ProgressManager.getInstance()
       .runProcessWithProgressSynchronously(
           new Runnable() {
             public void run() {
               final PsiClass superClass =
                   mySubclass.getExtendsListTypes().length > 0 ? mySubclass.getSuperClass() : null;
               conflicts.putAllValues(
                   PullUpConflictsUtil.checkConflicts(
                       infos,
                       mySubclass,
                       superClass,
                       targetPackage,
                       targetDirectory,
                       dialog.getContainmentVerifier(),
                       false));
             }
           },
           RefactoringBundle.message("detecting.possible.conflicts"),
           true,
           myProject)) return false;
   ExtractSuperClassUtil.checkSuperAccessible(targetDirectory, conflicts, mySubclass);
   return ExtractSuperClassUtil.showConflicts(dialog, conflicts, myProject);
 }
  // invoked inside Command and Atomic action
  private void doRefactoring(
      final Project project, final PsiClass subclass, final ExtractSuperclassDialog dialog) {
    final String superclassName = dialog.getExtractedSuperName();
    final PsiDirectory targetDirectory = dialog.getTargetDirectory();
    final MemberInfo[] selectedMemberInfos =
        ArrayUtil.toObjectArray(dialog.getSelectedMemberInfos(), MemberInfo.class);
    final DocCommentPolicy javaDocPolicy = new DocCommentPolicy(dialog.getDocCommentPolicy());
    LocalHistoryAction a =
        LocalHistory.getInstance().startAction(getCommandName(subclass, superclassName));
    try {
      final PsiClass superclass;

      try {
        superclass =
            ExtractSuperClassUtil.extractSuperClass(
                project,
                targetDirectory,
                superclassName,
                subclass,
                selectedMemberInfos,
                javaDocPolicy);
      } finally {
        a.finish();
      }

      // ask whether to search references to subclass and turn them into refs to superclass if
      // possible
      if (superclass != null) {
        final SmartPsiElementPointer<PsiClass> classPointer =
            SmartPointerManager.getInstance(project).createSmartPsiElementPointer(subclass);
        final SmartPsiElementPointer<PsiClass> interfacePointer =
            SmartPointerManager.getInstance(project).createSmartPsiElementPointer(superclass);
        final Runnable turnRefsToSuperRunnable =
            new Runnable() {
              public void run() {
                ExtractClassUtil.askAndTurnRefsToSuper(project, classPointer, interfacePointer);
              }
            };
        SwingUtilities.invokeLater(turnRefsToSuperRunnable);
      }
    } catch (IncorrectOperationException e) {
      LOG.error(e);
    }
  }