IDEA-54922
authorAlexey Kudravtsev <cdr@intellij.com>
Fri, 14 May 2010 09:26:11 +0000 (13:26 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Fri, 14 May 2010 10:15:28 +0000 (14:15 +0400)
java/java-impl/src/com/intellij/application/options/editor/JavaAutoImportOptions.java

index e80ee7188ac430cefadec08402177ae08622c24f..01196d2fdea60e57562ee13bca71fdb6170693c6 100644 (file)
@@ -23,8 +23,13 @@ package com.intellij.application.options.editor;
 import com.intellij.codeInsight.CodeInsightSettings;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
 import com.intellij.openapi.application.ApplicationBundle;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
 import com.intellij.openapi.ui.InputValidator;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.EmptyRunnable;
 import com.intellij.ui.ListUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -142,6 +147,14 @@ public class JavaAutoImportOptions implements AutoImportOptionsProvider {
     daemonSettings.setImportHintEnabled(myCbShowImportPopup.isSelected());
     codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = myCbOptimizeImports.isSelected();
     codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = myCbAddUnambiguousImports.isSelected();
+
+    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      public void run() {
+        for (Project project : ProjectManager.getInstance().getOpenProjects()) {
+          ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
+        }
+      }
+    });
   }
 
   private String[] getExcludedPackages() {