Skip to content

Commit

Permalink
remove deprecated warnings (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
cschar authored Feb 17, 2025
1 parent d57f82a commit 7bfaf62
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# power-mode-zeranthium Changelog

## [Unreleased]
- 2025.1 update
- removed deprecated API usage

## [3.4.0-stable.242] - 2024-07-16

Expand Down
18 changes: 11 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ pluginRepositoryUrl = https://github.com/cschar/power-mode-zeranthium
# SemVer format -> https://semver.org
#pluginVersion = 1.14.0
#pluginVersion = 3.4.0-eap.242
pluginVersion = 3.4.0-stable.242
#pluginVersion = 3.4.1-stable.251
pluginVersion = 3.4.1-stable.243

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
#pluginSinceBuild = 241
pluginSinceBuild = 242
# when running ./gradlew :verifyPlugin, will start at below VERSION_NUM and check all going forward
# report .html files will appear in ./build/reports/pluginVerifier/IC-<VERSION_NUM>/report.html
pluginSinceBuild = 243
#pluginSinceBuild = 251

# Not specifying until-build means it will include all future builds.
#pluginUntilBuild = 242.*
Expand All @@ -26,10 +29,11 @@ pluginSinceBuild = 242
platformType = IC
#/#platformVersion = 2023.2.6

# latest builds -> https://youtrack.jetbrains.com/articles/IDEA-A-2100661971/IntelliJ-IDEA-2024.2-Latest-Builds
# https://youtrack.jetbrains.com/articles/IDEA-A-2100661992/IntelliJ-IDEA-2024.2-EAP-4-242.15523.18-build-Release-Notes
platformVersion = 242.20224.38
#platformVersion = 242.14146.16
# latest build
# https://youtrack.jetbrains.com/articles/IDEA-A-21/IDEA-Latest-Builds-And-Release-Notes
# Find the platformVersion there
#platformVersion = 251.18673.35
platformVersion = 242.14146.16
#platformVersion = 2024.1.2
#platformVersion = LATEST-EAP-SNAPSHOT

Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/cschar/pmode3/PowerMode3.java
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,17 @@ public void loadState(@NotNull PowerMode3 state) {

public void loadConfigData() {
Task.Backgroundable bgTask = new Task.Backgroundable(null, "Zeranthium Setup...",
false, null) {
false) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
loadConfigDataAsync(progressIndicator);
}
};
ProgressManager.getInstance().run(bgTask);

// see
// https://plugins.jetbrains.com/docs/intellij/background-processes.html#progress-api
// bgTask.queue();
}

@com.intellij.util.xmlb.annotations.Transient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ public Object getValueAt(int row, int column) {
final JButton button = new JButton("Set path");
button.addActionListener(arg0 -> {

FileChooserDescriptor fd = new FileChooserDescriptor(true, false, false, false, false, false);
fd = new SoundFileChooserDescriptor(fd);
// fd.setForcedToUseIdeaFileChooser(true);
FileChooserDescriptor fd = new SoundFileChooserDescriptor.Builder().build();

FileChooserDialog fcDialog = FileChooserFactory.getInstance().createFileChooser(fd, null, null);
VirtualFile[] vfs = fcDialog.choose(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public Object getValueAt(int row, int column) {
button.addActionListener(arg0 -> {


FileChooserDescriptor fd = new FileChooserDescriptor(true, false, false, false, false, false);
fd = new SoundFileChooserDescriptor(fd);

FileChooserDescriptor fd = new SoundFileChooserDescriptor.Builder().build();

FileChooserDialog fcDialog = FileChooserFactory.getInstance().createFileChooser(fd, null, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ public Object getValueAt(int row, int column) {
final JButton button = new JButton("Set path");
button.addActionListener(arg0 -> {

FileChooserDescriptor fd = new FileChooserDescriptor(true, false, false, false, false, false);
fd = new SoundFileChooserDescriptor(fd);
// fd.setForcedToUseIdeaFileChooser(true);
FileChooserDescriptor fd = new SoundFileChooserDescriptor.Builder().build();


FileChooserDialog fcDialog = FileChooserFactory.getInstance().createFileChooser(fd, null, null);
VirtualFile[] vfs = fcDialog.choose(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public Object getValueAt(int row, int column) {
final JButton button = new JButton("Set path");
button.addActionListener(arg0 -> {

FileChooserDescriptor fd = new FileChooserDescriptor(true, false, false, false, false, false);
fd = new SoundFileChooserDescriptor(fd);
FileChooserDescriptor fd = new SoundFileChooserDescriptor.Builder().build();

FileChooserDialog fcDialog = FileChooserFactory.getInstance().createFileChooser(fd, null, null);
VirtualFile[] vfs = fcDialog.choose(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cschar.pmode3.config.common.ui;

import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

Expand All @@ -9,29 +10,23 @@
public class SoundFileChooserDescriptor extends FileChooserDescriptor {

String myTitle = "Pick a MP3 File";
public SoundFileChooserDescriptor(boolean chooseFiles, boolean chooseFolders, boolean chooseJars, boolean chooseJarsAsFiles, boolean chooseJarContents, boolean chooseMultiple) {
super(chooseFiles, chooseFolders, chooseJars, chooseJarsAsFiles, chooseJarContents, chooseMultiple);
this.setTitle(myTitle);

//MACOS doesnt respect overloads in native file browser
this.setForcedToUseIdeaFileChooser(true);

}

public SoundFileChooserDescriptor(@NotNull FileChooserDescriptor d) {
private SoundFileChooserDescriptor(@NotNull FileChooserDescriptor d) {
super(d);
this.setTitle(myTitle);
this.withFileFilter(file -> "mp3".equals(file.getExtension()));
//MACOS doesnt respect overloads in native file browser
this.setForcedToUseIdeaFileChooser(true);
}

@Override
public boolean isFileSelectable(VirtualFile file) {
boolean isSuperSelectable = super.isFileSelectable(file);
boolean isSound = Objects.equals(file.getExtension(), "mp3");

return isSuperSelectable && isSound;

public static class Builder {
public Builder() {}
public SoundFileChooserDescriptor build() {
FileChooserDescriptor fd = new FileChooserDescriptor(
true, false, false,
false, false, false);
// fd.withExtensionFilter(".mp3", "*.mp3");
return new SoundFileChooserDescriptor(fd);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,11 @@ public void actionPerformed(ActionEvent e) {
// Task.Modal task = new Task.Modal(null, downloadBUtton,
// "Cloning "+customRepoName+"...",
// true) {


Task.Backgroundable task = new Task.Backgroundable(null,
"Cloning "+customRepoName+"...",
true, null) {
true) {

@Override
public void onCancel() {
Expand Down Expand Up @@ -400,9 +402,10 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
}
}
};

LOGGER.trace("Launching cloning task from thread " + Thread.currentThread().toString());
// ProgressManager.getInstance().run(bgTask2);
// gitService.backgroundTasks.put(customRepoName, bgTask2);

// task.setCancelText("Stop cloning " + customRepoName).queue();
ProgressManager.getInstance().run(task);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void dispose() {
@Override
public void updateUi() {
Task.Backgroundable bgTask = new Task.Backgroundable(null, "Zeranthium Config...",
false, null) {
false) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
while (menuConfigurableUI != null && menuConfigurableUI.refreshMemoryWidget) {
Expand All @@ -53,6 +53,9 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
}
}
};


// bgTask.setCancelText("stop updating config").queue();
ProgressManager.getInstance().run(bgTask);


Expand Down

0 comments on commit 7bfaf62

Please sign in to comment.