update all status bar progresses at once (IDEA-143500)

This commit is contained in:
peter
2015-08-05 20:59:27 +02:00
parent 652165cdc9
commit 63fbd088d7
2 changed files with 33 additions and 37 deletions
@@ -22,7 +22,6 @@ import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -47,6 +46,7 @@ import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.ui.components.panels.Wrapper;
import com.intellij.util.Alarm;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.*;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
@@ -62,7 +62,6 @@ import java.util.*;
import java.util.List;
public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidget {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.wm.impl.status.InfoAndProgressPanel");
private final ProcessPopup myPopup;
private final StatusPanel myInfoPanel = new StatusPanel();
@@ -86,30 +85,26 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
private String myCurrentRequestor;
private final Set<InlineProgressIndicator> myDirtyIndicators = ContainerUtil.newIdentityTroveSet();
private final Update myUpdateIndicators = new Update("UpdateIndicators", false, 1) {
@Override
public void run() {
List<InlineProgressIndicator> indicators;
synchronized (myDirtyIndicators) {
indicators = ContainerUtil.newArrayList(myDirtyIndicators);
myDirtyIndicators.clear();
}
for (InlineProgressIndicator indicator : indicators) {
indicator.updateAndRepaint();
}
}
};
public InfoAndProgressPanel() {
setOpaque(false);
myRefreshIcon = new RefreshFileSystemIcon();
// new AsyncProcessIcon("Refreshing filesystem") {
// protected Icon getPassiveIcon() {
// return myEmptyRefreshIcon;
// }
//
// @Override
// public Dimension getPreferredSize() {
// if (!isRunning()) return new Dimension(0, 0);
// return super.getPreferredSize();
// }
//
// @Override
// public void paint(Graphics g) {
// g.translate(0, -1);
// super.paint(g);
// g.translate(0, 1);
// }
//};
myRefreshIcon.setPaintPassiveIcon(false);
myRefreshAndInfoPanel.setLayout(new BorderLayout());
@@ -277,6 +272,9 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
final ProgressIndicatorEx original = myInline2Original.get(progress);
myInline2Original.remove(progress);
synchronized (myDirtyIndicators) {
myDirtyIndicators.remove(progress);
}
myOriginal2Inlines.remove(original, progress);
if (myOriginal2Inlines.get(original) == null) {
@@ -670,13 +668,11 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
}
@Override
protected void queueProgressUpdate(final Runnable update) {
myUpdateQueue.queue(new Update(MyInlineProgressIndicator.this, false, 1) {
@Override
public void run() {
update.run();
}
});
protected void queueProgressUpdate() {
synchronized (myDirtyIndicators) {
myDirtyIndicators.add(this);
}
myUpdateQueue.queue(myUpdateIndicators);
}
@Override
@@ -139,15 +139,15 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di
}
protected void updateProgress() {
queueProgressUpdate(new Runnable() {
public void run() {
if (isDisposed()) return;
queueProgressUpdate();
}
updateProgressNow();
protected void updateAndRepaint() {
if (isDisposed()) return;
myComponent.repaint();
}
});
updateProgressNow();
myComponent.repaint();
}
public void updateProgressNow() {
@@ -197,8 +197,8 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di
return false;
}
protected void queueProgressUpdate(Runnable update) {
update.run();
protected void queueProgressUpdate() {
updateAndRepaint();
}
protected void queueRunningUpdate(Runnable update) {