IDEA-330211 Renamed ThemesListProvider to ThemeListProvider

The class and all references to 'ThemesListProvider' have been renamed to 'ThemeListProvider'. This includes not only the class name itself but also all places within the code where this class was utilized. The reason behind this change was clarity and language consistency. The word 'Themes' was identified as potentially leading to misunderstandings due to its plural form. Renaming it to 'Theme' aligns the language used within the code to common conventions and improves readability.

GitOrigin-RevId: f3fc0b8c6a4ee46dbd51513994aa17fc9a5a105b
This commit is contained in:
Vladimir Krivosheev
2023-09-03 23:39:24 +00:00
committed by intellij-monorepo-bot
parent c354f484e6
commit 2cc7b5fda2
6 changed files with 28 additions and 30 deletions
@@ -10,9 +10,9 @@ import org.jetbrains.annotations.ApiStatus
* Provides all available LaFs sorted and grouped for popups/combobox lists
*/
@ApiStatus.Internal
interface ThemesListProvider {
interface ThemeListProvider {
companion object {
fun getInstance(): ThemesListProvider = ApplicationManager.getApplication().service<ThemesListProvider>()
fun getInstance(): ThemeListProvider = ApplicationManager.getApplication().service<ThemeListProvider>()
}
/**
@@ -5,7 +5,7 @@ import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.LafManager;
import com.intellij.ide.ui.LafManagerListener;
import com.intellij.ide.ui.ThemesListProvider;
import com.intellij.ide.ui.ThemeListProvider;
import com.intellij.ide.ui.laf.UIThemeLookAndFeelInfo;
import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
import com.intellij.openapi.Disposable;
@@ -37,7 +37,7 @@ public final class QuickChangeLookAndFeel extends QuickSwitchSchemeAction implem
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
UIThemeLookAndFeelInfo initialLaf = LafManager.getInstance().getCurrentUIThemeLookAndFeel();
for (List<UIThemeLookAndFeelInfo> list : ThemesListProvider.Companion.getInstance().getShownThemes()) {
for (List<UIThemeLookAndFeelInfo> list : ThemeListProvider.Companion.getInstance().getShownThemes()) {
if (group.getChildrenCount() > 0) group.addSeparator();
for (UIManager.LookAndFeelInfo lf : list) group.add(new LafChangeAction(lf, initialLaf == lf));
}
@@ -436,7 +436,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
private val allReferences: List<LafReference>
get() {
val result = ArrayList<LafReference>()
for (group in ThemesListProvider.getInstance().getShownThemes()) {
for (group in ThemeListProvider.getInstance().getShownThemes()) {
if (!result.isEmpty()) {
result.add(SEPARATOR)
}
@@ -916,7 +916,7 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(),
get() {
val lightLaFs = ArrayList<UIThemeLookAndFeelInfo>()
val darkLaFs = ArrayList<UIThemeLookAndFeelInfo>()
for (lafInfo in ThemesListProvider.getInstance().getShownThemes().flatten()) {
for (lafInfo in ThemeListProvider.getInstance().getShownThemes().flatten()) {
if (lafInfo.theme.isDark) {
darkLaFs.add(lafInfo)
}
@@ -0,0 +1,20 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.ui.laf
import com.intellij.ide.ui.LafManager
import com.intellij.ide.ui.TargetUIType
import com.intellij.ide.ui.ThemeListProvider
import com.intellij.ui.ExperimentalUI
private class ThemeListProviderImpl : ThemeListProvider {
override fun getShownThemes(): List<List<UIThemeLookAndFeelInfo>> {
val lafManager = LafManager.getInstance() as? LafManagerImpl ?: return emptyList()
val result = mutableListOf<List<UIThemeLookAndFeelInfo>>()
if (ExperimentalUI.isNewUI()) {
result.add(lafManager.getThemeListForTargetUI(TargetUIType.NEW).sortedBy { it.name })
}
result.add((lafManager.getThemeListForTargetUI(TargetUIType.CLASSIC).filterNot { it.theme.id == "IntelliJ" }
+ lafManager.getThemeListForTargetUI(TargetUIType.UNSPECIFIED)).sortedBy { it.name })
return result
}
}
@@ -1,22 +0,0 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.ui.laf
import com.intellij.ide.ui.LafManager
import com.intellij.ide.ui.TargetUIType
import com.intellij.ide.ui.ThemesListProvider
import com.intellij.ui.ExperimentalUI
class ThemesListProviderImpl : ThemesListProvider {
override fun getShownThemes(): List<List<UIThemeLookAndFeelInfo>> {
val lmi = LafManager.getInstance() as? LafManagerImpl ?: return listOf()
val result = mutableListOf<List<UIThemeLookAndFeelInfo>>()
if (ExperimentalUI.isNewUI()) {
result.add(lmi.getThemeListForTargetUI(TargetUIType.NEW).sortedBy { it.name })
}
result.add((lmi.getThemeListForTargetUI(TargetUIType.CLASSIC).filterNot { it.theme.id == "IntelliJ" }
+ lmi.getThemeListForTargetUI(TargetUIType.UNSPECIFIED)).sortedBy { it.name })
return result
}
}
@@ -48,8 +48,8 @@
serviceImplementation="com.intellij.ide.ui.laf.LafManagerImpl"
headlessImplementation="com.intellij.ide.ui.laf.HeadlessLafManagerImpl"/>
<applicationService serviceInterface="com.intellij.ide.ui.ThemesListProvider"
serviceImplementation="com.intellij.ide.ui.laf.ThemesListProviderImpl"/>
<applicationService serviceInterface="com.intellij.ide.ui.ThemeListProvider"
serviceImplementation="com.intellij.ide.ui.laf.ThemeListProviderImpl"/>
<applicationService serviceInterface="com.intellij.ide.environment.EnvironmentService"
serviceImplementation="com.intellij.ide.environment.impl.DefaultEnvironmentService"