|
16 | 16 | import com.intellij.openapi.diagnostic.Logger;
|
17 | 17 | import com.intellij.openapi.editor.colors.EditorColorsListener;
|
18 | 18 | import com.intellij.openapi.editor.colors.EditorColorsManager;
|
| 19 | +import com.intellij.openapi.progress.EmptyProgressIndicator; |
| 20 | +import com.intellij.openapi.progress.ProgressIndicator; |
| 21 | +import com.intellij.openapi.progress.ProgressManager; |
19 | 22 | import com.intellij.openapi.project.Project;
|
20 | 23 | import com.intellij.openapi.ui.VerticalFlowLayout;
|
21 | 24 | import com.intellij.openapi.util.Disposer;
|
@@ -211,16 +214,24 @@ private void addBrowserInspectorViewContent(FlutterApp app,
|
211 | 214 | .build();
|
212 | 215 |
|
213 | 216 | //noinspection CodeBlock2Expr
|
214 |
| - ApplicationManager.getApplication().invokeLater(() -> { |
215 |
| - embeddedBrowserOptional().ifPresent(embeddedBrowser -> embeddedBrowser.openPanel(toolWindow, tabName, devToolsUrl, (String error) -> { |
216 |
| - // If the embedded browser doesn't work, offer a link to open in the regular browser. |
217 |
| - final List<LabelInput> inputs = Arrays.asList( |
218 |
| - new LabelInput("The embedded browser failed to load. Error: " + error), |
219 |
| - openDevToolsLabel(app, toolWindow, ideFeature) |
220 |
| - ); |
221 |
| - presentClickableLabel(toolWindow, inputs); |
222 |
| - })); |
223 |
| - }); |
| 217 | + |
| 218 | + Runnable task = () -> { |
| 219 | + embeddedBrowserOptional().ifPresent( |
| 220 | + embeddedBrowser -> ApplicationManager.getApplication().invokeLater(() -> { |
| 221 | + embeddedBrowser.openPanel(toolWindow, tabName, devToolsUrl, (String error) -> { |
| 222 | + // If the embedded browser doesn't work, offer a link to open in the regular browser. |
| 223 | + final List<LabelInput> inputs = Arrays.asList( |
| 224 | + new LabelInput("The embedded browser failed to load. Error: " + error), |
| 225 | + openDevToolsLabel(app, toolWindow, ideFeature) |
| 226 | + ); |
| 227 | + presentClickableLabel(toolWindow, inputs); |
| 228 | + }); |
| 229 | + })); |
| 230 | + }; |
| 231 | + final ProgressManager progressManager = ProgressManager.getInstanceOrNull(); |
| 232 | + if (progressManager != null) { |
| 233 | + progressManager.runProcess(task, new EmptyProgressIndicator()); |
| 234 | + } |
224 | 235 |
|
225 | 236 | if (!busSubscribed) {
|
226 | 237 | busConnection.subscribe(EditorColorsManager.TOPIC, (EditorColorsListener)scheme ->
|
|
0 commit comments