本文整理汇总了Java中com.intellij.openapi.editor.colors.EditorColorsScheme.getDefaultBackground方法的典型用法代码示例。如果您正苦于以下问题:Java EditorColorsScheme.getDefaultBackground方法的具体用法?Java EditorColorsScheme.getDefaultBackground怎么用?Java EditorColorsScheme.getDefaultBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.colors.EditorColorsScheme
的用法示例。
在下文中一共展示了EditorColorsScheme.getDefaultBackground方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawAnswerPlaceholder
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static void drawAnswerPlaceholder(@NotNull final Editor editor, @NotNull final AnswerPlaceholder placeholder,
@NotNull final JBColor color) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes textAttributes = new TextAttributes(scheme.getDefaultForeground(), scheme.getDefaultBackground(), null,
EffectType.BOXED, Font.PLAIN);
textAttributes.setEffectColor(color);
int startOffset = placeholder.getOffset();
if (startOffset == -1) {
return;
}
final int length =
placeholder.isActive() ? placeholder.getRealLength() : placeholder.getVisibleLength(placeholder.getActiveSubtaskIndex());
Pair<Integer, Integer> offsets = StudyUtils.getPlaceholderOffsets(placeholder, editor.getDocument());
startOffset = offsets.first;
int endOffset = offsets.second;
if (placeholder.isActive()) {
drawAnswerPlaceholder(editor, startOffset, endOffset, textAttributes, PLACEHOLDERS_LAYER);
}
else if (!placeholder.getUseLength() && length != 0) {
drawAnswerPlaceholderFromPrevStep(editor, startOffset, endOffset);
}
}
示例2: Context
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
Context(@NotNull CharSequence charSequence, @NotNull EditorColorsScheme scheme, int indentSymbolsToStrip) {
myText = charSequence;
myDefaultForeground = scheme.getDefaultForeground();
myDefaultBackground = scheme.getDefaultBackground();
// Java assumes screen resolution of 72dpi when calculating font size in pixels. External applications are supposedly using correct
// resolution, so we need to adjust font size for copied text to look the same in them.
// (See https://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/java2d.html#gdlwn)
// Java on Mac is not affected by this issue.
int javaFontSize = scheme.getEditorFontSize();
float fontSize = SystemInfo.isMac || ApplicationManager.getApplication().isHeadlessEnvironment() ?
javaFontSize :
javaFontSize * 72f / Toolkit.getDefaultToolkit().getScreenResolution();
builder = new SyntaxInfo.Builder(myDefaultForeground, myDefaultBackground, fontSize);
myIndentSymbolsToStrip = indentSymbolsToStrip;
}
示例3: writeHeader
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
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=\"#C0C0C0\" >\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");
}
示例4: getBackgroundColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static Color getBackgroundColor(Editor editor, boolean useCaretRowBackground){
EditorColorsScheme colorsScheme = editor.getColorsScheme();
Color color = colorsScheme.getColor(EditorColors.CARET_ROW_COLOR);
if (!useCaretRowBackground || color == null){
color = colorsScheme.getDefaultBackground();
}
return color;
}
示例5: setUp
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
DEFAULT_BACKGROUND = colorsScheme.getDefaultBackground();
CARET_ROW_BACKGROUND = colorsScheme.getColor(EditorColors.CARET_ROW_COLOR);
SELECTION_BACKGROUND = colorsScheme.getColor(EditorColors.SELECTION_BACKGROUND_COLOR);
assertEquals(3, new HashSet<Color>(Arrays.asList(DEFAULT_BACKGROUND, CARET_ROW_BACKGROUND, SELECTION_BACKGROUND)).size());
}
示例6: CompositeRangeIterator
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public CompositeRangeIterator(@NotNull EditorColorsScheme colorsScheme, RangeIterator... iterators) {
myDefaultForeground = colorsScheme.getDefaultForeground();
myDefaultBackground = colorsScheme.getDefaultBackground();
myIterators = new IteratorWrapper[iterators.length];
for (int i = 0; i < iterators.length; i++) {
myIterators[i] = new IteratorWrapper(iterators[i], i);
}
}
示例7: updatePopup
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private void updatePopup(@NotNull JPopupMenu popupMenu, @NotNull String typedStr) {
popupMenu.removeAll();
Collection<ActionInfo> foundActions = ActionFinder.findActions(typedStr);
EditorColorsScheme currScheme = EditorColorsManager.getInstance().getGlobalScheme();
Color backgroundColor = currScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND);
Color foregroundColor = currScheme.getDefaultForeground();
if (backgroundColor == null) backgroundColor = currScheme.getDefaultBackground();
Color shortcutColor = getShortcutColor(backgroundColor, foregroundColor);
String shortcutStyle = "color:#" + GuiUtils.colorToHex(shortcutColor);
String abbrStyle = "font-family:" + currScheme.getConsoleFontName() + ";font-style:oblique;";
for (ActionInfo actionInfo: foundActions) {
AnAction action = actionInfo.getAction();
if (action != null) {
Presentation presentation = actionInfo.getAction().getTemplatePresentation();
StringBuilder sb = new StringBuilder();
sb
.append("<html><span style='").append(abbrStyle).append("'>")
.append(fillString(actionInfo.getAbbreviation(), ABBR_FIELD_SIZE))
.append("</span>");
String desc = presentation.getDescription();
if (desc != null && !desc.isEmpty()) {
sb.append(desc);
} else {
String text = presentation.getText();
if (text != null && !text.isEmpty()) {
sb.append(text);
}
}
Shortcut[] shortcuts = action.getShortcutSet().getShortcuts();
if (shortcuts.length > 0) {
sb.append(" <i style='").append(shortcutStyle).append("'>");
for (Shortcut shortcut : action.getShortcutSet().getShortcuts()) {
if (shortcut != shortcuts[0]) {
sb.append(", ");
}
sb.append(KeymapUtil.getShortcutText(shortcut));
}
sb.append("</i>");
}
sb.append("</html>");
JMenuItem menuItem = new JMenuItem(sb.toString());
menuItem.setForeground(foregroundColor);
menuItem.setBackground(backgroundColor);
popupMenu.add(menuItem);
}
}
}
示例8: createEditor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@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;
}