Java Code Examples for com.intellij.ui.SimpleTextAttributes#getBgColor()

The following examples show how to use com.intellij.ui.SimpleTextAttributes#getBgColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
void render(FlutterLogEntry entry) {
  final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
  if (style.getBgColor() != null) {
    setBackground(style.getBgColor());
  }

  // TODO(pq): SpeedSearchUtil.applySpeedSearchHighlighting
  // TODO(pq): setTooltipText

  for (StyledText styledText : entry.getStyledText()) {
    append(styledText.getText(), styledText.getStyle() != null ? styledText.getStyle() : style, styledText.getTag());
  }

  // Append data badge
  final Object data = entry.getData();
  // TODO(pq): should make this a simple null check.
  if (data instanceof DiagnosticsNode || (data instanceof String && JsonUtils.hasJsonData((String)data))) {
    setIcon(AllIcons.General.ArrowRight);
  }
}
 
Example 2
Source File: MessageCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
void render(FlutterLogEntry entry) {
  final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
  if (style.getBgColor() != null) {
    setBackground(style.getBgColor());
  }

  // TODO(pq): SpeedSearchUtil.applySpeedSearchHighlighting
  // TODO(pq): setTooltipText

  for (StyledText styledText : entry.getStyledText()) {
    append(styledText.getText(), styledText.getStyle() != null ? styledText.getStyle() : style, styledText.getTag());
  }

  // Append data badge
  final Object data = entry.getData();
  // TODO(pq): should make this a simple null check.
  if (data instanceof DiagnosticsNode || (data instanceof String && JsonUtils.hasJsonData((String)data))) {
    setIcon(AllIcons.General.ArrowRight);
  }
}
 
Example 3
Source File: CategoryCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public final Component getTableCellRendererComponent(JTable table, @Nullable Object value,
                                                     boolean isSelected, boolean hasFocus, int row, int col) {
  final JPanel panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
  panel.setBackground(JBColor.background());

  if (value instanceof FlutterLogEntry) {
    final FlutterLogEntry entry = (FlutterLogEntry)value;
    final String category = entry.getCategory();
    final JLabel label = new JLabel(" " + category + " ");
    label.setBackground(FlutterLogColors.forCategory(category));
    label.setForeground(JBColor.background());
    label.setOpaque(true);
    panel.add(Box.createHorizontalGlue());
    panel.add(label);
    panel.add(Box.createHorizontalStrut(8));

    final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
    if (style.getBgColor() != null) {
      setBackground(style.getBgColor());
      panel.setBackground(style.getBgColor());
    }

    AbstractEntryCellRender.updateEntryBorder(panel, entry, row);
  }

  clear();
  setPaintFocusBorder(hasFocus && table.getCellSelectionEnabled());
  acquireState(table, isSelected, hasFocus, row, col);
  getCellState().updateRenderer(this);

  if (isSelected) {
    panel.setBackground(table.getSelectionBackground());
  }

  return panel;
}
 
Example 4
Source File: AbstractEntryCellRender.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void appendStyled(FlutterLogEntry entry, String text) {
  final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
  if (style.getBgColor() != null) {
    setBackground(style.getBgColor());
  }
  append(text, style);
}
 
Example 5
Source File: CategoryCellRenderer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public final Component getTableCellRendererComponent(JTable table, @Nullable Object value,
                                                     boolean isSelected, boolean hasFocus, int row, int col) {
  final JPanel panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
  panel.setBackground(JBColor.background());

  if (value instanceof FlutterLogEntry) {
    final FlutterLogEntry entry = (FlutterLogEntry)value;
    final String category = entry.getCategory();
    final JLabel label = new JLabel(" " + category + " ");
    label.setBackground(FlutterLogColors.forCategory(category));
    label.setForeground(JBColor.background());
    label.setOpaque(true);
    panel.add(Box.createHorizontalGlue());
    panel.add(label);
    panel.add(Box.createHorizontalStrut(8));

    final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
    if (style.getBgColor() != null) {
      setBackground(style.getBgColor());
      panel.setBackground(style.getBgColor());
    }

    AbstractEntryCellRender.updateEntryBorder(panel, entry, row);
  }

  clear();
  setPaintFocusBorder(hasFocus && table.getCellSelectionEnabled());
  acquireState(table, isSelected, hasFocus, row, col);
  getCellState().updateRenderer(this);

  if (isSelected) {
    panel.setBackground(table.getSelectionBackground());
  }

  return panel;
}
 
Example 6
Source File: AbstractEntryCellRender.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void appendStyled(FlutterLogEntry entry, String text) {
  final SimpleTextAttributes style = entryModel.style(entry, STYLE_PLAIN);
  if (style.getBgColor() != null) {
    setBackground(style.getBgColor());
  }
  append(text, style);
}
 
Example 7
Source File: InspectionTree.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static SimpleTextAttributes patchAttr(InspectionTreeNode node, SimpleTextAttributes attributes) {
  if (node.isResolved()) {
    return new SimpleTextAttributes(attributes.getBgColor(), attributes.getFgColor(), attributes.getWaveColor(), attributes.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT);
  }
  return attributes;
}