generated from JetBrains/intellij-platform-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chores - Deprecated APIs and dart highlighting fixes.
- Loading branch information
1 parent
d6dff47
commit 8c739fa
Showing
3 changed files
with
25 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,15 @@ | ||
package com.github.dinbtechit.vscodetheme | ||
|
||
import com.github.dinbtechit.vscodetheme.settings.VSCodeThemeSettingsStore | ||
import com.intellij.ide.DataManager | ||
import com.intellij.ide.actions.SettingsEntryPointAction | ||
import com.intellij.ide.plugins.IdeaPluginDescriptor | ||
import com.intellij.ide.plugins.PluginManagerCore | ||
import com.intellij.ide.ui.* | ||
import com.intellij.ide.ui.laf.UIThemeLookAndFeelInfoImpl | ||
import com.intellij.ide.ui.laf.UiThemeProviderListManager | ||
import com.intellij.openapi.actionSystem.ActionManager | ||
import com.intellij.openapi.actionSystem.ActionPlaces | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.ide.ui.LafManager | ||
import com.intellij.ide.ui.LafManagerListener | ||
import com.intellij.ide.ui.ThemeListProvider | ||
import com.intellij.openapi.application.ApplicationManager | ||
import com.intellij.openapi.extensions.PluginId | ||
import com.intellij.openapi.options.Configurable | ||
import com.intellij.openapi.options.SearchableConfigurable | ||
import com.intellij.openapi.options.ShowSettingsUtil | ||
import com.intellij.openapi.project.ProjectManager | ||
import java.util.* | ||
import javax.swing.UIDefaults | ||
|
||
import javax.swing.UIManager | ||
import com.intellij.util.ui.JBUI | ||
import com.jetbrains.rd.util.string.printToString | ||
|
||
/*enum class VSCodeTheme(val theme: String) { | ||
UNKNOWN("UNKNOWN"), | ||
|
@@ -51,7 +40,7 @@ class VSCodeThemeManager { | |
try { | ||
if (getPlugin()?.isEnabled != null) { | ||
val vscodeTheme = | ||
LafManager.getInstance().installedThemes.firstOrNull { (it as UIThemeLookAndFeelInfoImpl).theme.name == VSCodeTheme.DARK } | ||
LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(VSCodeTheme.DARK) } | ||
return vscodeTheme != null | ||
} | ||
return false | ||
|
@@ -60,13 +49,12 @@ class VSCodeThemeManager { | |
} | ||
} | ||
|
||
|
||
fun switchToVSCodeTheme(always: Boolean = false, selectedVSCodeTheme: String = VSCodeTheme.DARK) { | ||
try { | ||
if (isVSCodeThemeReady()) { | ||
val convertedSelectedVSCodeTheme = convertOldToNewTheme(selectedVSCodeTheme) | ||
val vscodeTheme = | ||
LafManager.getInstance().installedThemes.firstOrNull { it.name == convertedSelectedVSCodeTheme } | ||
LafManager.getInstance().installedThemes.firstOrNull { it.toString().contains(convertedSelectedVSCodeTheme) } | ||
|
||
if (vscodeTheme != null) { | ||
LafManager.getInstance().currentUIThemeLookAndFeel = vscodeTheme | ||
Check warning on line 60 in src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
|
||
|
@@ -82,6 +70,19 @@ class VSCodeThemeManager { | |
} | ||
} | ||
|
||
fun isVSCodeThemeSelected(): Boolean { | ||
val theme = LafManager.getInstance().currentUIThemeLookAndFeel | ||
Check warning on line 74 in src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
|
||
if (theme != null) { | ||
return theme.toString().contains(VSCodeTheme.DARK) && !theme.toString().contains("Modern") | ||
} | ||
return false | ||
} | ||
|
||
fun isVSCodeDarkModernThemeSelected(): Boolean { | ||
val theme = LafManager.getInstance().currentUIThemeLookAndFeel | ||
Check warning on line 82 in src/main/kotlin/com/github/dinbtechit/vscodetheme/VSCodeThemeManager.kt GitHub Actions / Qodana Community for JVMUnstable API Usage
|
||
return theme?.toString()?.contains(VSCodeTheme.DARK_MODERN) ?: false | ||
} | ||
|
||
private fun convertOldToNewTheme(theme: String): String { | ||
return when (theme) { | ||
"DARK_MODERN" -> "VSCode Dark Modern" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters