copy dir into self check
authoranna <Anna.Kozlova@jetbrains.com>
Wed, 14 Jul 2010 13:13:19 +0000 (17:13 +0400)
committeranna <Anna.Kozlova@jetbrains.com>
Thu, 15 Jul 2010 06:44:08 +0000 (10:44 +0400)
platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java

index 287f49d363411376d2d014d0f18a73b9db49c7c1..e0feed07276eb21882cb6120bdbb7bcce510e1af 100644 (file)
@@ -80,20 +80,12 @@ public class CopyFilesOrDirectoriesHandler implements CopyHandlerDelegate {
     dialog.show();
     if (dialog.isOK()) {
       final String newName = elements.length == 1 ? dialog.getNewName() : null;
-      final PsiManager psiManager = PsiManager.getInstance(project);
       final PsiDirectory targetDirectory = dialog.getTargetDirectory();
       try {
         for (PsiElement element : elements) {
           PsiFileSystemItem psiElement = (PsiFileSystemItem)element;
-          if (newName != null) {
-            if (!psiElement.isDirectory()) {
-              psiElement = (PsiFileSystemItem)psiElement.copy();
-              psiElement.setName(newName);
-              psiManager.checkMove(psiElement, targetDirectory);
-            } else {
-              targetDirectory.checkCreateSubdirectory(newName);
-              MoveFilesOrDirectoriesUtil.checkIfMoveIntoSelf(psiElement, targetDirectory);
-            }
+          if (psiElement.isDirectory()) {
+            MoveFilesOrDirectoriesUtil.checkIfMoveIntoSelf(psiElement, targetDirectory);
           }
         }
       }