mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
listen changes only after initial synchronizeSchemesAndRunConfigurations
This commit is contained in:
+24
-11
@@ -22,6 +22,7 @@ import com.intellij.openapi.options.SchemeManagerFactory
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.StartupActivity
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.Pair
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import gnu.trove.THashSet
|
||||
@@ -33,17 +34,7 @@ internal class ProjectRunConfigurationStartupActivity : StartupActivity, DumbAwa
|
||||
return
|
||||
}
|
||||
|
||||
val eventPublisher = createRunManagerEventPublisher(project)
|
||||
eventPublisher.beginUpdate()
|
||||
try {
|
||||
RunManagerImpl.getInstanceImpl(project)
|
||||
ServiceManager.getService(project, ProjectRunConfigurationManager::class.java)
|
||||
// important, especially for AppCode ("hack" (projectOpened listener) in the OCWorkspaceRunConfigurationListener removed in favour of platform fix)
|
||||
eventPublisher.runConfigurationSelected()
|
||||
}
|
||||
finally {
|
||||
eventPublisher.endUpdate()
|
||||
}
|
||||
requestLoadWorkspaceAndProjectRunConfiguration(project)
|
||||
|
||||
if (!Registry.`is`("runManager.use.schemeManager", false)) {
|
||||
return
|
||||
@@ -57,6 +48,28 @@ internal class ProjectRunConfigurationStartupActivity : StartupActivity, DumbAwa
|
||||
}
|
||||
}
|
||||
|
||||
private val isInitializedKey = Key.create<Boolean>("RunManagerInitialized")
|
||||
|
||||
fun requestLoadWorkspaceAndProjectRunConfiguration(project: Project) {
|
||||
if (isInitializedKey.isIn(project)) {
|
||||
return
|
||||
}
|
||||
|
||||
isInitializedKey.set(project, true)
|
||||
|
||||
val eventPublisher = createRunManagerEventPublisher(project)
|
||||
eventPublisher.beginUpdate()
|
||||
try {
|
||||
RunManagerImpl.getInstanceImpl(project)
|
||||
ServiceManager.getService(project, ProjectRunConfigurationManager::class.java)
|
||||
// important, especially for AppCode ("hack" (projectOpened listener) in the OCWorkspaceRunConfigurationListener removed in favour of platform fix)
|
||||
eventPublisher.runConfigurationSelected()
|
||||
}
|
||||
finally {
|
||||
eventPublisher.endUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
@State(name = "ProjectRunConfigurationManager", storages = arrayOf(Storage(value = "runConfigurations", stateSplitter = ProjectRunConfigurationManager.RunConfigurationStateSplitter::class)))
|
||||
internal class ProjectRunConfigurationManager(manager: RunManager) : PersistentStateComponent<Element> {
|
||||
private val manager = manager as RunManagerImpl
|
||||
|
||||
@@ -625,7 +625,14 @@ open class RunManagerImpl(internal val project: Project) : RunManagerEx(), Persi
|
||||
}
|
||||
name
|
||||
}
|
||||
workspaceSchemeManager.reload()
|
||||
|
||||
try {
|
||||
eventPublisher.beginUpdate()
|
||||
workspaceSchemeManager.reload()
|
||||
}
|
||||
finally {
|
||||
eventPublisher.endUpdate()
|
||||
}
|
||||
|
||||
val order = ArrayList<String>()
|
||||
@Suppress("DEPRECATION")
|
||||
|
||||
Reference in New Issue
Block a user