Skip to content

Commit b453a04

Browse files
committed
Build against IDEA 2024.1.7 (was 2023.1.5)
1 parent b4963f7 commit b453a04

File tree

12 files changed

+47
-253
lines changed

12 files changed

+47
-253
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
# CheckStyle-IDEA Changelog
33

4+
* **5.106.0** New: Now built against IDEA 2024.1.7 (was 2023.1.5).
45
* **5.105.0** New: Added Checkstyle 10.23.0 (#663).
56
* **5.104.1** Fixed: Code importer now parses import order with comma separators (#658).
67
* **5.104.1** Fixed: Code importer now correctly parses tokens in newer Google configurations (#657).

build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
id("org.infernus.idea.checkstyle.build")
2020
}
2121

22-
version = "5.105.0"
22+
version = "5.106.0"
2323

2424
intellijPlatform {
2525
pluginConfiguration {
@@ -82,7 +82,8 @@ configurations.configureEach {
8282

8383
dependencies {
8484
intellijPlatform {
85-
intellijIdeaCommunity("2023.1.5")
85+
// Update reference in GradlePluginMain on change
86+
intellijIdeaCommunity("2024.1.7")
8687

8788
bundledPlugin("com.intellij.java")
8889

buildSrc/src/main/java/org/infernus/idea/checkstyle/build/GradlePluginMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private void createCopyClassesToSandboxTask(final Project project, final boolean
187187

188188
private @NotNull String pluginSandboxDir(final boolean test, final String subDirectory) {
189189
// must remain in sync with task configuration in Gradle file
190-
return "idea-sandbox/IC-2023.1.5/plugins"
190+
return "idea-sandbox/IC-2024.1.7/plugins"
191191
+ (test ? "-test" : "")
192192
+ "/checkstyle-idea/" + subDirectory;
193193
}

src/main/java/org/infernus/idea/checkstyle/toolwindow/CheckStyleToolWindowPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private void scrollToError(final TreePath treePath) {
320320
textEditor.getCaretModel().moveToLogicalPosition(problemPos);
321321
textEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
322322
}
323-
}, ModalityState.NON_MODAL);
323+
}, ModalityState.nonModal());
324324
}
325325

326326
private int lineFor(final ProblemResultTreeInfo nodeInfo) {

src/main/java/org/infernus/idea/checkstyle/ui/CheckStyleConfigPanel.java

Lines changed: 27 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
import javax.swing.*;
3030
import javax.swing.table.TableColumn;
3131
import java.awt.*;
32-
import java.awt.event.ActionEvent;
33-
import java.io.Serial;
34-
import java.util.List;
3532
import java.util.*;
33+
import java.util.List;
3634
import java.util.stream.Collectors;
3735

3836
import static java.util.Objects.requireNonNullElseGet;
@@ -266,18 +264,9 @@ public PluginConfiguration getPluginConfiguration() {
266264
/**
267265
* Process the addition of a configuration location.
268266
*/
269-
private final class AddLocationAction extends ToolbarAction {
270-
@Serial
271-
private static final long serialVersionUID = -7266120887003483814L;
272-
273-
AddLocationAction() {
274-
putValue(Action.NAME, CheckStyleBundle.message("config.file.add.text"));
275-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.file.add.tooltip"));
276-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.file.add.tooltip"));
277-
}
278-
267+
private final class AddLocationAction implements AnActionButtonRunnable {
279268
@Override
280-
public void actionPerformed(final ActionEvent e) {
269+
public void run(final AnActionButton anActionButton) {
281270
final LocationDialogue dialogue = new LocationDialogue(
282271
parentDialogue(),
283272
project,
@@ -306,18 +295,9 @@ private Dialog parentDialogue() {
306295
/**
307296
* Process the removal of a configuration location.
308297
*/
309-
private final class RemoveLocationAction extends ToolbarAction {
310-
@Serial
311-
private static final long serialVersionUID = -799542186049804472L;
312-
313-
RemoveLocationAction() {
314-
putValue(Action.NAME, CheckStyleBundle.message("config.file.remove.text"));
315-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.file.remove.tooltip"));
316-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.file.remove.tooltip"));
317-
}
318-
298+
private final class RemoveLocationAction implements AnActionButtonRunnable {
319299
@Override
320-
public void actionPerformed(final ActionEvent e) {
300+
public void run(final AnActionButton anActionButton) {
321301
final int selectedIndex = locationTable.getSelectedRow();
322302
if (selectedIndex == -1) {
323303
return;
@@ -330,18 +310,9 @@ public void actionPerformed(final ActionEvent e) {
330310
/**
331311
* Edit the properties of a configuration location.
332312
*/
333-
private final class EditPropertiesAction extends ToolbarAction {
334-
@Serial
335-
private static final long serialVersionUID = -799542186049804472L;
336-
337-
EditPropertiesAction() {
338-
putValue(Action.NAME, CheckStyleBundle.message("config.file.properties.text"));
339-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.file.properties.tooltip"));
340-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.file.properties.tooltip"));
341-
}
342-
313+
private final class EditPropertiesAction implements AnActionButtonRunnable {
343314
@Override
344-
public void actionPerformed(final ActionEvent e) {
315+
public void run(final AnActionButton anActionButton) {
345316
final int selectedIndex = locationTable.getSelectedRow();
346317
if (selectedIndex == -1) {
347318
return;
@@ -360,39 +331,13 @@ public void actionPerformed(final ActionEvent e) {
360331
}
361332
}
362333

363-
abstract static class ToolbarAction extends AbstractAction implements AnActionButtonRunnable {
364-
@Serial
365-
private static final long serialVersionUID = 7091312536206510956L;
366-
367-
@Override
368-
public void run(final AnActionButton anActionButton) {
369-
actionPerformed(null);
370-
}
371-
}
372-
373334
/**
374335
* Process the addition of a path element.
375336
*/
376-
private final class AddPathAction extends ToolbarAction {
377-
@Serial
378-
private static final long serialVersionUID = -1389576037231727360L;
379-
380-
/**
381-
* Create a new add path action.
382-
*/
383-
AddPathAction() {
384-
putValue(Action.NAME, CheckStyleBundle.message("config.path.add.text"));
385-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.path.add.tooltip"));
386-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.path.add.tooltip"));
387-
}
388-
337+
private final class AddPathAction implements AnActionButtonRunnable {
389338
@Override
390-
public void actionPerformed(final ActionEvent e) {
391-
final FileChooserDescriptor descriptor = new ExtensionFileChooserDescriptor(
392-
(String) getValue(Action.NAME),
393-
(String) getValue(Action.SHORT_DESCRIPTION),
394-
false, "jar");
395-
final VirtualFile chosen = FileChooser.chooseFile(descriptor, CheckStyleConfigPanel.this, project, ProjectUtil.guessProjectDir(project));
339+
public void run(final AnActionButton anActionButton) {
340+
final VirtualFile chosen = FileChooser.chooseFile(checkStyleRulesFileChooserDescriptor(), CheckStyleConfigPanel.this, project, ProjectUtil.guessProjectDir(project));
396341
if (chosen != null) {
397342
(pathListModel()).addElement(
398343
VfsUtilCore.virtualToIoFile(chosen).getAbsolutePath());
@@ -401,24 +346,20 @@ public void actionPerformed(final ActionEvent e) {
401346
}
402347
}
403348

349+
private FileChooserDescriptor checkStyleRulesFileChooserDescriptor() {
350+
return new FileChooserDescriptor(true, false, true, true, false, false)
351+
.withFileFilter((file) -> {
352+
final String currentExtension = file.getExtension();
353+
return currentExtension != null && "jar".equalsIgnoreCase(currentExtension.trim());
354+
});
355+
}
356+
404357
/**
405358
* Process the editing of a path element.
406359
*/
407-
private final class EditPathAction extends ToolbarAction {
408-
@Serial
409-
private static final long serialVersionUID = -1455378231580505750L;
410-
411-
/**
412-
* Create a new edit path action.
413-
*/
414-
EditPathAction() {
415-
putValue(Action.NAME, CheckStyleBundle.message("config.path.edit.text"));
416-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.path.edit.tooltip"));
417-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.path.edit.tooltip"));
418-
}
419-
360+
private final class EditPathAction implements AnActionButtonRunnable {
420361
@Override
421-
public void actionPerformed(final ActionEvent e) {
362+
public void run(final AnActionButton anActionButton) {
422363
final int selected = pathList.getSelectedIndex();
423364
if (selected < 0) {
424365
return;
@@ -427,12 +368,8 @@ public void actionPerformed(final ActionEvent e) {
427368
final DefaultListModel<String> listModel = pathListModel();
428369
final String selectedFile = listModel.get(selected);
429370

430-
final FileChooserDescriptor descriptor = new ExtensionFileChooserDescriptor(
431-
(String) getValue(Action.NAME),
432-
(String) getValue(Action.SHORT_DESCRIPTION),
433-
false, "jar");
434371
final VirtualFile toSelect = LocalFileSystem.getInstance().findFileByPath(selectedFile);
435-
final VirtualFile chosen = FileChooser.chooseFile(descriptor, project, toSelect);
372+
final VirtualFile chosen = FileChooser.chooseFile(checkStyleRulesFileChooserDescriptor(), project, toSelect);
436373
if (chosen != null) {
437374
listModel.remove(selected);
438375
listModel.add(selected, VfsUtilCore.virtualToIoFile(chosen).getAbsolutePath());
@@ -445,21 +382,9 @@ public void actionPerformed(final ActionEvent e) {
445382
/**
446383
* Process the removal of a path element.
447384
*/
448-
private final class RemovePathAction extends ToolbarAction {
449-
@Serial
450-
private static final long serialVersionUID = 7339136485307147623L;
451-
452-
/**
453-
* Create a new add path action.
454-
*/
455-
RemovePathAction() {
456-
putValue(Action.NAME, CheckStyleBundle.message("config.path.remove.text"));
457-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.path.remove.tooltip"));
458-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.path.remove.tooltip"));
459-
}
460-
385+
private final class RemovePathAction implements AnActionButtonRunnable {
461386
@Override
462-
public void actionPerformed(final ActionEvent e) {
387+
public void run(final AnActionButton anActionButton) {
463388
final int[] selected = pathList.getSelectedIndices();
464389
if (selected == null || selected.length == 0) {
465390
return;
@@ -475,21 +400,9 @@ public void actionPerformed(final ActionEvent e) {
475400
/**
476401
* Process the move up of a path element.
477402
*/
478-
private final class MoveUpPathAction extends ToolbarAction {
479-
@Serial
480-
private static final long serialVersionUID = -1230778908605654344L;
481-
482-
/**
483-
* Create a new move-up path action.
484-
*/
485-
MoveUpPathAction() {
486-
putValue(Action.NAME, CheckStyleBundle.message("config.path.move-up.text"));
487-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.path.move-up.tooltip"));
488-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.path.move-up.tooltip"));
489-
}
490-
403+
private final class MoveUpPathAction implements AnActionButtonRunnable {
491404
@Override
492-
public void actionPerformed(final ActionEvent e) {
405+
public void run(final AnActionButton anActionButton) {
493406
final int selected = pathList.getSelectedIndex();
494407
if (selected < 1) {
495408
return;
@@ -506,21 +419,9 @@ public void actionPerformed(final ActionEvent e) {
506419
/**
507420
* Process the move down of a path element.
508421
*/
509-
private final class MoveDownPathAction extends ToolbarAction {
510-
@Serial
511-
private static final long serialVersionUID = 1222511743014969175L;
512-
513-
/**
514-
* Create a new move-down path action.
515-
*/
516-
MoveDownPathAction() {
517-
putValue(Action.NAME, CheckStyleBundle.message("config.path.move-down.text"));
518-
putValue(Action.SHORT_DESCRIPTION, CheckStyleBundle.message("config.path.move-down.tooltip"));
519-
putValue(Action.LONG_DESCRIPTION, CheckStyleBundle.message("config.path.move-down.tooltip"));
520-
}
521-
422+
private final class MoveDownPathAction implements AnActionButtonRunnable {
522423
@Override
523-
public void actionPerformed(final ActionEvent e) {
424+
public void run(final AnActionButton anActionButton) {
524425
final DefaultListModel<String> listModel = pathListModel();
525426
final int selected = pathList.getSelectedIndex();
526427
if (selected == -1 || selected == (listModel.getSize() - 1)) {

src/main/java/org/infernus/idea/checkstyle/ui/ExtensionFileChooserDescriptor.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/main/java/org/infernus/idea/checkstyle/ui/LocationDialogue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public LocationDialogue(@Nullable final Dialog parent,
8585
@Nullable final String checkstyleVersion,
8686
@Nullable final List<String> thirdPartyClasspath,
8787
@NotNull final CheckstyleProjectService checkstyleProjectService) {
88-
super(project, parent, false, IdeModalityType.PROJECT);
88+
super(project, parent, false, IdeModalityType.IDE);
8989

9090
this.project = project;
9191
this.checkstyleProjectService = checkstyleProjectService;

0 commit comments

Comments
 (0)