diff --git a/platform/platform-api/src/com/intellij/ui/components/JBPanel.java b/platform/platform-api/src/com/intellij/ui/components/JBPanel.java index f4f7d11c13f2..c686ee197d39 100644 --- a/platform/platform-api/src/com/intellij/ui/components/JBPanel.java +++ b/platform/platform-api/src/com/intellij/ui/components/JBPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,6 +87,10 @@ public class JBPanel extends JPanel implements TypeSafeDataProvider { super.paintComponent(g); } + paintCenterImage(g); + } + + protected void paintCenterImage(Graphics g) { Icon centerImage = getCenterImage(); if (centerImage != null) { IconUtil.paintInCenterOf(this, g, centerImage); diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 6406e8f33a8a..57dec29ed036 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -2418,7 +2418,7 @@ public class UIUtil { final int bulletWidth = info.withBullet ? fm.stringWidth(" " + info.bulletChar) : 0; maxBulletWidth[0] = Math.max(maxBulletWidth[0], bulletWidth); - maxWidth[0] = Math.max(fm.stringWidth(pair.getFirst() + bulletWidth), maxWidth[0]); + maxWidth[0] = Math.max(fm.stringWidth(pair.getFirst().replace("", "").replace("", "") + bulletWidth), maxWidth[0]); height[0] += (fm.getHeight() + fm.getLeading()) * myLineSpacing; if (old != null) { @@ -2437,6 +2437,12 @@ public class UIUtil { @Override public boolean process(final Pair pair) { final LineInfo info = pair.getSecond(); + String text = pair.first; + String shortcut = ""; + if (pair.first.contains("")) { + shortcut = text.substring(text.indexOf("") + "".length(), text.indexOf("")); + text = text.substring(0, text.indexOf("")); + } Font old = null; if (info.smaller) { @@ -2449,20 +2455,20 @@ public class UIUtil { final FontMetrics fm = g.getFontMetrics(); int xOffset = x; if (info.center) { - xOffset = x + (maxWidth[0] - fm.stringWidth(pair.getFirst())) / 2; + xOffset = x + (maxWidth[0] - fm.stringWidth(text)) / 2; } if (myDrawShadow) { int xOff = isUnderDarcula() ? 1 : 0; int yOff = 1; - final Color oldColor = g.getColor(); + Color oldColor = g.getColor(); g.setColor(myShadowColor); if (info.withBullet) { g.drawString(info.bulletChar + " ", x - fm.stringWidth(" " + info.bulletChar) + xOff, yOffset[0] + yOff); } - g.drawString(pair.getFirst(), xOffset + xOff, yOffset[0] + yOff); + g.drawString(text, xOffset + xOff, yOffset[0] + yOff); g.setColor(oldColor); } @@ -2470,7 +2476,15 @@ public class UIUtil { g.drawString(info.bulletChar + " ", x - fm.stringWidth(" " + info.bulletChar), yOffset[0]); } - g.drawString(pair.getFirst(), xOffset, yOffset[0]); + g.drawString(text, xOffset, yOffset[0]); + if (!StringUtil.isEmpty(shortcut)) { + Color oldColor = g.getColor(); + if (isUnderDarcula()) { + g.setColor(new Color(60, 118, 249)); + } + g.drawString(shortcut, xOffset + fm.stringWidth(text + (isUnderDarcula() ? " " : "")), yOffset[0]); + g.setColor(oldColor); + } if (info.underlined) { Color c = null; @@ -2482,6 +2496,7 @@ public class UIUtil { g.drawLine(x - maxBulletWidth[0] - 10, yOffset[0] + fm.getDescent(), x + maxWidth[0] + 10, yOffset[0] + fm.getDescent()); if (c != null) { g.setColor(c); + } if (myDrawShadow) {