Skip to content

Commit

Permalink
Skip changelist check to ensure update action is fast enough on 'scan…
Browse files Browse the repository at this point in the history
… modified files' action (#615).
  • Loading branch information
jshiell committed Jun 5, 2023
1 parent 24b8748 commit 78094c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# CheckStyle-IDEA Changelog

* **5.80.1** Fixed: Skip changelist check to ensure update action is fast enough on 'scan modified files' action (#615).
* **5.80.0** New: Added Checkstyle 10.12.0.
* **5.79.0** New: Added Checkstyle 10.10.0.
* **5.78.0** New: Added Checkstyle 10.9.3.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

import java.util.List;

import static org.infernus.idea.checkstyle.actions.ToolWindowAccess.toolWindow;

/**
Expand All @@ -21,10 +24,12 @@ public class ScanModifiedFiles extends BaseAction {
public final void actionPerformed(final @NotNull AnActionEvent event) {
project(event).ifPresent(project -> {
try {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
staticScanner(project).asyncScanFiles(
changeListManager.getAffectedFiles(),
getSelectedOverride(toolWindow(project)));
List<VirtualFile> affectedFiles = ChangeListManager.getInstance(project).getAffectedFiles();
if (!affectedFiles.isEmpty()) {
staticScanner(project).asyncScanFiles(
affectedFiles,
getSelectedOverride(toolWindow(project)));
}
} catch (Throwable e) {
LOG.warn("Modified files scan failed", e);
}
Expand All @@ -37,11 +42,7 @@ public void update(final @NotNull AnActionEvent event) {

project(event).ifPresentOrElse(project -> {
try {
if (ChangeListManager.getInstance(project).getAffectedFiles().isEmpty()) {
presentation.setEnabled(false);
} else {
presentation.setEnabled(!staticScanner(project).isScanInProgress());
}
presentation.setEnabled(!staticScanner(project).isScanInProgress());

} catch (Throwable e) {
LOG.warn("Button update failed.", e);
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</p>
]]>
</description>
<version>5.80.0</version>
<version>5.80.1</version>
<idea-version since-build="221.6008.13"/>
<vendor url="https://infernus.org/" email="jamie@infernus.org">Jamie Shiell</vendor>

Expand All @@ -24,6 +24,7 @@
<change-notes>
<![CDATA[
<ul>
<li>5.80.1: Fixed: Skip changelist check to ensure update action is fast enough on 'scan modified files' action (#615).</li>
<li>5.80.0: New: Added Checkstyle 10.12.0.</li>
<li>5.79.0: New: Added Checkstyle 10.10.0.</li>
<li>5.78.0: New: Added Checkstyle 10.9.3.</li>
Expand Down

0 comments on commit 78094c0

Please sign in to comment.