use of com.intellij.ui.SimpleTextAttributes in project android by JetBrains.
the class StringsCellRenderer method customizeCellRenderer.
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
if (!(value instanceof String)) {
return;
}
String s = (String) value;
if (shouldClip(s)) {
s = clip(s);
}
row = table.convertRowIndexToModel(row);
column = table.convertColumnIndexToModel(column);
String problem = ((StringResourceTableModel) table.getModel()).getCellProblem(row, column);
SimpleTextAttributes attributes;
if (problem == null) {
attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
} else if (column == StringResourceTableModel.KEY_COLUMN) {
attributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
} else {
attributes = CELL_ERROR_ATTRIBUTES;
}
Font currentFont = table.getFont();
Font f = FontUtil.getFontAbleToDisplay(s, currentFont);
if (currentFont != f) {
setFont(f);
}
setToolTipText(problem);
append(s, attributes);
}
use of com.intellij.ui.SimpleTextAttributes in project android by JetBrains.
the class ConnectedAndroidDevice method renderName.
@Override
public void renderName(@NotNull SimpleColoredComponent renderer, boolean isCompatible, @Nullable String searchPrefix) {
if (myDeviceNameRenderer != null) {
myDeviceNameRenderer.render(myDevice, renderer);
return;
}
renderer.setIcon(myDevice.isEmulator() ? AndroidIcons.Ddms.EmulatorDevice : AndroidIcons.Ddms.RealDevice);
IDevice.DeviceState state = myDevice.getState();
if (state != IDevice.DeviceState.ONLINE) {
String name = String.format("%1$s [%2$s", myDevice.getSerialNumber(), myDevice.getState());
renderer.append(name, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
if (state == IDevice.DeviceState.UNAUTHORIZED) {
renderer.append(" - Press 'OK' in the 'Allow USB Debugging' dialog on your device", SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
}
renderer.append("] ", SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
return;
}
SimpleTextAttributes attr = isCompatible ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES;
SearchUtil.appendFragments(searchPrefix, getName(), attr.getStyle(), attr.getFgColor(), attr.getBgColor(), renderer);
String build = DevicePropertyUtil.getBuild(myDevice);
if (!build.isEmpty()) {
renderer.append(" (" + build + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
use of com.intellij.ui.SimpleTextAttributes in project android by JetBrains.
the class LaunchableAndroidDevice method renderName.
@Override
public void renderName(@NotNull SimpleColoredComponent renderer, boolean isCompatible, @Nullable String searchPrefix) {
renderer.setIcon(AndroidIcons.Ddms.EmulatorDevice);
SimpleTextAttributes attr = isCompatible ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES;
SearchUtil.appendFragments(searchPrefix, getName(), attr.getStyle(), attr.getFgColor(), attr.getBgColor(), renderer);
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-plugins by JetBrains.
the class FlashUmlElementManager method decorate.
private SimpleColoredText decorate(String name) {
int style = SimpleTextAttributes.STYLE_BOLD;
final SimpleColoredText text = new SimpleColoredText();
text.append(name, new SimpleTextAttributes(style, getFGColor()));
return text;
}
use of com.intellij.ui.SimpleTextAttributes in project intellij-plugins by JetBrains.
the class FlashUmlElementManager method getClassPresentableName.
private SimpleColoredText getClassPresentableName(JSClass clazz) {
int style = SimpleTextAttributes.STYLE_BOLD;
if (clazz.isDeprecated())
style |= SimpleTextAttributes.STYLE_STRIKEOUT;
if (!clazz.isPhysical())
style |= SimpleTextAttributes.STYLE_ITALIC;
final SimpleColoredText text = new SimpleColoredText();
String name = StringUtil.notNullize(clazz.getName());
text.append(FlashUmlVfsResolver.fixVectorTypeName(name), new SimpleTextAttributes(style, getFGColor()));
return text;
}
Aggregations