mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
update all status bar progresses at once (IDEA-143500)
This commit is contained in:
+24
-28
@@ -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
|
||||
|
||||
+9
-9
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user