mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
triangle traffic renderer
This commit is contained in:
@@ -1516,7 +1516,7 @@
|
||||
</option>
|
||||
<option name="NO_ANALYSIS">
|
||||
<value>
|
||||
<option name="ERROR_STRIPE_COLOR" value="777777" />
|
||||
<option name="ERROR_STRIPE_COLOR" value="666666" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="DO_NOT_SHOW">
|
||||
|
||||
@@ -156,7 +156,9 @@ public class HighlightDisplayLevel {
|
||||
@Override
|
||||
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
g.setColor(getColor());
|
||||
g.fillRect(x, y, EMPTY_ICON_DIM, EMPTY_ICON_DIM);
|
||||
g.translate(x, y);
|
||||
g.fillPolygon(new int[]{0, EMPTY_ICON_DIM, EMPTY_ICON_DIM}, new int[]{0, 0, EMPTY_ICON_DIM}, 3);
|
||||
g.translate(-x, -y);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,17 +171,4 @@ public class HighlightDisplayLevel {
|
||||
return EMPTY_ICON_DIM;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SemiBorderIcon extends SingleColorIcon {
|
||||
public SemiBorderIcon(TextAttributesKey key) {
|
||||
super(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component component, Graphics g, int x, int y) {
|
||||
g.setColor(getColor());
|
||||
g.fillRect(x, y, 1, getIconHeight());
|
||||
g.fillRect(x, y + getIconHeight() - 1, getIconWidth(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-16
@@ -48,7 +48,6 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.FileViewProvider;
|
||||
import com.intellij.psi.PsiCompiledElement;
|
||||
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.io.storage.HeavyProcessLatch;
|
||||
@@ -66,7 +65,7 @@ import java.util.List;
|
||||
|
||||
public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
private static final TextAttributesKey NO_ANALYSIS = TextAttributesKey.createTextAttributesKey("NO_ANALYSIS");
|
||||
private static final Icon NO_ANALYSIS_ICON = new HighlightDisplayLevel.SemiBorderIcon(NO_ANALYSIS);
|
||||
private static final Icon NO_ANALYSIS_ICON = new HighlightDisplayLevel.SingleColorIcon(NO_ANALYSIS);
|
||||
private final Project myProject;
|
||||
private final Document myDocument;
|
||||
private final PsiFile myFile;
|
||||
@@ -297,20 +296,7 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable {
|
||||
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(trunc, AllIcons.General.Eye);
|
||||
}
|
||||
|
||||
private static double getOverallProgress(@NotNull DaemonCodeAnalyzerStatus status) {
|
||||
long advancement = 0;
|
||||
long limit = 0;
|
||||
for (ProgressableTextEditorHighlightingPass ps : status.passStati) {
|
||||
advancement += ps.getProgressCount();
|
||||
limit += ps.getProgressLimit();
|
||||
}
|
||||
return limit == 0 ? status.errorAnalyzingFinished ? 1 : 0 : advancement * 1.0 / limit;
|
||||
return AllIcons.General.Eye;
|
||||
}
|
||||
|
||||
// return true if panel needs to be rebuilt
|
||||
|
||||
Reference in New Issue
Block a user