Skip to content

Commit 1dba7cb

Browse files
Use built-in constants for colors
1 parent bfed51a commit 1dba7cb

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pluginUntilBuild =
1212

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType = IC
15-
platformVersion = 251.14649.49
15+
platformVersion = 251.23536.34
1616

1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP

src/main/java/com/github/strangelookingnerd/PedroProgressBarUI.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package com.github.strangelookingnerd;
2626

27+
import com.intellij.openapi.progress.util.ProgressBarUtil;
2728
import com.intellij.ui.scale.JBUIScale;
2829
import com.intellij.util.ui.JBInsets;
2930
import com.intellij.util.ui.JBUI;
@@ -93,14 +94,14 @@ protected void paintIndeterminate(Graphics graphics, JComponent component) {
9394
Color startColor;
9495
Color endColor;
9596
Color foreground = progressBar.getForeground();
96-
Object statusProperty = progressBar.getClientProperty(JBUI.CurrentTheme.ProgressBar.statusKey());
97-
if (JBUI.CurrentTheme.ProgressBar.failedStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
97+
Object statusProperty = progressBar.getClientProperty(ProgressBarUtil.STATUS_KEY);
98+
if (ProgressBarUtil.FAILED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
9899
startColor = JBUI.CurrentTheme.ProgressBar.FAILED;
99100
endColor = JBUI.CurrentTheme.ProgressBar.FAILED_END;
100-
} else if (JBUI.CurrentTheme.ProgressBar.passedStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.PASSED) {
101+
} else if (ProgressBarUtil.PASSED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.PASSED) {
101102
startColor = JBUI.CurrentTheme.ProgressBar.PASSED;
102103
endColor = JBUI.CurrentTheme.ProgressBar.PASSED_END;
103-
} else if (JBUI.CurrentTheme.ProgressBar.warningStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.WARNING) {
104+
} else if (ProgressBarUtil.WARNING_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.WARNING) {
104105
startColor = JBUI.CurrentTheme.ProgressBar.WARNING;
105106
endColor = JBUI.CurrentTheme.ProgressBar.WARNING_END;
106107
} else {
@@ -186,12 +187,12 @@ protected void paintDeterminate(Graphics graphics, JComponent component) {
186187
graphics2D.fill(fullShape);
187188

188189
Color foreground = progressBar.getForeground();
189-
Object statusProperty = progressBar.getClientProperty(JBUI.CurrentTheme.ProgressBar.statusKey());
190-
if (JBUI.CurrentTheme.ProgressBar.failedStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
190+
Object statusProperty = progressBar.getClientProperty(ProgressBarUtil.STATUS_KEY);
191+
if (ProgressBarUtil.FAILED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
191192
graphics.setColor(JBUI.CurrentTheme.ProgressBar.FAILED);
192-
} else if (JBUI.CurrentTheme.ProgressBar.passedStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.PASSED) {
193+
} else if (ProgressBarUtil.PASSED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.PASSED) {
193194
graphics.setColor(JBUI.CurrentTheme.ProgressBar.PASSED);
194-
} else if (JBUI.CurrentTheme.ProgressBar.warningStatusValue().equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.WARNING) {
195+
} else if (ProgressBarUtil.WARNING_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.WARNING) {
195196
graphics.setColor(JBUI.CurrentTheme.ProgressBar.WARNING);
196197
} else {
197198
graphics2D.setColor(JBUI.CurrentTheme.ProgressBar.PROGRESS);

0 commit comments

Comments
 (0)