@Nullable
  private PsiClass findOrCreateTargetClass(final PsiManager manager, final String fqName) throws IncorrectOperationException {
    final String className;
    final String packageName;
    int dotIndex = fqName.lastIndexOf('.');
    if (dotIndex >= 0) {
      packageName = fqName.substring(0, dotIndex);
      className = (dotIndex + 1 < fqName.length())? fqName.substring(dotIndex + 1) : "";
    }
    else {
      packageName = "";
      className = fqName;
    }


    PsiClass aClass = 
      ActionUtil.underModalProgress(myProject, JavaBundle.message("progress.title.checking.if.class.exists", fqName), 
                                    () -> JavaPsiFacade.getInstance(manager.getProject()).findClass(fqName, GlobalSearchScope.projectScope(myProject)));
    if (aClass != null) return aClass;

    final PsiDirectory directory = PackageUtil.findOrCreateDirectoryForPackage(
                myProject,
                packageName,
                mySourceClass.getContainingFile().getContainingDirectory(),
                true);

    if (directory == null) {
      return null;
    }

    int answer = Messages.showYesNoDialog(
      myProject,
      RefactoringBundle.message("class.0.does.not.exist", fqName),
      MoveMembersImpl.getRefactoringName(),
      Messages.getQuestionIcon()
    );
    if (answer != Messages.YES) return null;
    final Ref<IncorrectOperationException> eRef = new Ref<>();
    final PsiClass newClass = WriteAction.compute(() -> {
      try {
        return JavaDirectoryService.getInstance().createClass(directory, className);
      }
      catch (IncorrectOperationException e) {
        eRef.set(e);
        return null;
      }
    });
    if (!eRef.isNull()) throw eRef.get();
    return newClass;
  }
@Nullable
  private PsiClass findOrCreateTargetClass(final PsiManager manager, final String fqName)