allow dumb mode
authorliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 30 Jul 2015 16:51:28 +0000 (19:51 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 30 Jul 2015 16:51:28 +0000 (19:51 +0300)
fix after changes in 70b64b0

python/ide/src/com/jetbrains/python/configuration/PyContentEntriesModuleConfigurable.java

index 1e8c8e24a247ee6afdc73848822a8ded32b18bdb..25acf294458e3110ec6abdb97d96d8111adef79a 100644 (file)
@@ -22,6 +22,7 @@ import com.intellij.openapi.module.impl.ModuleConfigurationStateImpl;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.options.SearchableConfigurable;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.roots.ModifiableRootModel;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider;
@@ -34,6 +35,8 @@ import org.jetbrains.jps.model.java.JavaSourceRootType;
 import javax.swing.*;
 import java.awt.*;
 
+import static com.intellij.openapi.project.DumbModePermission.MAY_START_BACKGROUND;
+
 public class PyContentEntriesModuleConfigurable extends SearchableConfigurable.Parent.Abstract {
   private final Module myModule;
   private final JPanel myTopPanel = new JPanel(new BorderLayout());
@@ -107,10 +110,15 @@ public class PyContentEntriesModuleConfigurable extends SearchableConfigurable.P
     final boolean editorWasModified = myEditor.isModified();
     myEditor.apply();
     if (editorWasModified) {
-      ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      DumbService.getInstance(myModifiableModel.getProject()).allowStartingDumbModeInside(MAY_START_BACKGROUND, new Runnable() {
         @Override
         public void run() {
-          myModifiableModel.commit();
+          ApplicationManager.getApplication().runWriteAction(new Runnable() {
+            @Override
+            public void run() {
+              myModifiableModel.commit();
+            }
+          });
         }
       });
       resetEditor();