Skip to content

Commit cff54ac

Browse files
Merge pull request #131 from strangelookingnerd/updates
Update with changes from template and baseline
2 parents 42f7f0c + 2158d2d commit cff54ac

File tree

12 files changed

+79
-51
lines changed

12 files changed

+79
-51
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ jobs:
149149
- name: Fetch Sources
150150
uses: actions/checkout@v6
151151
with:
152-
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
153-
fetch-depth: 0 # a full history is required for pull request analysis
152+
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
153+
fetch-depth: 0 # a full history is required for pull request analysis
154154

155155
# Set up the Java environment for the next steps
156156
- name: Setup Java
@@ -246,6 +246,7 @@ jobs:
246246
VERSION=$(./gradlew properties --property version --quiet --console=plain | tail -n 1 | cut -f2- -d ' ')
247247
RELEASE_NOTE="./build/tmp/release_note.txt"
248248
./gradlew getChangelog --unreleased --no-header --quiet --console=plain --output-file=$RELEASE_NOTE
249+
249250
gh release create $VERSION \
250251
--draft \
251252
--title $VERSION \

.github/workflows/release.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,6 @@ jobs:
4444
with:
4545
cache-read-only: true
4646

47-
# Set environment variables
48-
- name: Export Properties
49-
id: properties
50-
shell: bash
51-
run: |
52-
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
53-
${{ github.event.release.body }}
54-
EOM
55-
)"
56-
57-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
58-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
59-
echo "EOF" >> $GITHUB_OUTPUT
60-
6147
# Update the Unreleased section with the current release note
6248
- name: Patch Changelog
6349
if: ${{ github.event.release.body != '' }}
@@ -67,6 +53,7 @@ jobs:
6753
RELEASE_NOTE="./build/tmp/release_note.txt"
6854
mkdir -p "$(dirname "$RELEASE_NOTE")"
6955
echo "$CHANGELOG" > $RELEASE_NOTE
56+
7057
./gradlew patchChangelog --release-note-file=$RELEASE_NOTE
7158
7259
# Publish the plugin to JetBrains Marketplace
@@ -86,7 +73,7 @@ jobs:
8673

8774
# Create a pull request
8875
- name: Create Pull Request
89-
if: ${{ steps.properties.outputs.changelog != '' }}
76+
if: ${{ github.event.release.body != '' }}
9077
env:
9178
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9279
run: |
@@ -100,7 +87,7 @@ jobs:
10087
git checkout -b $BRANCH
10188
git commit -am "Changelog update - $VERSION"
10289
git push --set-upstream origin $BRANCH
103-
90+
10491
gh label create "$LABEL" \
10592
--description "Pull requests with release changelog update" \
10693
--force \

.run/Run Plugin.run.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
</option>
1717
<option name="vmOptions" value="" />
1818
</ExternalSystemSettings>
19-
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
19+
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
2020
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
2121
<DebugAllEnabled>false</DebugAllEnabled>
2222
<RunAsTest>false</RunAsTest>
2323
<method v="2" />
2424
</configuration>
25-
</component>
25+
</component>

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Require 2025.3
10+
- Pull changes from `DarculaProgressBarUI`
11+
- Pull changes from plugin template
12+
713
## [0.0.9] - 2025-04-17
814

915
### Added

build.gradle.kts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repositories {
2929
}
3030
}
3131

