in idea-plugin/src/main/java/com/jetbrains/ide/streamdeck/keymap/ActionsTree.java [797:860]
private void paintRowData(Tree tree, Object data, Rectangle bounds, Graphics2D g) {
RowData rowData = extractRowData(data);
Shortcut[] shortcuts = rowData.shortcuts;
Set<String> abbreviations = rowData.abbreviations;
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
int totalWidth = 0;
final FontMetrics metrics = tree.getFontMetrics(tree.getFont());
if (shortcuts != null && shortcuts.length > 0) {
for (Shortcut shortcut : shortcuts) {
totalWidth += metrics.stringWidth(KeymapUtil.getShortcutText(shortcut));
totalWidth += 10;
}
totalWidth -= 5;
int x = bounds.x + bounds.width - totalWidth;
int fontHeight = (int)metrics.getMaxCharBounds(g).getHeight();
Color c1 = new Color(234, 200, 162);
Color c2 = new Color(208, 200, 66);
g.translate(0, bounds.y - 1);
for (Shortcut shortcut : shortcuts) {
int width = metrics.stringWidth(KeymapUtil.getShortcutText(shortcut));
UIUtil.drawSearchMatch(g, x, x + width, bounds.height, c1, c2);
g.setColor(Gray._50);
g.drawString(KeymapUtil.getShortcutText(shortcut), x, fontHeight);
x += width;
x += 10;
}
g.translate(0, -bounds.y + 1);
}
if (abbreviations != null && abbreviations.size() > 0) {
for (String abbreviation : abbreviations) {
totalWidth += metrics.stringWidth(abbreviation);
totalWidth += 10;
}
totalWidth -= 5;
int x = bounds.x + bounds.width - totalWidth;
int fontHeight = (int)metrics.getMaxCharBounds(g).getHeight();
Color c1 = new Color(206, 234, 176);
Color c2 = new Color(126, 208, 82);
g.translate(0, bounds.y - 1);
for (String abbreviation : abbreviations) {
int width = metrics.stringWidth(abbreviation);
UIUtil.drawSearchMatch(g, x, x + width, bounds.height, c1, c2);
g.setColor(Gray._50);
g.drawString(abbreviation, x, fontHeight);
x += width;
x += 10;
}
g.translate(0, -bounds.y + 1);
}
config.restore();
}