mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show eye when analysis is not finished
This commit is contained in:
+9
-14
@@ -50,7 +50,6 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.LayeredIcon;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.io.storage.HeavyProcessLatch;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
@@ -65,20 +64,17 @@ import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
private static final Icon NO_ANALYSIS_ICON = AllIcons.General.NoAnalysis;
|
||||
|
||||
private final Project myProject;
|
||||
private final Document myDocument;
|
||||
private final PsiFile myFile;
|
||||
private final DaemonCodeAnalyzerImpl myDaemonCodeAnalyzer;
|
||||
private final SeverityRegistrar mySeverityRegistrar;
|
||||
Icon icon;
|
||||
private Icon icon;
|
||||
String statistics;
|
||||
String statusLabel;
|
||||
String statusExtraLine;
|
||||
boolean passStatusesVisible;
|
||||
final Map<ProgressableTextEditorHighlightingPass, Pair<JProgressBar, JLabel>> passes = ContainerUtil.newLinkedHashMap();
|
||||
final Map<JProgressBar, JLabel> myProgressToText = new HashMap<JProgressBar, JLabel>();
|
||||
static final int MAX = 100;
|
||||
boolean progressBarsEnabled;
|
||||
Boolean progressBarsCompleted;
|
||||
@@ -132,10 +128,10 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
errorCount = newErrors;
|
||||
}
|
||||
|
||||
public static void setOrRefreshErrorStripeRenderer(@NotNull EditorMarkupModel editorMarkupModel,
|
||||
@NotNull Project project,
|
||||
@NotNull Document document,
|
||||
PsiFile file) {
|
||||
static void setOrRefreshErrorStripeRenderer(@NotNull EditorMarkupModel editorMarkupModel,
|
||||
@NotNull Project project,
|
||||
@NotNull Document document,
|
||||
PsiFile file) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (!editorMarkupModel.isErrorStripeVisible() || !DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file)) {
|
||||
return;
|
||||
@@ -296,19 +292,19 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Icon getIcon(DaemonCodeAnalyzerStatus status) {
|
||||
private Icon getIcon(@NotNull DaemonCodeAnalyzerStatus status) {
|
||||
updatePanel(status, getProject());
|
||||
Icon icon = this.icon;
|
||||
if (PowerSaveMode.isEnabled() || status.reasonWhySuspended != null || status.reasonWhyDisabled != null) {
|
||||
if (PowerSaveMode.isEnabled() || status.reasonWhySuspended != null || status.reasonWhyDisabled != null || status.errorAnalyzingFinished) {
|
||||
return icon;
|
||||
}
|
||||
double progress = getOverallProgress(status);
|
||||
TruncatingIcon trunc = new TruncatingIcon(icon, icon.getIconWidth(), (int)(icon.getIconHeight() * progress));
|
||||
|
||||
return new LayeredIcon(NO_ANALYSIS_ICON, trunc);
|
||||
return new LayeredIcon(trunc, AllIcons.General.InspectionInProgress);
|
||||
}
|
||||
|
||||
private static double getOverallProgress(DaemonCodeAnalyzerStatus status) {
|
||||
private static double getOverallProgress(@NotNull DaemonCodeAnalyzerStatus status) {
|
||||
long advancement = 0;
|
||||
long limit = 0;
|
||||
for (ProgressableTextEditorHighlightingPass ps : status.passStati) {
|
||||
@@ -418,7 +414,6 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
JLabel percLabel = new JLabel();
|
||||
percLabel.setText(TrafficProgressPanel.MAX_TEXT);
|
||||
passes.put(pass, Pair.create(progressBar, percLabel));
|
||||
myProgressToText.put(progressBar, percLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-4
@@ -41,7 +41,7 @@ import java.util.Map;
|
||||
/**
|
||||
* User: cdr
|
||||
*/
|
||||
public class TrafficProgressPanel extends JPanel {
|
||||
class TrafficProgressPanel extends JPanel {
|
||||
static final String MAX_TEXT = "100%";
|
||||
private static final String MIN_TEXT = "0%";
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TrafficProgressPanel extends JPanel {
|
||||
|
||||
@NotNull private final HintHint myHintHint;
|
||||
|
||||
public TrafficProgressPanel(@NotNull TrafficLightRenderer trafficLightRenderer, @NotNull Editor editor, @NotNull HintHint hintHint) {
|
||||
TrafficProgressPanel(@NotNull TrafficLightRenderer trafficLightRenderer, @NotNull Editor editor, @NotNull HintHint hintHint) {
|
||||
myHintHint = hintHint;
|
||||
myTrafficLightRenderer = trafficLightRenderer;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class TrafficProgressPanel extends JPanel {
|
||||
statusLabel.setFont(statusLabel.getFont().deriveFont(Font.BOLD));
|
||||
}
|
||||
|
||||
public int getMinWidth() {
|
||||
int getMinWidth() {
|
||||
return Math.max(Math.max(Math.max(getLabelMinWidth(statistics), getLabelMinWidth(statusExtraLineLabel)), getLabelMinWidth(statusLabel)), getLabelMinWidth(new JLabel("<html><b>Slow inspections progress report long line</b></html>")));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class TrafficProgressPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public void updatePanel(@NotNull TrafficLightRenderer.DaemonCodeAnalyzerStatus status, boolean isFake) {
|
||||
void updatePanel(@NotNull TrafficLightRenderer.DaemonCodeAnalyzerStatus status, boolean isFake) {
|
||||
try {
|
||||
boolean needRebuild = myTrafficLightRenderer.updatePanel(status, myTrafficLightRenderer.getProject());
|
||||
statusLabel.setText(myTrafficLightRenderer.statusLabel);
|
||||
@@ -181,6 +181,9 @@ public class TrafficProgressPanel extends JPanel {
|
||||
Pair<JProgressBar, JLabel> pair = myTrafficLightRenderer.passes.get(pass);
|
||||
JProgressBar progressBar = pair.first;
|
||||
int percent = (int)Math.round(progress * TrafficLightRenderer.MAX);
|
||||
if (percent == 100 && !pass.isFinished()) {
|
||||
percent = 99;
|
||||
}
|
||||
progressBar.setValue(percent);
|
||||
JLabel percentage = pair.second;
|
||||
percentage.setText(percent + "%");
|
||||
|
||||
Reference in New Issue
Block a user