Skip to content

Commit

Permalink
Update deprecated ActionUpdateThread
Browse files Browse the repository at this point in the history
  • Loading branch information
epark272 committed Aug 12, 2024
1 parent 1b449f2 commit d28ea10
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 21 additions & 13 deletions src/main/java/edu/berkeley/cs61b/plugin/CheckStyleAction.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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/";
Expand Down Expand Up @@ -84,6 +87,11 @@ public void actionPerformed(AnActionEvent event) {
}
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}

private void collectFiles(VirtualFile[] parent, List<File> list) {
LinkedList<VirtualFile> sources = new LinkedList<>();
Collections.addAll(sources, parent);
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/edu/berkeley/cs61b/plugin/SettingsAction.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
}
}

0 comments on commit d28ea10

Please sign in to comment.