mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-331405 Hide IntelliJ Light from new UI and replace to Light with light header if it was installed
GitOrigin-RevId: 57219591e8b71260969dcfe160bc07febc927f0c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
17217c72e9
commit
2c9e6d6595
@@ -241,6 +241,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
}
|
||||
|
||||
override fun loadState(element: Element) {
|
||||
replaceThemeIfSelected(element)
|
||||
autodetect = element.getAttributeBooleanValue(ATTRIBUTE_AUTODETECT)
|
||||
preferredLightThemeId = element.getChild(ELEMENT_PREFERRED_LIGHT_LAF)?.getAttributeValue(ATTRIBUTE_THEME_NAME)
|
||||
preferredDarkThemeId = element.getChild(ELEMENT_PREFERRED_DARK_LAF)?.getAttributeValue(ATTRIBUTE_THEME_NAME)
|
||||
@@ -344,6 +345,22 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
return element
|
||||
}
|
||||
|
||||
//IDEA-331405 Hide IntelliJ Light from new UI
|
||||
private fun replaceThemeIfSelected(element: Element) {
|
||||
val replacementThemeId = "ExperimentalLight"
|
||||
val newThemeId = "ExperimentalLightWithLightHeader"
|
||||
val prefLightThemeElement = element.getChild(ELEMENT_PREFERRED_LIGHT_LAF)
|
||||
val preferredLightTheme = prefLightThemeElement?.getAttributeValue(ATTRIBUTE_THEME_NAME)
|
||||
if (preferredLightTheme == replacementThemeId) {
|
||||
prefLightThemeElement.setAttribute(ATTRIBUTE_THEME_NAME, newThemeId)
|
||||
}
|
||||
val currentThemeElement = element.getChild(ELEMENT_LAF)
|
||||
val currentTheme = currentThemeElement?.getAttributeValue(ATTRIBUTE_THEME_NAME)
|
||||
if (currentTheme == replacementThemeId) {
|
||||
currentThemeElement.setAttribute(ATTRIBUTE_THEME_NAME, newThemeId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getInstalledLookAndFeels(): Array<UIManager.LookAndFeelInfo> {
|
||||
return UiThemeProviderListManager.getInstance().getLaFs().map { it as UIThemeLookAndFeelInfoImpl }.toList().toTypedArray()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ private class ThemeListProviderImpl : ThemeListProvider {
|
||||
val result = mutableListOf<List<UIThemeLookAndFeelInfo>>()
|
||||
val uiThemeProviderListManager = UiThemeProviderListManager.getInstance()
|
||||
if (ExperimentalUI.isNewUI()) {
|
||||
result.add(uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.NEW).sortedBy { it.name }.toList())
|
||||
result.add(uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.NEW)
|
||||
.filterNot { it.id == "ExperimentalLight" }.sortedBy { it.name }.toList())
|
||||
}
|
||||
result.add((uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.CLASSIC).filterNot { it.id == "IntelliJ" }
|
||||
+ uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.UNSPECIFIED)).sortedBy { it.name }.toList())
|
||||
|
||||
Reference in New Issue
Block a user