diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java index c3a86415f80e..8d8a924b4f9b 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/LocalFileSystemTest.java @@ -288,7 +288,7 @@ public class LocalFileSystemTest extends PlatformLangTestCase { LocalFileSystem local = LocalFileSystem.getInstance(); VirtualFile virtualDir = local.findFileByIoFile(testDir); - assert virtualDir != null : virtualDir; + assert virtualDir != null : testDir; virtualDir.getChildren(); virtualDir.refresh(false, true); checkChildCount(virtualDir, 1); diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java index 1dea81030f5c..980123ed0a1a 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java @@ -21,6 +21,7 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.libraries.Library; import com.intellij.util.Consumer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collections; @@ -118,7 +119,7 @@ public class ModuleRootModificationUtil { }); } - private static void updateModel(Module module, Consumer task) { + public static void updateModel(@NotNull Module module, @NotNull Consumer task) { final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel(); try { task.consume(model); diff --git a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java index 90057524a345..7d3567902f14 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java @@ -54,6 +54,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; +import static com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel; + @NonNls public class PsiTestUtil { public static VirtualFile createTestProjectStructure(Project project, @@ -400,28 +402,4 @@ public class PsiTestUtil { } }); } - - private static void updateModel(Module module, Consumer task) { - updateModel(ModuleRootManager.getInstance(module).getModifiableModel(), task); - } - - private static void updateModel(ModifiableRootModel model, Consumer task) { - try { - task.consume(model); - commitModel(model); - } - catch (Throwable t) { - model.dispose(); - throw new RuntimeException(t); - } - } - - private static void commitModel(final ModifiableRootModel model) { - new WriteCommandAction.Simple(model.getProject()) { - @Override - protected void run() throws Throwable { - model.commit(); - } - }.execute().throwException(); - } } \ No newline at end of file