From d28ea10a188768f4ec2668359e85e34556212d26 Mon Sep 17 00:00:00 2001 From: epark272 Date: Mon, 12 Aug 2024 11:00:08 -0700 Subject: [PATCH] Update deprecated ActionUpdateThread --- gradle.properties | 2 +- .../cs61b/plugin/CheckStyleAction.java | 34 ++++++++++++------- .../berkeley/cs61b/plugin/SettingsAction.java | 9 ++++- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index f5d38d0..96e816a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = edu.berkeley.cs61b.plugin pluginName = CS 61B # SemVer format -> https://semver.org -pluginVersion = 2.0.14 +pluginVersion = 2.0.15 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 213 diff --git a/src/main/java/edu/berkeley/cs61b/plugin/CheckStyleAction.java b/src/main/java/edu/berkeley/cs61b/plugin/CheckStyleAction.java index 76b18d9..dc883ff 100644 --- a/src/main/java/edu/berkeley/cs61b/plugin/CheckStyleAction.java +++ b/src/main/java/edu/berkeley/cs61b/plugin/CheckStyleAction.java @@ -1,8 +1,24 @@ package edu.berkeley.cs61b.plugin; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import org.jetbrains.annotations.NotNull; +import org.xml.sax.InputSource; + import com.intellij.execution.filters.OpenFileHyperlinkInfo; import com.intellij.execution.ui.ConsoleView; import com.intellij.execution.ui.ConsoleViewContentType; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; @@ -20,19 +36,6 @@ import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.AuditListener; import com.puppycrawl.tools.checkstyle.api.Configuration; -import org.xml.sax.InputSource; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; public class CheckStyleAction extends AnAction { private static final String CONFIG_ROOT = "style_config/"; @@ -84,6 +87,11 @@ public void actionPerformed(AnActionEvent event) { } } + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } + private void collectFiles(VirtualFile[] parent, List list) { LinkedList sources = new LinkedList<>(); Collections.addAll(sources, parent); diff --git a/src/main/java/edu/berkeley/cs61b/plugin/SettingsAction.java b/src/main/java/edu/berkeley/cs61b/plugin/SettingsAction.java index ed9c61b..13020d4 100644 --- a/src/main/java/edu/berkeley/cs61b/plugin/SettingsAction.java +++ b/src/main/java/edu/berkeley/cs61b/plugin/SettingsAction.java @@ -1,10 +1,12 @@ package edu.berkeley.cs61b.plugin; +import org.jetbrains.annotations.NotNull; + import com.intellij.ide.util.PropertiesComponent; +import com.intellij.openapi.actionSystem.ActionUpdateThread; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.ui.DialogWrapper; -import org.jetbrains.annotations.NotNull; public class SettingsAction extends AnAction { @Override @@ -19,4 +21,9 @@ public void actionPerformed(@NotNull AnActionEvent e) { props.setValue(PluginUtils.KEY_SEMESTER, form.getSemesterField().getText()); } } + + @Override + public @NotNull ActionUpdateThread getActionUpdateThread() { + return ActionUpdateThread.BGT; + } }