32-
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
32+
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/version_catalogs.html
3333
dependencies {
3434
testImplementation(libs.junit5)
3535
testImplementation(libs.opentest4j)
@@ -38,15 +38,15 @@ dependencies {
3838

3939
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
4040
intellijPlatform {
41-
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
41+
intellijIdea(providers.gradleProperty("platformVersion"))
4242

4343
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
4444
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
4545

4646
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
4747
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
4848

49-
// Plugin Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
49+
// Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
5050
bundledModules(providers.gradleProperty("platformBundledModules").map { it.split(',') })
5151

5252
testFramework(TestFrameworkType.JUnit5)
@@ -59,7 +59,7 @@ intellijPlatform {
5959
buildSearchableOptions = false
6060

6161
pluginConfiguration {
62-
// name = providers.gradleProperty("pluginName") // do not patch name
62+
name = providers.gradleProperty("pluginName")
6363
version = providers.gradleProperty("pluginVersion")
6464

6565
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
@@ -90,7 +90,6 @@ intellijPlatform {
9090

9191
ideaVersion {
9292
sinceBuild = providers.gradleProperty("pluginSinceBuild")
93-
untilBuild = provider { null } // providers.gradleProperty("pluginUntilBuild")
9493
}
9594
}
9695

@@ -104,7 +103,7 @@ intellijPlatform {
104103
token = providers.environmentVariable("PUBLISH_TOKEN")
105104
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
106105
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
107-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
106+
// https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
108107
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
109108
}
110109

@@ -121,7 +120,7 @@ changelog {
121120
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
122121
}
123122

124-
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
123+
// Configure Gradle Kover Plugin - read more: https://kotlin.github.io/kotlinx-kover/gradle-plugin/#configuration-details
125124
kover {
126125
reports {
127126
total {

gradle.properties

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
22

33
pluginGroup = com.github.strangelookingnerd
4-
pluginName = pedro-progress-bar
4+
pluginName = Pedro Progress Bar
55
pluginRepositoryUrl = https://github.com/strangelookingnerd/pedro-progress-bar-plugin
66
# SemVer format -> https://semver.org
77
pluginVersion = 0.0.10
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10-
pluginSinceBuild = 251
11-
pluginUntilBuild =
10+
pluginSinceBuild = 253
1211

1312
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
14-
platformType = IC
15-
platformVersion = 2025.1
13+
platformVersion = 2025.3
1614

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ public static ImageIcon getScaledIcon() {
6464
};
6565
}
6666
}
67-

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,3 @@ private void updateProgressBar() {
5353
UIManager.getDefaults().put(PedroProgressBarUI.class.getName(), PedroProgressBarUI.class);
5454
}
5555
}
56-

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

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@
4343
import java.awt.Graphics;
4444
import java.awt.Graphics2D;
4545
import java.awt.Insets;
46+
import java.awt.Paint;
47+
import java.awt.PaintContext;
4648
import java.awt.Point;
4749
import java.awt.Rectangle;
4850
import java.awt.RenderingHints;
4951
import java.awt.Shape;
5052
import java.awt.geom.AffineTransform;
5153
import java.awt.geom.Rectangle2D;
5254
import java.awt.geom.RoundRectangle2D;
55+
import java.awt.image.ColorModel;
5356

5457
/**
5558
* The actual progress bar implementation. Heavily inspired by {@link com.intellij.ide.ui.laf.darcula.ui.DarculaProgressBarUI}
@@ -95,6 +98,7 @@ protected void paintIndeterminate(Graphics graphics, JComponent component) {
9598
Color endColor;
9699
Color foreground = progressBar.getForeground();
97100
Object statusProperty = progressBar.getClientProperty(ProgressBarUtil.STATUS_KEY);
101+
98102
if (ProgressBarUtil.FAILED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
99103
startColor = JBUI.CurrentTheme.ProgressBar.FAILED;
100104
endColor = JBUI.CurrentTheme.ProgressBar.FAILED_END;
@@ -169,8 +173,9 @@ protected void paintDeterminate(Graphics graphics, JComponent component) {
169173

170174
Shape fullShape;
171175
Shape coloredShape;
172-
int orientation = progressBar.getOrientation();
173-
if (orientation == SwingConstants.HORIZONTAL) {
176+
boolean horizontalOrientation = progressBar.getOrientation() == SwingConstants.HORIZONTAL;
177+
178+
if (horizontalOrientation) {
174179
int pHeight = getStripeWidth();
175180
int yOffset = r.y + (r.height - pHeight) / 2;
176181

@@ -188,19 +193,23 @@ protected void paintDeterminate(Graphics graphics, JComponent component) {
188193

189194
Color foreground = progressBar.getForeground();
190195
Object statusProperty = progressBar.getClientProperty(ProgressBarUtil.STATUS_KEY);
191-
if (ProgressBarUtil.FAILED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
192-
graphics.setColor(JBUI.CurrentTheme.ProgressBar.FAILED);
196+
197+
if (progressBar.getClientProperty(ProgressBarUtil.PROGRESS_PAINT_KEY) instanceof Paint progressPaint) {
198+
PaintTransformer paint = new PaintTransformer(progressPaint, horizontalOrientation, horizontalOrientation ? r.x : r.y, amountFull);
199+
graphics2D.setPaint(paint);
200+
} else if (ProgressBarUtil.FAILED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.FAILED) {
201+
graphics2D.setColor(JBUI.CurrentTheme.ProgressBar.FAILED);
193202
} else if (ProgressBarUtil.PASSED_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.PASSED) {
194-
graphics.setColor(JBUI.CurrentTheme.ProgressBar.PASSED);
203+
graphics2D.setColor(JBUI.CurrentTheme.ProgressBar.PASSED);
195204
} else if (ProgressBarUtil.WARNING_VALUE.equals(statusProperty) || foreground == JBUI.CurrentTheme.ProgressBar.WARNING) {
196-
graphics.setColor(JBUI.CurrentTheme.ProgressBar.WARNING);
205+
graphics2D.setColor(JBUI.CurrentTheme.ProgressBar.WARNING);
197206
} else {
198207
graphics2D.setColor(JBUI.CurrentTheme.ProgressBar.PROGRESS);
199208
}
200209
graphics2D.fill(coloredShape);
201210

202211
ImageIcon icon = PedroIcons.getScaledIcon();
203-
if (orientation == SwingConstants.HORIZONTAL) {
212+
if (horizontalOrientation) {
204213
icon.paintIcon(progressBar, graphics2D, amountFull, r.y);
205214
} else {
206215
icon.paintIcon(progressBar, graphics2D, r.x, amountFull);
@@ -280,4 +289,35 @@ private void paintString(Graphics2D graphics2D, int x, int y, int w, int h, int
280289
}
281290
graphics2D.setClip(oldClip);
282291
}
283-
}
292+
293+
private record PaintTransformer(Paint originalPaint, boolean isHorizontal, int start, int size) implements Paint {
294+
295+
@Override
296+
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) {
297+
AffineTransform transform = xform == null ? new AffineTransform() : (AffineTransform) xform.clone();
298+
299+
if (start != 0) {
300+
if (isHorizontal) {
301+
transform.translate(start, 0);
302+
} else {
303+
transform.translate(0, start);
304+
}
305+
}
306+
307+
if (size > 0) {
308+
transform.scale(size, size);
309+
}
310+
311+
if (!isHorizontal) {
312+
transform.rotate(Math.toRadians(90), 0, 0);
313+
}
314+
315+
return originalPaint.createContext(cm, deviceBounds, userBounds, transform, hints);
316+
}
317+
318+
@Override
319+
public int getTransparency() {
320+
return originalPaint.getTransparency();
321+
}
322+
}
323+
}

src/test/java/com/github/strangelookingnerd/PedroIconsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ class PedroIconsTest {
4141

4242
private static final Pattern DESCRIPTION_PATTERN = Pattern.compile("^Pedro (\\d\\d)x(\\d\\d)$");
4343

44-
@ParameterizedTest
45-
@ValueSource(floats = {0.75F, 1F, 1.1F, 1.25F, 1.5F, 1.75F, 2F, 3F})
46-
void scaling(float scaleFactor) {
47-
JBUIScale.setUserScaleFactorForTest(scaleFactor);
44+
@ParameterizedTest(name = "{0}%")
45+
@ValueSource(ints = {75, 100, 110, 125, 150, 175, 200, 300})
46+
void scaling(int scale) {
47+
JBUIScale.setUserScaleFactorForTest(scale / 100F);
4848

4949
ImageIcon icon = PedroIcons.getScaledIcon();
5050
assertNotNull(icon);
5151

52-
if (scaleFactor < 1F || scaleFactor > 2F) {
52+
if (scale < 100 || scale > 200) {
5353
assertNull(icon.getImage());
5454
assertNull(icon.getDescription());
5555
} else {
@@ -61,4 +61,4 @@ void scaling(float scaleFactor) {
6161
assertEquals(Integer.valueOf(matcher.group(2)), icon.getIconHeight());
6262
}
6363
}
64-
}
64+
}

0 commit comments

Comments
 (0)