|
11 | 11 | package com.redhat.devtools.lsp4ij.ui; |
12 | 12 |
|
13 | 13 | import com.intellij.ide.util.PropertiesComponent; |
| 14 | +import com.intellij.openapi.application.ApplicationManager; |
14 | 15 | import com.intellij.openapi.fileEditor.FileEditor; |
15 | 16 | import com.intellij.openapi.project.Project; |
16 | 17 | import com.intellij.openapi.vfs.VirtualFile; |
@@ -138,19 +139,23 @@ private EditorNotificationPanel buildPanel(@NotNull String filePattern, |
138 | 139 | NewLanguageServerDialog dialog = new NewLanguageServerDialog(project); |
139 | 140 | dialog.loadFromTemplate(template); |
140 | 141 | dialog.show(); |
141 | | - // Refresh notifications to hide it |
142 | | - EditorNotifications.getInstance(project) |
143 | | - .updateAllNotifications(); |
| 142 | + // Refresh notifications to hide it (deferred to avoid race condition) |
| 143 | + ApplicationManager.getApplication().invokeLater(() -> { |
| 144 | + EditorNotifications.getInstance(project) |
| 145 | + .updateAllNotifications(); |
| 146 | + }); |
144 | 147 | }); |
145 | 148 | }); |
146 | 149 |
|
147 | 150 | // Dismiss button (can be enhanced to persist dismissal if needed) |
148 | 151 | panel.createActionLabel(LanguageServerBundle.message("language.server.suggest.install.dismiss"), () -> { |
149 | 152 | // Store preference to disable future notifications |
150 | 153 | PropertiesComponent.getInstance().setValue(DISABLE_KEY, true); |
151 | | - // Refresh notifications to hide the panel |
152 | | - EditorNotifications.getInstance(project) |
153 | | - .updateAllNotifications(); |
| 154 | + // Refresh notifications to hide the panel (deferred to avoid race condition) |
| 155 | + ApplicationManager.getApplication().invokeLater(() -> { |
| 156 | + EditorNotifications.getInstance(project) |
| 157 | + .updateAllNotifications(); |
| 158 | + }); |
154 | 159 | }); |
155 | 160 |
|
156 | 161 | return panel; |
|
0 commit comments