longer memory usage panel :)

This commit is contained in:
peter
2013-07-23 16:20:54 +02:00
parent 30142c5aa9
commit 2eefdb04b7
2 changed files with 10 additions and 2 deletions
@@ -43,8 +43,13 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
// todo: drop unless J. will insist to keep old style look
private static final boolean FRAMED_STYLE = SystemInfo.isMac || !SystemProperties.getBooleanProperty("idea.ui.old.mem.use", false);
@NonNls private static final String SAMPLE_STRING = "0000M";
private static final int MEGABYTE = 1024 * 1024;
@NonNls private static final String SAMPLE_STRING;
static {
long maxMemory = Math.min(Runtime.getRuntime().maxMemory() / MEGABYTE, 9999);
SAMPLE_STRING = maxMemory + " of " + maxMemory + "M ";
}
private static final int HEIGHT = 16;
private static final Color USED_COLOR_1 = new JBColor(Gray._185, Gray._150);
private static final Color USED_COLOR_2 = new JBColor(Gray._145, Gray._120);
@@ -172,7 +177,9 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
// label
g2.setFont(getFont());
final String info = (usedMem / MEGABYTE) + "M";
final long used = usedMem / MEGABYTE;
final long total = maxMem / MEGABYTE;
final String info = UIBundle.message("memory.usage.panel.message.text", used, total);
final FontMetrics fontMetrics = g.getFontMetrics();
final int infoWidth = fontMetrics.charsWidth(info.toCharArray(), 0, info.length());
final int infoHeight = fontMetrics.getAscent();
@@ -65,6 +65,7 @@ tool.window.hideSide.action.name=Hide Side
#0 - total, 1 - used
memory.usage.panel.statistics.message=Allocated heap size: {0}M Used: {1}M
#0 - used, 1 - total
memory.usage.panel.message.text={0,number,####} of {1,number,####}M
go.to.line.command.name=Go to Line
go.to.line.command.double.click=Click to go to line
popup.hints.panel.click.to.configure.highlighting.tooltip.text=Click to configure highlighting for this file