mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[settingsDialog] Properly handle reopening settingsTab. Also fixes IJPL-177616
GitOrigin-RevId: c46a609d6f849acab5ef1a71e90e5ee602a9daa4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
22a0a9de3e
commit
8aea6d1d40
+10
-4
@@ -63,9 +63,13 @@ internal class SettingsVirtualFileHolder private constructor(private val project
|
||||
val settingsVirtualFile = settingsFileRef.get()
|
||||
|
||||
if (settingsVirtualFile != null) {
|
||||
val editor = settingsVirtualFile.getOrCreateDialog().editor as? SettingsEditor
|
||||
if (editor != null && toSelect != null) {
|
||||
editor.select(toSelect)
|
||||
val dialogIfCreated = settingsVirtualFile.getIfCreated()
|
||||
if (dialogIfCreated != null) {
|
||||
if (toSelect != null) {
|
||||
(dialogIfCreated.editor as? SettingsEditor)?.select(toSelect)
|
||||
}
|
||||
} else {
|
||||
settingsVirtualFile.initializer = initializer
|
||||
}
|
||||
return@withContext settingsVirtualFile
|
||||
}
|
||||
@@ -81,7 +85,7 @@ internal class SettingsVirtualFileHolder private constructor(private val project
|
||||
return settingsFileRef.getAndSet(null)
|
||||
}
|
||||
|
||||
class SettingsVirtualFile(val project: Project, private val initializer: () -> SettingsDialog) :
|
||||
class SettingsVirtualFile(val project: Project, internal var initializer: () -> SettingsDialog) :
|
||||
LightVirtualFile(CommonBundle.settingsTitle(), SettingsFileType, ""), OptionallyIncluded {
|
||||
private val wasModified = AtomicBoolean()
|
||||
|
||||
@@ -138,6 +142,8 @@ internal class SettingsVirtualFileHolder private constructor(private val project
|
||||
|
||||
fun getOrCreateDialog(): SettingsDialog = dialogLazy.value
|
||||
|
||||
fun getIfCreated(): SettingsDialog? = dialogLazy.valueIfInitialized
|
||||
|
||||
fun isModified(): Boolean {
|
||||
val dialog = dialogLazy.valueIfInitialized ?: return false
|
||||
val settingsEditor = dialog.editor as? SettingsEditor ?: return false
|
||||
|
||||
Reference in New Issue
Block a user