Skip to content

Commit 8c13ebc

Browse files
authored
Merge pull request #1052 from SeeSharpSoft/main
Hotfix release 4.3.1
2 parents 2190d56 + 0e03c46 commit 8c13ebc

6 files changed

Lines changed: 77 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010

1111
### Fixed
1212

13+
## 4.3.1 - Jun 26, 2026
14+
15+
### Fixed
16+
17+
- Fixed `java.lang.IllegalStateException: This method is forbidden on EDT because it does not pump the event queue` when opening the table editor #1050
18+
- Fixed `RuntimeExceptionWithAttachments: Access is allowed from Event Dispatch Thread (EDT) only` in `CsvPlugin.openLink` #1008
19+
- Optimized `CsvFileEditorProvider.accept` to avoid `TimeoutCancellationException` by removing redundant service access. #1033
20+
1321
## 4.3.0 - Jun 21, 2026
1422

1523
### Changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
pluginName=CSV Editor
66
pluginId=net.seesharpsoft.intellij.plugins.csv
7-
pluginVersion=4.3.0
7+
pluginVersion=4.3.1
88

99
pluginSinceBuild=242
1010

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
public class CsvPlugin implements ProjectActivity, DumbAware {
2222

2323
private static void openLink(Project project, String link) {
24-
if (project.isDisposed()) return;
24+
if (project == null || project.isDisposed()) return;
2525

2626
if (link.startsWith("#")) {
27-
ApplicationManager.getApplication().executeOnPooledThread(() ->
27+
ApplicationManager.getApplication().invokeLater(() ->
2828
ShowSettingsUtil.getInstance().showSettingsDialog(project, link.substring(1))
2929
);
3030
} else {
@@ -62,40 +62,42 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
6262
@Override
6363
public @Nullable Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
6464
doAsyncProjectMaintenance(project);
65-
66-
NotificationGroup notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("net.seesharpsoft.intellij.plugins.csv");
67-
String version = CsvPluginManager.getVersion();
68-
if (version.isEmpty() || notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(version)) {
69-
return continuation;
70-
}
7165

72-
Notification notification = notificationGroup.createNotification(
73-
"CSV Editor " + version + " - Change Notes",
74-
CsvPluginManager.getChangeNotes() +
75-
"<p>You can always <b>customize plugin settings</b> to your likings (shortcuts below)!</p>" +
76-
"<br>" +
77-
"<p>Visit the <b>CSV Editor homepage</b> to read more about the available features & settings, " +
78-
"submit issues & feature request, " +
79-
"or show your support by rating this plugin. <b>Thanks!</b></p>"
80-
,
81-
NotificationType.INFORMATION
82-
);
66+
ApplicationManager.getApplication().invokeLater(() -> {
67+
NotificationGroup notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("net.seesharpsoft.intellij.plugins.csv");
68+
String version = CsvPluginManager.getVersion();
69+
if (version.isEmpty() || notificationGroup == null || CsvEditorSettings.getInstance().checkCurrentPluginVersion(version)) {
70+
return;
71+
}
8372

84-
notification.addAction(NotificationAction.create("General settings", (anActionEvent, notification1) -> {
85-
openLink(project, "#" + CsvEditorSettingsProvider.CSV_EDITOR_SETTINGS_ID);
86-
}));
87-
notification.addAction(NotificationAction.create("Color scheme", (anActionEvent, notification1) -> {
88-
openLink(project, "#reference.settingsdialog.IDE.editor.colors.CSV/TSV/PSV");
89-
}));
90-
notification.addAction(NotificationAction.create("Formatting", (anActionEvent, notification1) -> {
91-
openLink(project, "#preferences.sourceCode.CSV/TSV/PSV");
92-
}));
93-
notification.addAction(NotificationAction.create("Open CSV Editor homepage", (anActionEvent, notification1) -> {
94-
openLink(project, "https://github.com/SeeSharpSoft/intellij-csv-validator");
95-
}));
73+
Notification notification = notificationGroup.createNotification(
74+
"CSV Editor " + version + " - Change Notes",
75+
CsvPluginManager.getChangeNotes() +
76+
"<p>You can always <b>customize plugin settings</b> to your likings (shortcuts below)!</p>" +
77+
"<br>" +
78+
"<p>Visit the <b>CSV Editor homepage</b> to read more about the available features & settings, " +
79+
"submit issues & feature request, " +
80+
"or show your support by rating this plugin. <b>Thanks!</b></p>"
81+
,
82+
NotificationType.INFORMATION
83+
);
84+
85+
notification.addAction(NotificationAction.create("General settings", (anActionEvent, notification1) -> {
86+
openLink(project, "#" + CsvEditorSettingsProvider.CSV_EDITOR_SETTINGS_ID);
87+
}));
88+
notification.addAction(NotificationAction.create("Color scheme", (anActionEvent, notification1) -> {
89+
openLink(project, "#reference.settingsdialog.IDE.editor.colors.CSV/TSV/PSV");
90+
}));
91+
notification.addAction(NotificationAction.create("Formatting", (anActionEvent, notification1) -> {
92+
openLink(project, "#preferences.sourceCode.CSV/TSV/PSV");
93+
}));
94+
notification.addAction(NotificationAction.create("Open CSV Editor homepage", (anActionEvent, notification1) -> {
95+
openLink(project, "https://github.com/SeeSharpSoft/intellij-csv-validator");
96+
}));
97+
98+
Notifications.Bus.notify(notification);
99+
});
96100

97-
Notifications.Bus.notify(notification);
98-
99101
return continuation;
100102
}
101103
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvFileEditorProvider.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,8 @@ public static boolean acceptCsvFile(@NotNull Project project, @NotNull VirtualFi
4949
@Override
5050
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
5151
// Guard against cases where the platform TextEditor can't be created for the given file
52-
// (e.g., special virtual files used by Structure View or diff). In such cases, delegating
53-
// to TextEditorProvider would lead to NPEs inside platform code.
54-
if (!CsvFileEditorProvider.acceptCsvFile(project, file)) {
55-
return false;
56-
}
57-
try {
58-
TextEditorProvider textEditorProvider = TextEditorProvider.getInstance();
59-
return textEditorProvider != null && textEditorProvider.accept(project, file);
60-
} catch (Throwable t) {
61-
// Be conservative on any unexpected error and do not accept the file to avoid IDE crashes.
62-
return false;
63-
}
52+
// (e.g., special virtual files used by Structure View or diff).
53+
return CsvFileEditorProvider.acceptCsvFile(project, file);
6454
}
6555

6656
protected void applySettings(EditorSettings editorSettings, CsvEditorSettings csvEditorSettings) {

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,24 @@ public final CsvFile getCsvFile() {
238238
}
239239

240240
if (this.psiFile != null) {
241-
this.currentSeparator = CsvHelper.getValueSeparator(this.psiFile);
242-
this.currentEscapeCharacter = CsvHelper.getEscapeCharacter(this.psiFile);
241+
if (ApplicationManager.getApplication().isDispatchThread()) {
242+
// On EDT, we try to avoid initializing services that might block (see #940)
243+
ReadAction.nonBlocking(() -> {
244+
this.currentSeparator = CsvHelper.getValueSeparator(this.psiFile);
245+
this.currentEscapeCharacter = CsvHelper.getEscapeCharacter(this.psiFile);
246+
return null;
247+
})
248+
.finishOnUiThread(com.intellij.openapi.application.ModalityState.any(), unused -> {
249+
CsvTableModel tableModel = getTableModel();
250+
if (tableModel != null) {
251+
tableModel.notifyUpdate();
252+
}
253+
})
254+
.submit(com.intellij.util.concurrency.AppExecutorUtil.getAppExecutorService());
255+
} else {
256+
this.currentSeparator = CsvHelper.getValueSeparator(this.psiFile);
257+
this.currentEscapeCharacter = CsvHelper.getEscapeCharacter(this.psiFile);
258+
}
243259
}
244260
}
245261
return this.psiFile instanceof CsvFile ? (CsvFile) psiFile : null;

src/test/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvFileEditorTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
88
import com.intellij.openapi.fileEditor.impl.text.TextEditorState;
99
import com.intellij.openapi.project.Project;
10+
import com.intellij.openapi.vfs.VirtualFile;
1011
import com.intellij.testFramework.LightVirtualFile;
1112
import net.seesharpsoft.intellij.plugins.csv.CsvBasePlatformTestCase;
1213
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings;
@@ -111,6 +112,18 @@ public DiffRequestProcessor createProcessor(@NotNull Project project) {
111112
}
112113
}
113114

115+
public void testAccept() {
116+
CsvFileEditorProvider fileEditorProvider = new CsvFileEditorProvider();
117+
CsvEditorSettings csvEditorSettings = CsvEditorSettings.getInstance();
118+
VirtualFile csvFile = myFixture.getFile().getVirtualFile();
119+
120+
csvEditorSettings.setEditorPrio(CsvEditorSettings.EditorPrio.TEXT_FIRST);
121+
assertTrue(fileEditorProvider.accept(myFixture.getProject(), csvFile));
122+
123+
csvEditorSettings.setEditorPrio(CsvEditorSettings.EditorPrio.TEXT_ONLY);
124+
assertTrue(fileEditorProvider.accept(myFixture.getProject(), csvFile));
125+
}
126+
114127
public void testAcceptCsvFile() {
115128
assertTrue(CsvFileEditorProvider.acceptCsvFile(myFixture.getProject(), new LightVirtualFile(myFixture.getFile().getName())));
116129
assertFalse(CsvFileEditorProvider.acceptCsvFile(myFixture.getProject(), new DiffVirtualFileDummy(myFixture.getFile().getName())));

0 commit comments

Comments
 (0)