use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class UIUtil method createEditor.
@NotNull
public static Editor createEditor(@NotNull Document doc, final Project project, boolean editable, boolean addToolTipForVariableHandler, @Nullable TemplateContextType contextType) {
final Editor editor = editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setVirtualSpace(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setCaretRowShown(false);
if (!editable) {
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR);
if (c == null) {
c = globalScheme.getDefaultBackground();
}
((EditorEx) editor).setBackgroundColor(c);
} else {
((EditorEx) editor).setEmbeddedIntoDialogWrapper(true);
}
TemplateEditorUtil.setHighlighter(editor, contextType);
if (addToolTipForVariableHandler) {
SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor);
editor.addEditorMouseMotionListener(handler);
editor.getDocument().addDocumentListener(handler);
editor.getCaretModel().addCaretListener(handler);
editor.putUserData(LISTENER_KEY, handler);
}
return editor;
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class EditorNotificationPanel method getBackground.
@Override
public Color getBackground() {
EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
if (myBackgroundColor != null)
return myBackgroundColor;
if (myBackgroundColorKey != null) {
Color color = globalScheme.getColor(myBackgroundColorKey);
if (color != null)
return color;
}
Color color = globalScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND);
return color != null ? color : UIUtil.getToolTipBackground();
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class DarculaInstaller method performImpl.
private static void performImpl(boolean dark) {
JBColor.setDark(dark);
IconLoader.setUseDarkIcons(dark);
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
EditorColorsScheme current = colorsManager.getGlobalScheme();
if (dark != ColorUtil.isDark(current.getDefaultBackground())) {
String targetScheme = dark ? DarculaLaf.NAME : EditorColorsScheme.DEFAULT_SCHEME_NAME;
PropertiesComponent properties = PropertiesComponent.getInstance();
String savedEditorThemeKey = dark ? DARCULA_EDITOR_THEME_KEY : DEFAULT_EDITOR_THEME_KEY;
String toSavedEditorThemeKey = dark ? DEFAULT_EDITOR_THEME_KEY : DARCULA_EDITOR_THEME_KEY;
String themeName = properties.getValue(savedEditorThemeKey);
if (themeName != null && colorsManager.getScheme(themeName) != null) {
targetScheme = themeName;
}
properties.setValue(toSavedEditorThemeKey, current.getName(), dark ? EditorColorsScheme.DEFAULT_SCHEME_NAME : DarculaLaf.NAME);
EditorColorsScheme scheme = colorsManager.getScheme(targetScheme);
if (scheme != null) {
colorsManager.setGlobalScheme(scheme);
}
}
update();
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class SelectionModelImpl method getTextAttributes.
@Override
public TextAttributes getTextAttributes() {
if (myTextAttributes == null) {
TextAttributes textAttributes = new TextAttributes();
EditorColorsScheme scheme = myEditor.getColorsScheme();
textAttributes.setForegroundColor(scheme.getColor(EditorColors.SELECTION_FOREGROUND_COLOR));
textAttributes.setBackgroundColor(scheme.getColor(EditorColors.SELECTION_BACKGROUND_COLOR));
myTextAttributes = textAttributes;
}
return myTextAttributes;
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class EditorUtil method getEditorFont.
public static Font getEditorFont() {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
int size = UISettings.getInstance().getPresentationMode() ? UISettings.getInstance().getPresentationModeFontSize() - 4 : scheme.getEditorFontSize();
return new Font(scheme.getEditorFontName(), Font.PLAIN, size);
}
Aggregations