From ab4fde46390f5ccde81b22ab7806d370cd8e26ef Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 18 Sep 2025 17:36:56 +0200 Subject: [PATCH] IJPL-191229 remove scheduleReloadState (part 12) GitOrigin-RevId: ffe2cc8cd9036fa8479145dcc1a85c57dcf015b4 --- .../settings/repositoryLibrariesReloader.kt | 2 +- .../src/ComponentStoreImpl.kt | 8 --- .../RunConfigurationIconAndInvalidCache.kt | 4 +- .../intellij/execution/impl/RunManagerImpl.kt | 67 +++++++++++++------ .../SyntheticConfigurationTypeProvider.java | 3 +- .../extensions/ExtensionPointListener.kt | 1 - .../packageSet/PackageSetFactoryImpl.java | 5 +- .../src/com/intellij/ide/impl/ProjectUtil.kt | 15 +++++ .../project/LightEditProjectManager.kt | 2 +- .../platform/PlatformProjectOpenProcessor.kt | 7 +- .../intellij/ui/EditorNotificationsImpl.kt | 2 +- .../configurationStore/NonPersistentStore.kt | 3 - .../components/impl/stores/IComponentStore.kt | 18 ++++- .../intellij/project/TestProjectManager.kt | 2 +- .../testFramework/OpenProjectTaskBuilder.kt | 2 +- .../testFramework/rules/ProjectModelRule.kt | 3 +- 16 files changed, 97 insertions(+), 47 deletions(-) diff --git a/java/idea-ui/src/com/intellij/jarRepository/settings/repositoryLibrariesReloader.kt b/java/idea-ui/src/com/intellij/jarRepository/settings/repositoryLibrariesReloader.kt index fe0dd0963be1..c57f644c6955 100644 --- a/java/idea-ui/src/com/intellij/jarRepository/settings/repositoryLibrariesReloader.kt +++ b/java/idea-ui/src/com/intellij/jarRepository/settings/repositoryLibrariesReloader.kt @@ -17,7 +17,7 @@ import org.jetbrains.idea.maven.utils.library.RepositoryUtils // called in EDT (RemoteRepositoriesConfigurable.apply) @RequiresEdt internal fun reloadAllRepositoryLibraries(project: Project) { - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { val libraries = collectLibraries(project) { (it as? LibraryEx)?.properties is RepositoryLibraryProperties } libraries .asSequence() diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 5f3b5c7546fd..041ff0cb9059 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -789,14 +789,6 @@ abstract class ComponentStoreImpl : IComponentStore { } } - final override fun scheduleReloadState(componentClass: Class>, postAction: Runnable?) { - val componentManager = project ?: ApplicationManager.getApplication() - val pluginScope = (componentManager as ComponentManagerEx).instanceCoroutineScope(componentClass) - pluginScope.launch { - reloadState(componentClass) - } - } - private suspend fun reloadState(componentName: String, changedStorages: Set): Boolean { val info = components.get(componentName) ?: return false val component = info.component diff --git a/platform/execution-impl/src/com/intellij/execution/impl/RunConfigurationIconAndInvalidCache.kt b/platform/execution-impl/src/com/intellij/execution/impl/RunConfigurationIconAndInvalidCache.kt index 9e551fea7bc8..b1ed06dcd771 100644 --- a/platform/execution-impl/src/com/intellij/execution/impl/RunConfigurationIconAndInvalidCache.kt +++ b/platform/execution-impl/src/com/intellij/execution/impl/RunConfigurationIconAndInvalidCache.kt @@ -67,10 +67,10 @@ internal class RunConfigurationIconAndInvalidCache : RunConfigurationIconCache { settings.checkSettings() ProgramRunnerUtil.getConfigurationIcon(settings, false) to false } - catch (e: IndexNotReadyException) { + catch (_: IndexNotReadyException) { ProgramRunnerUtil.getConfigurationIcon(settings, false) to false } - catch (ignored: RuntimeConfigurationException) { + catch (_: RuntimeConfigurationException) { val invalid = !DumbService.isDumb(runManagerImpl.project) ProgramRunnerUtil.getConfigurationIcon(settings, invalid) to invalid } diff --git a/platform/execution-impl/src/com/intellij/execution/impl/RunManagerImpl.kt b/platform/execution-impl/src/com/intellij/execution/impl/RunManagerImpl.kt index 11ed66762fc0..6e6ba80f3bef 100644 --- a/platform/execution-impl/src/com/intellij/execution/impl/RunManagerImpl.kt +++ b/platform/execution-impl/src/com/intellij/execution/impl/RunManagerImpl.kt @@ -36,11 +36,14 @@ import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.UnknownFeat import com.intellij.openapi.util.Computable import com.intellij.openapi.util.Condition import com.intellij.openapi.util.Key -import com.intellij.openapi.util.io.FileUtil +import com.intellij.openapi.util.io.FileUtilRt import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vfs.VirtualFile import com.intellij.platform.backend.workspace.WorkspaceModelChangeListener import com.intellij.platform.backend.workspace.WorkspaceModelTopics +import com.intellij.platform.ide.progress.ModalTaskOwner +import com.intellij.platform.ide.progress.TaskCancellation +import com.intellij.platform.ide.progress.runWithModalProgressBlocking import com.intellij.platform.workspace.jps.entities.ContentRootEntity import com.intellij.platform.workspace.jps.entities.SourceRootEntity import com.intellij.platform.workspace.storage.VersionedStorageChange @@ -61,10 +64,9 @@ import com.intellij.util.text.UniqueNameGenerator import com.intellij.util.text.nullize import com.intellij.util.ui.EDT import com.intellij.util.ui.JBUI -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext +import kotlinx.coroutines.* +import kotlinx.coroutines.sync.Semaphore +import kotlinx.coroutines.sync.withPermit import org.jdom.Element import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.TestOnly @@ -89,7 +91,7 @@ interface RunConfigurationTemplateProvider { fun getRunConfigurationTemplate(factory: ConfigurationFactory, runManager: RunManagerImpl): RunnerAndConfigurationSettingsImpl? } -@State(name = "RunManager", storages = [(Storage(value = StoragePathMacros.WORKSPACE_FILE, useSaveThreshold = ThreeState.NO))]) +@State(name = "RunManager", storages = [Storage(value = StoragePathMacros.WORKSPACE_FILE, useSaveThreshold = ThreeState.NO)]) open class RunManagerImpl @NonInjectable constructor(val project: Project, private val coroutineScope: CoroutineScope, sharedStreamProvider: StreamProvider?) : RunManagerEx(), PersistentStateComponent, Disposable, SettingsSavingComponent { companion object { @@ -167,7 +169,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva get() = listManager.idToSettings // When readExternal not all configuration may be loaded, so we need to remember the selected configuration - // so that when it is eventually loaded, we can mark is as a selected. + // so that when it is eventually loaded, we can mark it as selected. protected open var selectedConfigurationId: String? = null private val iconAndInvalidCache = RunConfigurationIconAndInvalidCache() @@ -179,7 +181,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva private val recentlyUsedTemporaries = ArrayList() - // templates should be first, because to migrate old before a run list to effective, we need to get template before a run task + // templates should be first, because, to migrate old before a run list to effective, we need to get template before a run task private val workspaceSchemeManagerProvider = SchemeManagerIprProvider("configuration", Comparator { n1, n2 -> val w1 = getNameWeight(n1) val w2 = getNameWeight(n2) @@ -200,9 +202,12 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva @Suppress("LeakingThis") private val workspaceSchemeManager = SchemeManagerFactory.getInstance(project).create( directoryName = "workspace", - processor = RunConfigurationSchemeManager(this, templateDifferenceHelper, - isShared = false, - isWrapSchemeIntoComponentElement = false), + processor = RunConfigurationSchemeManager( + manager = this, + templateDifferenceHelper = templateDifferenceHelper, + isShared = false, + isWrapSchemeIntoComponentElement = false, + ), streamProvider = workspaceSchemeManagerProvider, isAutoSave = false, ) @@ -210,16 +215,18 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva @Suppress("LeakingThis") private val projectSchemeManager = SchemeManagerFactory.getInstance(project).create( directoryName = "runConfigurations", - processor = RunConfigurationSchemeManager(this, templateDifferenceHelper, - isShared = true, - isWrapSchemeIntoComponentElement = schemeManagerIprProvider == null), + processor = RunConfigurationSchemeManager( + manager = this, templateDifferenceHelper = templateDifferenceHelper, + isShared = true, + isWrapSchemeIntoComponentElement = schemeManagerIprProvider == null, + ), schemeNameToFileName = OLD_NAME_CONVERTER, streamProvider = sharedStreamProvider ?: schemeManagerIprProvider, ) @Suppress("unused") internal val dotIdeaRunConfigurationsPath: String - get() = FileUtil.toSystemIndependentName(projectSchemeManager.rootDirectory.path) + get() = FileUtilRt.toSystemIndependentName(projectSchemeManager.rootDirectory.path) private val rcInArbitraryFileManager = RCInArbitraryFileManager(project) @@ -237,7 +244,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva get() = project.messageBus.syncPublisher(RunManagerListener.TOPIC) init { - project.messageBus.connect().subscribe(DynamicPluginListener.TOPIC, object : DynamicPluginListener { + project.messageBus.connect(coroutineScope).subscribe(DynamicPluginListener.TOPIC, object : DynamicPluginListener { override fun beforePluginUnload(pluginDescriptor: IdeaPluginDescriptor, isUpdate: Boolean) { iconAndInvalidCache.clear() } @@ -656,7 +663,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva val element = Element("state") if (EDT.isCurrentThreadEdt()) { - runWriteAction { workspaceSchemeManager.save() } + ApplicationManager.getApplication().runWriteAction { workspaceSchemeManager.save() } } else { workspaceSchemeManager.save() @@ -765,7 +772,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva @VisibleForTesting protected open fun onFirstLoadingFinished() { - project.messageBus.connect().subscribe(WorkspaceModelTopics.CHANGED, object : WorkspaceModelChangeListener { + project.messageBus.connect(coroutineScope).subscribe(WorkspaceModelTopics.CHANGED, object : WorkspaceModelChangeListener { override fun changed(event: VersionedStorageChange) { if (event.getChanges(ContentRootEntity::class.java).any() || event.getChanges(SourceRootEntity::class.java).any()) { clearSelectedConfigurationIcon() @@ -780,9 +787,29 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva } ConfigurationType.CONFIGURATION_TYPE_EP.addExtensionPointListener(coroutineScope, object : ExtensionPointListener { + private val semaphore = Semaphore(1) + override fun extensionAdded(extension: ConfigurationType, pluginDescriptor: PluginDescriptor) { idToType.drop() - project.stateStore.scheduleReloadState(RunManagerImpl::class.java) + + val task = suspend { + semaphore.withPermit { + project.stateStore.reloadState(RunManagerImpl::class.java) + } + } + + // plugin unloading is performed in a write action + if (EDT.isCurrentThreadEdt() && !ApplicationManager.getApplication().isWriteAccessAllowed) { + runWithModalProgressBlocking(ModalTaskOwner.project(project), "", TaskCancellation.cancellable()) { + task() + } + } + else { + @Suppress("RAW_RUN_BLOCKING") + runBlocking { + task() + } + } } override fun extensionRemoved(extension: ConfigurationType, pluginDescriptor: PluginDescriptor) { @@ -797,7 +824,7 @@ open class RunManagerImpl @NonInjectable constructor(val project: Project, priva } lock.write { - templateIdToConfiguration.values.removeIf(java.util.function.Predicate { it.type == extension }) + templateIdToConfiguration.values.removeIf { it.type == extension } } } }) diff --git a/platform/execution/src/com/intellij/execution/configurations/SyntheticConfigurationTypeProvider.java b/platform/execution/src/com/intellij/execution/configurations/SyntheticConfigurationTypeProvider.java index e785fe8c1757..f36b32807cb5 100644 --- a/platform/execution/src/com/intellij/execution/configurations/SyntheticConfigurationTypeProvider.java +++ b/platform/execution/src/com/intellij/execution/configurations/SyntheticConfigurationTypeProvider.java @@ -10,9 +10,8 @@ import java.util.Collection; @ApiStatus.Experimental public interface SyntheticConfigurationTypeProvider { - ExtensionPointName EP_NAME = - ExtensionPointName.create("com.intellij.execution.syntheticConfigurationTypeProvider"); + new ExtensionPointName<>("com.intellij.execution.syntheticConfigurationTypeProvider"); @NotNull @Unmodifiable Collection getConfigurationTypes(); diff --git a/platform/extensions/src/com/intellij/openapi/extensions/ExtensionPointListener.kt b/platform/extensions/src/com/intellij/openapi/extensions/ExtensionPointListener.kt index 22e4b0951963..c828eb20d071 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/ExtensionPointListener.kt +++ b/platform/extensions/src/com/intellij/openapi/extensions/ExtensionPointListener.kt @@ -2,7 +2,6 @@ package com.intellij.openapi.extensions interface ExtensionPointListener { - fun extensionAdded(extension: T, pluginDescriptor: PluginDescriptor) {} fun extensionRemoved(extension: T, pluginDescriptor: PluginDescriptor) {} diff --git a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java index abee30fcae5a..1daefec4b004 100644 --- a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java @@ -30,7 +30,10 @@ final class PackageSetFactoryImpl extends PackageSetFactory { public void extensionAdded(@NotNull PackageSetParserExtension extension, @NotNull PluginDescriptor pluginDescriptor) { for (Project project : ProjectUtil.getOpenProjects()) { for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) { - IComponentStoreKt.getStateStore(project).scheduleReloadState(holder.getClass(), holder::fireScopeListeners); + IComponentStoreKt.scheduleReloadState(IComponentStoreKt.getStateStore(project), + holder.getClass(), + holder::fireScopeListeners, + coroutineScope); } } } diff --git a/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.kt b/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.kt index e5406a02d465..39d03f1742a3 100644 --- a/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.kt +++ b/platform/platform-impl/src/com/intellij/ide/impl/ProjectUtil.kt @@ -766,6 +766,21 @@ fun runUnderModalProgressIfIsEdt(task: suspend CoroutineScope.() -> T): T { } } +@Internal +@ScheduledForRemoval +@Deprecated( + "Use runWithModalProgressBlocking on EDT with proper owner and title, " + + "or runBlockingCancellable(+withBackgroundProgress with proper title) on BGT" +) +fun runUnderModalProgressIfIsEdt(project: Project, task: suspend CoroutineScope.() -> T): T { + if (ApplicationManager.getApplication().isDispatchThread) { + return runWithModalProgressBlocking(ModalTaskOwner.project(project), "", TaskCancellation.cancellable(), task) + } + else { + return runBlockingMaybeCancellable(task) + } +} + private fun getActiveWindow(): Window? { val window = KeyboardFocusManager.getCurrentKeyboardFocusManager().activeWindow LOG.trace { "getActiveWindow: active window is $window" } diff --git a/platform/platform-impl/src/com/intellij/ide/lightEdit/project/LightEditProjectManager.kt b/platform/platform-impl/src/com/intellij/ide/lightEdit/project/LightEditProjectManager.kt index 1e1dcd548505..a525e8b8dbe8 100644 --- a/platform/platform-impl/src/com/intellij/ide/lightEdit/project/LightEditProjectManager.kt +++ b/platform/platform-impl/src/com/intellij/ide/lightEdit/project/LightEditProjectManager.kt @@ -21,7 +21,7 @@ private fun fireProjectOpened(project: Project) { val fireRunnable = Runnable { // similar to com.intellij.openapi.project.impl.ProjectManagerExImplKt.openProject app.messageBus.syncPublisher(ProjectManager.TOPIC).projectOpened(project) - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { val startupManager = StartupManager.getInstance(project) as StartupManagerImpl startupManager.initProject() startupManager.runPostStartupActivities() diff --git a/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.kt b/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.kt index ef1606a664ff..e0870f170182 100644 --- a/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.kt +++ b/platform/platform-impl/src/com/intellij/platform/PlatformProjectOpenProcessor.kt @@ -77,7 +77,12 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO @JvmStatic @JvmOverloads @Internal - fun openProjectLegacyJavaApi(virtualFile: VirtualFile, projectToClose: Project?, forceOpenInNewFrame: Boolean, instance: PlatformProjectOpenProcessor? = null): Project? { + fun openProjectLegacyJavaApi( + virtualFile: VirtualFile, + projectToClose: Project?, + forceOpenInNewFrame: Boolean, + instance: PlatformProjectOpenProcessor? = null, + ): Project? { @Suppress("DEPRECATION") // Function has no thread requirements return runUnderModalProgressIfIsEdt { (instance ?: getInstance()).openProjectAsync(virtualFile, projectToClose, forceOpenInNewFrame) } } diff --git a/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt b/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt index e8c00ccd66d4..9baca7863ac4 100644 --- a/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt +++ b/platform/platform-impl/src/com/intellij/ui/EditorNotificationsImpl.kt @@ -137,7 +137,7 @@ class EditorNotificationsImpl(private val project: Project, coroutineScope: Coro fun completeAsyncTasks() { NonBlockingReadActionImpl.waitForAsyncTaskCompletion() @Suppress("DEPRECATION") - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { val parentJob = coroutineScope.coroutineContext[Job]!! while (true) { // process all events in EDT diff --git a/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt b/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt index b1dceeea2a7a..9e2a883d3751 100644 --- a/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt +++ b/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt @@ -28,9 +28,6 @@ object NonPersistentStore : IComponentStore { override suspend fun reloadStates(componentNames: Set) {} - override fun scheduleReloadState(componentClass: Class>, postAction: Runnable?) { - } - override suspend fun reloadState(componentClass: Class>) { } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.kt b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.kt index acd5740c761c..d2cbe1f70d42 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.kt +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IComponentStore.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.components.service import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.util.NlsSafe import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch import org.jetbrains.annotations.ApiStatus.Internal import org.jetbrains.annotations.TestOnly import java.nio.file.Path @@ -33,8 +34,6 @@ interface IComponentStore { suspend fun reloadState(componentClass: Class>) - fun scheduleReloadState(componentClass: Class>, postAction: Runnable? = null) - fun isReloadPossible(componentNames: Set): Boolean suspend fun save(forceSavingAllSettings: Boolean = false) @@ -58,6 +57,21 @@ interface ComponentStoreOwner { val componentStore: IComponentStore } +// for poor code in java +@Deprecated("Use coroutine version") +@Internal +fun scheduleReloadState( + store: IComponentStore, + componentClass: Class>, + postAction: Runnable, + coroutineScope: CoroutineScope, +) { + coroutineScope.launch { + store.reloadState(componentClass) + postAction.run() + } +} + @get:Internal val ComponentManager.stateStore: IComponentStore get() = if (this is ComponentStoreOwner) this.componentStore else this.service() \ No newline at end of file diff --git a/platform/testFramework/src/com/intellij/project/TestProjectManager.kt b/platform/testFramework/src/com/intellij/project/TestProjectManager.kt index 46a49e8405b3..fbec1f69774e 100644 --- a/platform/testFramework/src/com/intellij/project/TestProjectManager.kt +++ b/platform/testFramework/src/com/intellij/project/TestProjectManager.kt @@ -114,7 +114,7 @@ open class TestProjectManager : ProjectManagerImpl() { val app = ApplicationManager.getApplication() try { - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { coroutineScope { runInitProjectActivities(project = project) } diff --git a/platform/testFramework/src/com/intellij/testFramework/OpenProjectTaskBuilder.kt b/platform/testFramework/src/com/intellij/testFramework/OpenProjectTaskBuilder.kt index 7aa9fad8ac22..c9488105047a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/OpenProjectTaskBuilder.kt +++ b/platform/testFramework/src/com/intellij/testFramework/OpenProjectTaskBuilder.kt @@ -13,7 +13,7 @@ import java.util.function.Consumer // todo rewrite PlatformTestUtil to kotlin internal fun saveProject(project: Project, forceSavingAllSettings: Boolean = false) { - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { StoreReloadManager.getInstance(project).reloadChangedStorageFiles() project.stateStore.save(forceSavingAllSettings = forceSavingAllSettings) } diff --git a/platform/testFramework/src/com/intellij/testFramework/rules/ProjectModelRule.kt b/platform/testFramework/src/com/intellij/testFramework/rules/ProjectModelRule.kt index 3e0a470754c8..730f6150df73 100644 --- a/platform/testFramework/src/com/intellij/testFramework/rules/ProjectModelRule.kt +++ b/platform/testFramework/src/com/intellij/testFramework/rules/ProjectModelRule.kt @@ -32,7 +32,6 @@ import com.intellij.testFramework.DisposableRule import com.intellij.testFramework.IndexingTestUtil import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.RuleChain -import com.intellij.util.application import org.jetbrains.jps.model.module.JpsModuleSourceRootType import org.junit.jupiter.api.extension.* import org.junit.rules.ExternalResource @@ -217,7 +216,7 @@ open class ProjectModelRule : TestRule { } fun setUnloadedModules(vararg moduleName: String) { - runUnderModalProgressIfIsEdt { + runUnderModalProgressIfIsEdt(project) { moduleManager.setUnloadedModules(moduleName.toList()) } IndexingTestUtil.waitUntilIndexesAreReady(project)