Cleanup (incorrect inline)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 8 Sep 2016 20:21:56 +0000 (23:21 +0300)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 8 Sep 2016 20:21:56 +0000 (23:21 +0300)
platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java

index d406a43811371fc3fcc63b01e3375cad2331bf85..81e44a79a1be3cd5849d1fa3f208b206af126104 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.openapi.roots;
 
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ReadAction;
 import com.intellij.openapi.application.WriteAction;
 import com.intellij.openapi.module.Module;
@@ -89,7 +90,7 @@ public class ModuleRootModificationUtil {
       entry.setScope(scope);
       entry.setExported(exported);
 
-      WriteAction.run(libraryModel::commit);
+      ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(model::commit));
     });
   }
 
@@ -133,7 +134,7 @@ public class ModuleRootModificationUtil {
     ModifiableRootModel model = ReadAction.compute(() -> ModuleRootManager.getInstance(module).getModifiableModel());
     try {
       task.consume(model);
-      WriteAction.run(model::commit);
+      ApplicationManager.getApplication().invokeAndWait(() -> WriteAction.run(model::commit));
     }
     catch (RuntimeException | Error e) {
       model.dispose();