|
10 | 10 | import com.intellij.ide.browsers.BrowserLauncher;
|
11 | 11 | import com.intellij.ide.plugins.PluginManagerCore;
|
12 | 12 | import com.intellij.ide.ui.UISettingsListener;
|
13 |
| -import com.intellij.notification.*; |
| 13 | +import com.intellij.notification.Notification; |
| 14 | +import com.intellij.notification.NotificationType; |
| 15 | +import com.intellij.notification.Notifications; |
14 | 16 | import com.intellij.openapi.actionSystem.AnAction;
|
15 | 17 | import com.intellij.openapi.actionSystem.AnActionEvent;
|
16 | 18 | import com.intellij.openapi.application.ApplicationManager;
|
|
20 | 22 | import com.intellij.openapi.extensions.PluginId;
|
21 | 23 | import com.intellij.openapi.fileEditor.FileEditorManager;
|
22 | 24 | import com.intellij.openapi.module.Module;
|
23 |
| -import com.intellij.openapi.module.ModuleManager; |
24 | 25 | import com.intellij.openapi.project.ModuleListener;
|
25 | 26 | import com.intellij.openapi.project.Project;
|
26 | 27 | import com.intellij.openapi.roots.ProjectRootManager;
|
|
50 | 51 | import io.flutter.settings.FlutterSettings;
|
51 | 52 | import io.flutter.survey.FlutterSurveyNotifications;
|
52 | 53 | import io.flutter.utils.FlutterModuleUtils;
|
| 54 | +import io.flutter.utils.OpenApiUtils; |
53 | 55 | import io.flutter.view.FlutterViewFactory;
|
54 | 56 | import org.jetbrains.annotations.NotNull;
|
55 | 57 |
|
@@ -90,7 +92,7 @@ public void runActivity(@NotNull Project project) {
|
90 | 92 | // If the project declares a Flutter dependency, do some extra initialization.
|
91 | 93 | boolean hasFlutterModule = false;
|
92 | 94 |
|
93 |
| - for (Module module : ModuleManager.getInstance(project).getModules()) { |
| 95 | + for (Module module : OpenApiUtils.getModules(project)) { |
94 | 96 | final boolean declaresFlutter = FlutterModuleUtils.declaresFlutter(module);
|
95 | 97 |
|
96 | 98 | hasFlutterModule = hasFlutterModule || declaresFlutter;
|
@@ -289,7 +291,7 @@ private void checkSdkVersionNotification(@NotNull Project project) {
|
289 | 291 | final FlutterSettings settings = FlutterSettings.getInstance();
|
290 | 292 | if (settings == null || settings.isSdkVersionOutdatedWarningAcknowledged(version.getVersionText())) return;
|
291 | 293 |
|
292 |
| - ApplicationManager.getApplication().invokeLater(() -> { |
| 294 | + OpenApiUtils.safeInvokeLater(() -> { |
293 | 295 | final Notification notification = new Notification(FlutterMessages.FLUTTER_NOTIFICATION_GROUP_ID,
|
294 | 296 | "Flutter SDK requires update",
|
295 | 297 | "Support for v" +
|
@@ -383,6 +385,6 @@ private void ensureAndroidSdk(@NotNull Project project) {
|
383 | 385 | return; // ANDROID_HOME not set or Android SDK not created in IDEA; not clear what to do.
|
384 | 386 | }
|
385 | 387 |
|
386 |
| - ApplicationManager.getApplication().runWriteAction(() -> wanted.setCurrent(project)); |
| 388 | + OpenApiUtils.safeRunWriteAction(() -> wanted.setCurrent(project)); |
387 | 389 | }
|
388 | 390 | }
|
0 commit comments