ModifiableRootModel (@NotNull final Module module) { RootConfigurationAccessor rootConfigurationAccessor = new RootConfigurationAccessor() { @Nullable @Override public Library getLibrary(Library library, String libraryName, String libraryLevel) { if (LibraryTablesRegistrar.PROJECT_LEVEL.equals(libraryLevel)) { return getModifiableProjectLibrariesModel().getLibraryByName(libraryName); } return library; } }; return ReadAction.compute(() -> { ModuleRootManagerEx rootManager = ModuleRootManagerEx.getInstanceEx(module); return ((ModuleRootComponentBridge)rootManager).getModifiableModel(getActualStorageBuilder(), rootConfigurationAccessor); }); }