Remove maven project from project tree when user deletes module.
authorSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Tue, 27 Aug 2013 13:16:56 +0000 (17:16 +0400)
committerSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Tue, 27 Aug 2013 13:51:47 +0000 (17:51 +0400)
 +review CR-IC @Anton.Makeev

plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManagerWatcher.java

index 721908c4870b4a96fbf228ad68cabb7ad67ae338..1d194455ff52de61ecc9263258d627c85e8391ef 100644 (file)
@@ -112,7 +112,16 @@ public class MavenProjectsManagerWatcher {
       @Override
       public void moduleRemoved(Project project, Module module) {
         MavenProject mavenProject = myManager.findProject(module);
-        if (mavenProject != null) myManager.setIgnoredState(Collections.singletonList(mavenProject), true);
+        if (mavenProject != null) {
+          VirtualFile file = mavenProject.getFile();
+
+          if (myManager.isManagedFile(file)) {
+            myManager.removeManagedFiles(Collections.singletonList(file));
+          }
+          else {
+            myManager.setIgnoredState(Collections.singletonList(mavenProject), true);
+          }
+        }
       }
 
       @Override