Java Code Examples for com.intellij.util.ui.UIUtil#getListForeground()

The following examples show how to use com.intellij.util.ui.UIUtil#getListForeground() . 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: FileOrDirectoryTreeNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static SimpleTextAttributes getAttributesFor(@Nonnull FileStatus status) {
  Color color = status.getColor();
  if (color == null) color = UIUtil.getListForeground();

  if (!myFileStatusToAttributeMap.containsKey(status)) {
    myFileStatusToAttributeMap.put(status, new SimpleTextAttributes(Font.PLAIN, color));
  }
  return myFileStatusToAttributeMap.get(status);
}
 
Example 2
Source File: InspectionListCellRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
public InspectionListCellRenderer() {
  SELECTED = new SimpleTextAttributes(UIUtil.getListSelectionBackground(),
                                      UIUtil.getListSelectionForeground(),
                                      JBColor.RED,
                                      SimpleTextAttributes.STYLE_PLAIN);
  PLAIN = new SimpleTextAttributes(UIUtil.getListBackground(),
                                   UIUtil.getListForeground(),
                                   JBColor.RED,
                                   SimpleTextAttributes.STYLE_PLAIN);
}
 
Example 3
Source File: InspectionListCellRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean focus) {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(true);

  final Color bg = sel ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
  final Color fg = sel ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
  panel.setBackground(bg);
  panel.setForeground(fg);

  SimpleTextAttributes attr = sel ? SELECTED : PLAIN;
  if (value instanceof InspectionToolWrapper) {
    final InspectionToolWrapper toolWrapper = (InspectionToolWrapper)value;
    final SimpleColoredComponent c = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher("  " + toolWrapper.getDisplayName(), c, attr, myMatcher, bg, sel);
    panel.add(c, BorderLayout.WEST);

    final SimpleColoredComponent group = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher(toolWrapper.getGroupDisplayName() + "  ", group, attr, myMatcher, bg, sel);
    final JPanel right = new JPanel(new BorderLayout());
    right.setBackground(bg);
    right.setForeground(fg);
    right.add(group, BorderLayout.CENTER);
    final JLabel icon = new JLabel(TargetAWT.to(getIcon(toolWrapper)));
    icon.setBackground(bg);
    icon.setForeground(fg);
    right.add(icon, BorderLayout.EAST);
    panel.add(right, BorderLayout.EAST);
  }
  else {
    // E.g. "..." item
    return super.getListCellRendererComponent(list, value, index, sel, focus);
  }

  return panel;
}
 
Example 4
Source File: GroupedElementsRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected Color getForeground() {
  return UIUtil.getListForeground();
}
 
Example 5
Source File: LibraryTableTreeContentElement.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected static Color getForegroundColor(boolean isValid) {
  return isValid ? UIUtil.getListForeground() : JBColor.RED;
}
 
Example 6
Source File: GotoActionModel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static Color defaultActionForeground(boolean isSelected, boolean hasFocus, @Nullable Presentation presentation) {
  if (isSelected) return UIUtil.getListSelectionForeground(hasFocus);
  if (presentation != null && !presentation.isEnabledAndVisible()) return UIUtil.getInactiveTextColor();
  return UIUtil.getListForeground();
}
 
Example 7
Source File: RecentProjectPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected Color getListForeground(boolean isSelected, boolean hasFocus) {
  return UIUtil.getListForeground(isSelected);
}
 
Example 8
Source File: JBColor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
Color getDarkVariant() {
  return UIUtil.getListForeground();
}