mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] properly update the value of 'ide.experimental.ui' property in early-access-registry.txt (GTW-5443, GTW-5437)
EarlyAccessRegistryManager saves only values of properties which were accessed via it. So if we set a new value for some property before it was accessed, it won't be saved to early-access-registry.txt file. GitOrigin-RevId: 8bb9cbd457d9eba3169db88e9b9a2a80658ec157
This commit is contained in:
committed by
intellij-monorepo-bot
parent
734d4ef50a
commit
7c2ddc3935
@@ -113,6 +113,15 @@ object EarlyAccessRegistryManager {
|
||||
saveConfigFile(map, configFile) { map.get(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates value for registry property which may be accessed via this class.
|
||||
* Use this function instead of the default [RegistryValue.setValue] to ensure that the updated value will be saved to [fileName].
|
||||
*/
|
||||
fun setBoolean(key: String, value: Boolean) {
|
||||
lazyMap.value[key] = value.toString()
|
||||
ApplicationManager.getApplication().serviceIfCreated<RegistryManager>()?.get(key)?.setValue(value)
|
||||
}
|
||||
|
||||
fun syncAndFlush() {
|
||||
// Why do we sync? get (not yet loaded) -> not changed by a user but actually in a registry -> no explicit put
|
||||
// Why maybe in a registry but not in our store?
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.util.registry.EarlyAccessRegistryManager
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.util.PlatformUtils
|
||||
|
||||
/**
|
||||
@@ -114,7 +113,7 @@ private class ExperimentalUIImpl : ExperimentalUI() {
|
||||
private fun saveNewValue(enabled: Boolean) {
|
||||
try {
|
||||
logger.info("Saving newUi=$enabled to registry")
|
||||
Registry.get(KEY).setValue(enabled)
|
||||
EarlyAccessRegistryManager.setBoolean(KEY, enabled)
|
||||
EarlyAccessRegistryManager.syncAndFlush()
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
|
||||
Reference in New Issue
Block a user