use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ExternalSystemNode method prepareAttributes.
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
ExternalProjectsStructure.ErrorLevel level = getTotalErrorLevel();
Color waveColor = level == ExternalProjectsStructure.ErrorLevel.NONE ? null : JBColor.RED;
int style = from.getStyle();
if (waveColor != null)
style |= SimpleTextAttributes.STYLE_WAVED;
return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ExternalSystemNode method setNameAndTooltip.
protected void setNameAndTooltip(String name, @Nullable String tooltip, @Nullable String hint) {
final boolean ignored = isIgnored();
final SimpleTextAttributes textAttributes = ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : getPlainAttributes();
setNameAndTooltip(name, tooltip, textAttributes);
if (!StringUtil.isEmptyOrSpaces(hint)) {
addColoredFragment(" (" + hint + ")", ignored ? SimpleTextAttributes.GRAYED_ITALIC_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class NavBarItem method update.
void update() {
clear();
setIcon(myIcon);
final boolean focused = isFocusedOrPopupElement();
final boolean selected = isSelected();
setFocusBorderAroundIcon(false);
setBackground(myUI.getBackground(selected, focused));
Color fg = myUI.getForeground(selected, focused, isInactive());
if (fg == null)
fg = myAttributes.getFgColor();
final Color bg = getBackground();
append(myText, new SimpleTextAttributes(bg, fg, myAttributes.getWaveColor(), myAttributes.getStyle()));
//repaint();
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class ContentEntryTreeCellRenderer method customizeCellRenderer.
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);
final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
if (editor != null) {
final Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
if (userObject instanceof NodeDescriptor) {
final Object element = ((NodeDescriptor) userObject).getElement();
if (element instanceof FileElement) {
final VirtualFile file = ((FileElement) element).getFile();
if (file != null && file.isDirectory()) {
final ContentEntry contentEntry = editor.getContentEntry();
if (contentEntry != null) {
final String prefix = getPresentablePrefix(contentEntry, file);
if (!prefix.isEmpty()) {
append(" (" + prefix + ")", new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.GRAY));
}
setIcon(updateIcon(contentEntry, file, getIcon()));
}
}
}
}
}
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-community by JetBrains.
the class FileEncodingConfigurable method renderValue.
@Override
protected void renderValue(@Nullable Object target, @NotNull Charset t, @NotNull ColoredTextContainer renderer) {
VirtualFile file = target instanceof VirtualFile ? (VirtualFile) target : null;
Pair<Charset, String> check = file == null || file.isDirectory() ? null : EncodingUtil.checkSomeActionEnabled(file);
String failReason = check == null ? null : check.second;
String encodingText = t.displayName();
SimpleTextAttributes attributes = failReason == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES;
renderer.append(encodingText + (failReason == null ? "" : " (" + failReason + ")"), attributes);
}
Aggregations