@Override
  public void doMove(final Project project, final PsiElement[] elements, final PsiElement targetContainer, final MoveCallback callback) {
    if (canMoveOrRearrangePackages(elements) ) {
      final PsiDirectory[] directories = new PsiDirectory[elements.length];
      //canMoveOrRearrangePackages ensures that all elements are directories
      //noinspection SuspiciousSystemArraycopy
      System.arraycopy(elements, 0, directories, 0, directories.length);
      if (directories.length > 1 || targetContainer != null) {
        moveAsDirectory(project, targetContainer, callback, directories);
        return;
      }

      int ret = Messages.showYesNoCancelDialog(project,
                                               JavaBundle.message("where.do.you.want.to.move.directory.prompt", "../" + SymbolPresentationUtil.getFilePathPresentation(directories[0])),
                                               JavaBundle.message("dialog.title.move.directory"), JavaBundle.message("button.to.another.directory"), JavaBundle.message("button.to.another.source.root"), CommonBundle.getCancelButtonText(),
                                               Messages.getQuestionIcon());
      if (ret == Messages.YES) {
        moveAsDirectory(project, null, callback, directories);
      }
      else if (ret == Messages.NO) {
        MoveClassesOrPackagesImpl.doRearrangePackage(project, directories);
      }
      return;
    }

    moveAsPackage(project, elements, targetContainer, callback);
  }
@Override
  public void doMove(final Project project, final PsiElement[] elements, final PsiElement targetContainer, final MoveCallback callback)