use of com.intellij.openapi.editor.colors.EditorColorsScheme in project android by JetBrains.
the class HtmlBuilderHelper method fixFontStyles.
/**
* Adjust the font styles of the given text component, provided it's
* an HTML styled document, to use fonts from the current IDE scheme.
* <p>
* Note: Calling setText() on a component will reset the document styles
* so you will need to call this method repeatedly after each document
* replace.
*
* @param component the component
*/
public static void fixFontStyles(@NotNull JTextComponent component) {
Document document = component.getDocument();
if (!(document instanceof StyledDocument)) {
return;
}
StyledDocument styledDocument = (StyledDocument) document;
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = colorsManager.getGlobalScheme();
Style style = styledDocument.addStyle("active", null);
StyleConstants.setFontFamily(style, scheme.getEditorFontName());
StyleConstants.setFontSize(style, scheme.getEditorFontSize());
styledDocument.setCharacterAttributes(0, document.getLength(), style, false);
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project android by JetBrains.
the class AndroidStudioInitializer method run.
@Override
public void run() {
checkInstallation();
removeIdeSettings();
setUpNewFilePopupActions();
setUpMakeActions();
disableGroovyLanguageInjection();
setUpNewProjectActions();
setUpExperimentalFeatures();
setupAnalytics();
disableGradleOrderEnumeratorHandler();
disableIdeaJUnitConfigurations();
// Modify built-in "Default" color scheme to remove background from XML tags.
// "Darcula" and user schemes will not be touched.
EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME);
TextAttributes textAttributes = colorsScheme.getAttributes(HighlighterColors.TEXT);
TextAttributes xmlTagAttributes = colorsScheme.getAttributes(XmlHighlighterColors.XML_TAG);
xmlTagAttributes.setBackgroundColor(textAttributes.getBackgroundColor());
/* Causes IDE startup failure (from the command line)
Caused by: java.lang.IllegalAccessError: tried to access class com.intellij.ui.tabs.FileColorConfiguration from class com.intellij.ui.tabs.FileColorConfigurationUtil
at com.intellij.ui.tabs.FileColorConfigurationUtil.createFileColorConfigurationIfNotExist(FileColorConfigurationUtil.java:37)
at com.intellij.ui.tabs.FileColorConfigurationUtil.createAndroidTestFileColorConfigurationIfNotExist(FileColorConfigurationUtil.java:28)
at com.android.tools.idea.startup.AndroidStudioInitializer.run(AndroidStudioInitializer.java:90)
FileColorConfigurationUtil.createAndroidTestFileColorConfigurationIfNotExist(ProjectManager.getInstance().getDefaultProject());
*/
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project Perl5-IDEA by Camelcade.
the class PerlLightTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myDisposable = Disposer.newDisposable();
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
myReadAttributes = scheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
myWriteAttributes = scheme.getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
ElementManipulators.INSTANCE.addExplicitExtension(PerlStringMixin.class, new PerlStringManipulator());
ElementManipulators.INSTANCE.addExplicitExtension(PerlStringBareMixin.class, new PerlBareStringManipulator());
ElementManipulators.INSTANCE.addExplicitExtension(PerlStringContentElement.class, new PerlStringContentManipulator());
setUpLibrary();
myCodeInsightSettings = Perl5CodeInsightSettings.getInstance().copy();
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-plugins by StepicOrg.
the class StudyBrowserWindow method getContent.
@NotNull
private String getContent(@NotNull final String template, @NotNull Map<String, Object> params) {
final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
int fontSize = editorColorsScheme.getEditorFontSize();
Map<String, Object> map = new HashMap<>();
map.put("font_size", String.valueOf(fontSize - 2));
map.put("highlight", getExternalURL("/highlight/highlight.pack.js"));
if (LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo) {
map.put("css_highlight", getExternalURL("/highlight/styles/darcula.css"));
} else {
map.put("css_highlight", getExternalURL("/highlight/styles/idea.css"));
}
map.put("charset", Charset.defaultCharset().displayName());
map.put("loader", getExternalURL("/templates/img/loader.svg"));
map.put("login_css", getExternalURL("/templates/login/css/login.css"));
map.putAll(params);
return Templater.processTemplate(template, map);
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class SetBackgroundImageDialog method createEditorPreview.
@NotNull
private static SimpleEditorPreview createEditorPreview() {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
ColorAndFontOptions options = new ColorAndFontOptions();
options.reset();
options.selectScheme(scheme.getName());
ColorSettingsPage[] pages = ColorSettingsPages.getInstance().getRegisteredPages();
int index;
int attempt = 0;
do {
index = (int) Math.round(Math.random() * (pages.length - 1));
} while (StringUtil.countNewLines(pages[index].getDemoText()) < 8 && ++attempt < 10);
return new SimpleEditorPreview(options, pages[index], false);
}
Aggregations