当前位置: 首页>>代码示例>>Java>>正文


Java EditorColorsScheme.getDefaultBackground方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:EduAnswerPlaceholderPainter.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TextWithMarkupProcessor.java

示例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");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HTMLTextPainter.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:EditorFragmentComponent.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:IterationStateTest.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TextWithMarkupProcessor.java

示例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("&nbsp;&nbsp;<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);
        }
    }
}
 
开发者ID:dyadix,项目名称:typengo,代码行数:48,代码来源:CommandInputForm.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:UIUtil.java


注:本文中的com.intellij.openapi.editor.colors.EditorColorsScheme.getDefaultBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。