set proper editor color scheme when installing a theme

This commit is contained in:
Konstantin Bulenkov
2018-07-19 18:32:50 +02:00
parent 32d7265139
commit 8012aa3f06
2 changed files with 16 additions and 0 deletions
@@ -142,6 +142,9 @@ class SchemeManagerImpl<T : Any, MUTABLE_SCHEME : T>(val fileSpec: String,
LOG.warn("Duplicated scheme ${schemeKey} - old: $oldScheme, new $scheme")
}
schemes.add(scheme)
if (requestor is UITheme) {
requestor.editorSchemeName = schemeKey
}
}
}
catch (e: ProcessCanceledException) {
@@ -4,6 +4,8 @@ package com.intellij.ide.ui.laf;
import com.intellij.ide.ui.UITheme;
import com.intellij.ide.ui.laf.darcula.DarculaLaf;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.IconPathPatcher;
import com.intellij.openapi.util.text.StringUtil;
@@ -36,6 +38,17 @@ public class UIThemeBasedLookAndFeelInfo extends UIManager.LookAndFeelInfo {
}
installBackgroundImage();
installEditorScheme();
}
private void installEditorScheme() {
String name = myTheme.getEditorSchemeName();
if (name != null) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getScheme(name);
if (scheme != null) {
EditorColorsManager.getInstance().setGlobalScheme(scheme);
}
}
}
private void installBackgroundImage() {