[wsm] IJPL-178632 Separate JpsGlobalModelLoadedListener by environment

Pass `InternalEnvironmentName` through the JPS global model loaded flow and gate the Ruby `SdkRefresher` listener to `InternalEnvironmentName.Local`, preventing the "This method may be invoked only once per session." exception. The listener now ignores non‑local environments. Applying the logic there is postponed until it's adapted to use the eel context.


(cherry picked from commit 9ee29949ed6322d6f08484d9411f70bc5595c90b)

IJ-CR-179816

GitOrigin-RevId: 0e0a93fd83f2354c2e67c811f6c7d2993d1a6b49
This commit is contained in:
Alexander Koshevoy
2025-10-24 14:30:44 +00:00
committed by intellij-monorepo-bot
parent bd581c16ff
commit c6650705f4
2 changed files with 4 additions and 3 deletions
@@ -241,7 +241,7 @@ open class JpsGlobalModelSynchronizerImpl(private val coroutineScope: CoroutineS
}
}
// Notify the listeners that synchronization process completed
ApplicationManager.getApplication().messageBus.syncPublisher(JpsGlobalModelLoadedListener.LOADED).loaded()
ApplicationManager.getApplication().messageBus.syncPublisher(JpsGlobalModelLoadedListener.LOADED).loaded(environmentName)
}
private fun loadGlobalEntitiesToEmptyStorage(
@@ -295,7 +295,7 @@ open class JpsGlobalModelSynchronizerImpl(private val coroutineScope: CoroutineS
callbacks.forEach { it.invoke() }
if (notifyListeners) {
// Notify the listeners that synchronization process completed
ApplicationManager.getApplication().messageBus.syncPublisher(JpsGlobalModelLoadedListener.LOADED).loaded()
ApplicationManager.getApplication().messageBus.syncPublisher(JpsGlobalModelLoadedListener.LOADED).loaded(environmentName)
}
}
}
@@ -1,6 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.workspaceModel.ide
import com.intellij.platform.workspace.storage.InternalEnvironmentName
import com.intellij.util.messages.Topic
import org.jetbrains.annotations.ApiStatus
import java.util.*
@@ -8,7 +9,7 @@ import java.util.*
@ApiStatus.Internal
interface JpsGlobalModelLoadedListener : EventListener {
/** This method will be executed right after JPS global model loading e.g., SDK or global libraries */
fun loaded()
fun loaded(environmentName: InternalEnvironmentName)
companion object {
@Topic.AppLevel