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
GitOrigin-RevId: e239c64226e07f6365142bd230c0733c85eb9a42
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b115764d4d
commit
e8c4a57f26
+6
-1
@@ -926,6 +926,10 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement
|
||||
}
|
||||
|
||||
public boolean settingsEqual(Object other, @Nullable Predicate<? super ColorKey> colorKeyFilter) {
|
||||
return settingsEqual(other, colorKeyFilter, false);
|
||||
}
|
||||
|
||||
public boolean settingsEqual(Object other, @Nullable Predicate<? super ColorKey> colorKeyFilter, boolean ignoreMetaInfo) {
|
||||
if (!(other instanceof AbstractColorsScheme otherScheme)) {
|
||||
return false;
|
||||
}
|
||||
@@ -936,7 +940,8 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement
|
||||
}
|
||||
|
||||
for (String propertyName : metaInfo.stringPropertyNames()) {
|
||||
if (propertyName.equals(META_INFO_CREATION_TIME) ||
|
||||
if (ignoreMetaInfo ||
|
||||
propertyName.equals(META_INFO_CREATION_TIME) ||
|
||||
propertyName.equals(META_INFO_MODIFIED_TIME) ||
|
||||
propertyName.equals(META_INFO_IDE) ||
|
||||
propertyName.equals(META_INFO_IDE_VERSION) ||
|
||||
|
||||
@@ -241,6 +241,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
}
|
||||
|
||||
override fun loadState(element: Element) {
|
||||
replaceIntellijLightThemeIfSelected(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,23 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
|
||||
return element
|
||||
}
|
||||
|
||||
//IDEA-331405 Hide IntelliJ Light from new UI
|
||||
private fun replaceIntellijLightThemeIfSelected(element: Element) {
|
||||
if (!ExperimentalUI.isNewUI()) return
|
||||
val replacementThemeId = "JetBrainsLightTheme"
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@ private class ThemeListProviderImpl : ThemeListProvider {
|
||||
if (ExperimentalUI.isNewUI()) {
|
||||
result.add(uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.NEW).sortedBy { it.name }.toList())
|
||||
}
|
||||
result.add((uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.CLASSIC).filterNot { it.id == "IntelliJ" }
|
||||
+ uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.UNSPECIFIED)).sortedBy { it.name }.toList())
|
||||
result.add((uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.CLASSIC).filterNot {
|
||||
it.id == "IntelliJ" || (it.id == "JetBrainsLightTheme" && ExperimentalUI.isNewUI())
|
||||
} + uiThemeProviderListManager.getThemeListForTargetUI(TargetUIType.UNSPECIFIED)).sortedBy { it.name }.toList())
|
||||
return result
|
||||
}
|
||||
}
|
||||
+17
-1
@@ -434,6 +434,7 @@ class EditorColorsManagerImpl @NonInjectable constructor(schemeManagerFactory: S
|
||||
|
||||
override fun loadState(state: State) {
|
||||
this.state = state
|
||||
hideIntellijLightSchemeIfNeeded()
|
||||
val colorSchemeName = state.colorScheme
|
||||
var colorScheme = colorSchemeName?.let { getScheme(it) }
|
||||
if (colorScheme == null) {
|
||||
@@ -456,7 +457,6 @@ class EditorColorsManagerImpl @NonInjectable constructor(schemeManagerFactory: S
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schemeManager.setCurrent(scheme = colorScheme, notify = isInitialConfigurationLoaded)
|
||||
isInitialConfigurationLoaded = true
|
||||
|
||||
@@ -492,6 +492,22 @@ class EditorColorsManagerImpl @NonInjectable constructor(schemeManagerFactory: S
|
||||
activity.end()
|
||||
}
|
||||
|
||||
//IDEA-331405 Hide IntelliJ Light from new UI
|
||||
private fun hideIntellijLightSchemeIfNeeded() {
|
||||
if (!ExperimentalUI.isNewUI()) return
|
||||
val themeName = "IntelliJ Light"
|
||||
val intellijLightThemes = schemeManager.allSchemes.filter { it.name.contains(themeName) }
|
||||
val customTheme = intellijLightThemes.find { it.name.startsWith("_@user_") }
|
||||
if (customTheme != null) {
|
||||
val defaultScheme = schemeManager.findSchemeByName(themeName)
|
||||
val isSchemeCustomized = (customTheme as? AbstractColorsScheme)?.settingsEqual(defaultScheme, null, true) != true
|
||||
if (isSchemeCustomized) {
|
||||
return
|
||||
}
|
||||
}
|
||||
intellijLightThemes.forEach { schemeManager.removeScheme(it) }
|
||||
}
|
||||
|
||||
override fun isDefaultScheme(scheme: EditorColorsScheme): Boolean = scheme is DefaultColorsScheme
|
||||
|
||||
private inner class EditorColorSchemeProcessor(
|
||||
|
||||
Reference in New Issue
Block a user