use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class HTMLTextPainter method writeHeader.
private void writeHeader(@NonNls Writer writer, String title) throws IOException {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
writer.write("<html>\r\n");
writer.write("<head>\r\n");
writer.write("<title>" + title + "</title>\r\n");
writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n");
writeStyles(writer);
writer.write("</head>\r\n");
Color color = scheme.getDefaultBackground();
if (color == null)
color = JBColor.GRAY;
writer.write("<BODY BGCOLOR=\"#" + Integer.toString(color.getRGB() & 0xFFFFFF, 16) + "\">\r\n");
writer.write("<TABLE CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH=\"100%\" BGCOLOR=\"#" + ColorUtil.toHex(new JBColor(Gray.xC0, Gray.x60)) + "\" >\r\n");
writer.write("<TR><TD><CENTER>\r\n");
writer.write("<FONT FACE=\"Arial, Helvetica\" COLOR=\"#000000\">\r\n");
writer.write(title + "</FONT>\r\n");
writer.write("</center></TD></TR></TABLE>\r\n");
writer.write("<pre>\r\n");
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class SimpleEditorPreview method updateView.
@Override
public void updateView() {
EditorColorsScheme scheme = myOptions.getSelectedScheme();
myEditor.setColorsScheme(scheme);
EditorHighlighter highlighter = null;
if (myPage instanceof EditorHighlightingProvidingColorSettingsPage) {
highlighter = ((EditorHighlightingProvidingColorSettingsPage) myPage).createEditorHighlighter(scheme);
}
if (highlighter == null) {
final SyntaxHighlighter pageHighlighter = myPage.getHighlighter();
highlighter = HighlighterFactory.createHighlighter(pageHighlighter, scheme);
}
myEditor.setHighlighter(highlighter);
updateHighlighters();
myEditor.reinitSettings();
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class ActionUsagePanel method createEditor.
protected static Editor createEditor(String text, int column, int line, int selectedLine) {
EditorFactory editorFactory = EditorFactory.getInstance();
Document editorDocument = editorFactory.createDocument(text);
EditorEx editor = (EditorEx) editorFactory.createViewer(editorDocument);
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
editor.setColorsScheme(scheme);
EditorSettings settings = editor.getSettings();
settings.setWhitespacesShown(true);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
settings.setFoldingOutlineShown(false);
settings.setAdditionalColumnsCount(0);
settings.setAdditionalLinesCount(0);
settings.setRightMarginShown(true);
settings.setRightMargin(60);
LogicalPosition pos = new LogicalPosition(line, column);
editor.getCaretModel().moveToLogicalPosition(pos);
if (selectedLine >= 0) {
editor.getSelectionModel().setSelection(editorDocument.getLineStartOffset(selectedLine), editorDocument.getLineEndOffset(selectedLine));
}
return editor;
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class EclipseColorSchemeImporter method importScheme.
@Nullable
@Override
public EditorColorsScheme importScheme(@NotNull Project project, @NotNull VirtualFile selectedFile, @NotNull EditorColorsScheme currentScheme, @NotNull SchemeFactory<EditorColorsScheme> schemeFactory) throws SchemeImportException {
String themeName = readSchemeName(selectedFile);
if (themeName != null) {
EditorColorsScheme colorsScheme = schemeFactory.createNewScheme(themeName);
readFromStream(selectedFile, new EclipseThemeOptionHandler(colorsScheme));
setupMissingColors(colorsScheme);
return colorsScheme;
}
return null;
}
use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.
the class EclipseColorSchemeImporter method setupMissingColors.
private static void setupMissingColors(@NotNull EditorColorsScheme scheme) {
Color background = scheme.getDefaultBackground();
String defaultSchemeName = ColorUtil.isDark(background) ? "Darcula" : EditorColorsScheme.DEFAULT_SCHEME_NAME;
EditorColorsScheme baseScheme = DefaultColorSchemesManager.getInstance().getScheme(defaultSchemeName);
assert baseScheme != null : "Can not find default scheme '" + defaultSchemeName + "'!";
for (TextAttributesKey attributesKey : ATTRIBUTES_TO_COPY) {
copyAttributes(baseScheme, scheme, attributesKey);
}
for (String keyName : EXTERNAL_ATTRIBUTES) {
TextAttributesKey key = TextAttributesKey.createTextAttributesKey(keyName);
copyAttributes(baseScheme, scheme, key);
}
Color lightForeground = ColorUtil.mix(background, scheme.getDefaultForeground(), 0.5);
scheme.setColor(EditorColors.WHITESPACES_COLOR, lightForeground);
scheme.setColor(EditorColors.INDENT_GUIDE_COLOR, lightForeground);
scheme.setColor(EditorColors.SOFT_WRAP_SIGN_COLOR, lightForeground);
TextAttributes matchedBrace = new TextAttributes();
matchedBrace.setEffectType(EffectType.BOXED);
matchedBrace.setEffectColor(lightForeground);
scheme.setAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES, matchedBrace);
TextAttributes unmatchedBrace = matchedBrace.clone();
unmatchedBrace.setEffectColor(ColorUtil.mix(background, Color.RED, 0.5));
}
Aggregations