@@ -4,12 +4,8 @@ import com.github.dinbtechit.vscodetheme.settings.VSCodeThemeSettingsStore
4
4
import com.intellij.ide.plugins.IdeaPluginDescriptor
5
5
import com.intellij.ide.plugins.PluginManagerCore
6
6
import com.intellij.ide.ui.LafManager
7
- import com.intellij.ide.ui.LafManagerListener
8
- import com.intellij.ide.ui.ThemeListProvider
9
- import com.intellij.openapi.application.ApplicationManager
10
7
import com.intellij.openapi.extensions.PluginId
11
- import com.intellij.util.ui.JBUI
12
- import com.jetbrains.rd.util.string.printToString
8
+ import com.intellij.util.containers.ContainerUtil
13
9
14
10
/* enum class VSCodeTheme(val theme: String) {
15
11
UNKNOWN("UNKNOWN"),
@@ -40,7 +36,7 @@ class VSCodeThemeManager {
40
36
try {
41
37
if (getPlugin()?.isEnabled != null ) {
42
38
val vscodeTheme =
43
- LafManager .getInstance().installedThemes .firstOrNull { it.toString().contains(VSCodeTheme .DARK ) }
39
+ LafManager .getInstance().installedLookAndFeels .firstOrNull { it.toString().contains(VSCodeTheme .DARK ) }
44
40
return vscodeTheme != null
45
41
}
46
42
return false
@@ -53,11 +49,12 @@ class VSCodeThemeManager {
53
49
try {
54
50
if (isVSCodeThemeReady()) {
55
51
val convertedSelectedVSCodeTheme = convertOldToNewTheme(selectedVSCodeTheme)
56
- val vscodeTheme =
57
- LafManager .getInstance().installedThemes.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) }
58
52
53
+ val vscodeTheme =
54
+ LafManager .getInstance().installedLookAndFeels.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) }
55
+ ContainerUtil .find(LafManager .getInstance().installedLookAndFeels) { it.name == = convertedSelectedVSCodeTheme}
59
56
if (vscodeTheme != null ) {
60
- LafManager .getInstance().currentUIThemeLookAndFeel = vscodeTheme
57
+ LafManager .getInstance().currentLookAndFeel = vscodeTheme
61
58
}
62
59
if (always) {
63
60
val settings = VSCodeThemeSettingsStore .instance
@@ -71,24 +68,25 @@ class VSCodeThemeManager {
71
68
}
72
69
73
70
fun isVSCodeThemeSelected (): Boolean {
74
- val theme = LafManager .getInstance().currentUIThemeLookAndFeel
71
+ val theme = LafManager .getInstance().currentLookAndFeel
75
72
if (theme != null ) {
76
73
return theme.toString().contains(VSCodeTheme .DARK ) && ! theme.toString().contains(" Modern" )
77
74
}
78
75
return false
79
76
}
80
77
81
78
fun isVSCodeDarkModernThemeSelected (): Boolean {
82
- val theme = LafManager .getInstance().currentUIThemeLookAndFeel
79
+ val theme = LafManager .getInstance().currentLookAndFeel
83
80
return theme?.toString()?.contains(VSCodeTheme .DARK_MODERN ) ? : false
84
81
}
85
82
83
+
84
+
86
85
private fun convertOldToNewTheme (theme : String ): String {
87
86
return when (theme) {
88
87
" DARK_MODERN" -> " VSCode Dark Modern"
89
88
" DARK" -> " VSCode Dark"
90
89
else -> theme
91
90
}
92
-
93
91
}
94
92
}
0 commit comments