Skip to content

Commit 80f6795

Browse files
authored
[perf] FlutterExternalIdeActionGroup: make action update thread explicit (#8236)
Making the action update thread explicit saves the platform from the work of figuring it out for itself (required caching of potentially unneeded data). From a related inspection: > Reports actions, action groups and other ActionUpdateThreadAware classes that do not explicitly state their mode. > When an action or an action group defines its own update() method, IntelliJ Platform tries to mimic the old synchronous way of calling update() and getChildren() methods in the UI thread and supply it with all the data in AnActionEvent.dataContext(). To do that, it caches all the possible data on a background thread beforehand, even if it is not needed. > Provide one of the two modes ActionUpdateThread.EDT or ActionUpdateThread.BGT by overriding the getActionUpdateThread() method. ![image](https://github.com/user-attachments/assets/444c53e0-5c80-489f-8b3e-82419cb18b1b) --- - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent 829335e commit 80f6795

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

flutter-idea/src/io/flutter/actions/FlutterExternalIdeActionGroup.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
*/
66
package io.flutter.actions;
77

8-
import com.intellij.openapi.actionSystem.AnActionEvent;
9-
import com.intellij.openapi.actionSystem.CommonDataKeys;
10-
import com.intellij.openapi.actionSystem.DefaultActionGroup;
11-
import com.intellij.openapi.actionSystem.Presentation;
8+
import com.intellij.openapi.actionSystem.*;
129
import com.intellij.openapi.project.Project;
1310
import com.intellij.openapi.vfs.VirtualFile;
1411
import io.flutter.FlutterUtils;
@@ -36,6 +33,11 @@ private static boolean isExternalIdeFile(AnActionEvent e) {
3633
FlutterUtils.isXcodeProjectFileName(file.getName()) || OpenInAndroidStudioAction.isProjectFileName(file.getName());
3734
}
3835

36+
@Override
37+
public @NotNull ActionUpdateThread getActionUpdateThread() {
38+
return ActionUpdateThread.EDT;
39+
}
40+
3941
public static boolean isAndroidDirectory(@NotNull VirtualFile file) {
4042
return file.isDirectory() && (file.getName().equals("android") || file.getName().equals(".android"));
4143
}

0 commit comments

Comments
 (0)