2121public 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}
0 commit comments