[VCS] VcsVFSListener.beforeDeletion: don't ask to delete from VCS if file is ignored...
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 9 Jun 2010 10:23:45 +0000 (14:23 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 9 Jun 2010 10:23:45 +0000 (14:23 +0400)
platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java

index 1e1d3aadfab5abbb5ecd1ad614c9fab8acbbd5bb..c8272d12d5c5583e6ade2fdafd543d29f0b1b4cc 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.openapi.vcs.actions.VcsContextFactory;
 import com.intellij.openapi.vcs.changes.ChangeListManager;
 import com.intellij.openapi.vfs.*;
 import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
+import com.intellij.vcsUtil.VcsUtil;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
@@ -235,8 +236,21 @@ public abstract class VcsVFSListener implements Disposable {
     }
 
     public void beforeFileDeletion(final VirtualFileEvent event) {
-      if (!isEventIgnored(event)) {
-        addFileToDelete(event.getFile());
+      final VirtualFile file = event.getFile();
+      if (isEventIgnored(event)) { return; }
+      if (!myChangeListManager.isIgnoredFile(file)) {
+        addFileToDelete(file);
+        return;
+      }
+      // files are ignored, directories are handled recursively
+      if (event.getFile().isDirectory()) {
+        final List<VirtualFile> list = new LinkedList<VirtualFile>();
+        VcsUtil.collectFiles(file, list, true, isDirectoryVersioningSupported());
+        for (VirtualFile child : list) {
+          if (!myChangeListManager.isIgnoredFile(child)) {
+            addFileToDelete(child);
+          }
+        }
       }
     }