From d56f54159d43ed5ee32210351642f6c209ef706c Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 23 Jul 2013 20:22:21 +0200 Subject: [PATCH 1/2] restore the old status-progress size --- .../openapi/wm/impl/status/InlineProgressIndicator.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java index c7e2926242b2..07edd91caf3c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java @@ -88,7 +88,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di textAndProgress.add(myText, BorderLayout.CENTER); final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout()); - progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; @@ -278,7 +278,6 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di } private static class MyProgressBar extends JProgressBar { - private static final int MAX_COMPACT_PROGRESS_SIZE = 100; private boolean myActive = true; private final boolean myCompact; @@ -309,11 +308,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di public Dimension getPreferredSize() { if (!myActive && myCompact) return new Dimension(0, 0); - Dimension preferredSize = super.getPreferredSize(); - if (myCompact && preferredSize.width > MAX_COMPACT_PROGRESS_SIZE) { - return new Dimension(MAX_COMPACT_PROGRESS_SIZE, preferredSize.height); - } - return preferredSize; + return super.getPreferredSize(); } public void setActive(final boolean active) { From 15e406df5099b76e890ea8c6d36e47ba20f694d2 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 23 Jul 2013 20:25:57 +0200 Subject: [PATCH 2/2] remove progress icon from status bar when there's no progress --- .../wm/impl/status/IdeStatusBarImpl.java | 2 +- .../wm/impl/status/InfoAndProgressPanel.java | 40 +------------------ 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java index ecfe99b646f3..877a9f922ed3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/IdeStatusBarImpl.java @@ -160,7 +160,7 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx { setLayout(new BorderLayout(2, 0)); setBorder(BorderFactory.createEmptyBorder(1, 4, 0, SystemInfo.isMac ? 2 : 0)); - myInfoAndProgressPanel = new InfoAndProgressPanel(master == null); + myInfoAndProgressPanel = new InfoAndProgressPanel(); addWidget(myInfoAndProgressPanel, Position.CENTER); setOpaque(true); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java index 6212935ec714..9b804cb33fb8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java @@ -80,13 +80,10 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge private final Alarm myRefreshAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD); private final AnimatedIcon myRefreshIcon; - private final EmptyIcon myEmptyRefreshIcon; private String myCurrentRequestor; - private final boolean myProgressEnabled; - public InfoAndProgressPanel(boolean progressEnabled) { - myProgressEnabled = progressEnabled; + public InfoAndProgressPanel() { setOpaque(false); @@ -111,7 +108,6 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge //}; myRefreshIcon.setPaintPassiveIcon(false); - myEmptyRefreshIcon = new EmptyIcon(0, myRefreshIcon.getPreferredSize().height); myRefreshAndInfoPanel.setLayout(new BorderLayout()); myRefreshAndInfoPanel.setOpaque(false); @@ -528,40 +524,6 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge setLayout(new BorderLayout()); add(myRefreshAndInfoPanel, BorderLayout.CENTER); - //long wastedTime = ProgressManagerImpl.getWastedTime(); - //if (ApplicationManagerEx.getApplicationEx().isInternal() && wastedTime > 10 * 60 * 1000) { - // JPanel wrapper = new JPanel(new BorderLayout()); - // wrapper.setOpaque(false); - // JLabel label = new JLabel(" Wasted time: " + formatTime(wastedTime) + " "); - // label.setForeground(UIUtil.getPanelBackground().darker()); - // label.setOpaque(false); - // wrapper.add(label, BorderLayout.CENTER); - // wrapper.add(myProgressIcon, BorderLayout.EAST); - // - // long time = System.currentTimeMillis() - ApplicationManagerEx.getApplicationEx().getStartTime(); - // long percentage = wastedTime * 100 / time; - // String period = new SimpleDateFormat("m 'min' H 'hours'").format(new Date(2000, 0, 1, 0, 0, 0).getTime() + time); - // - // List> list = ProgressManagerImpl.getTimeWasters(); - // StringBuilder s = new StringBuilder("Successfully wasted " + percentage +"% of your time in " + period + ":
"); - // for (Pair each : list) { - // s.append(""); - // s.append(each.first); - // s.append(":"); - // s.append(formatTime(each.second)); - // s.append(""); - // } - // s.append(""); - // wrapper.setToolTipText(s.toString()); - // add(wrapper, BorderLayout.EAST); - //} else { - - if (myProgressEnabled) { - add(myProgressIcon, BorderLayout.EAST); - } - - //} - myProgressIcon.suspend(); myRefreshAndInfoPanel.revalidate(); myRefreshAndInfoPanel.repaint();