Skip to content

Commit 1ad4afa

Browse files
authored
[CQ] API: migrate from to-be-removed AnActionListener APIs (#8076)
Migrate to safe `AnActionListener` APIs. This migration has been attempted before but was reverted as possibly causing a hot reload regression (#6996). I've confirmed that hot reload works (Mac OS Meerkat) but have preserved the note in case anything odd happens. See: #7718 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
1 parent 3768608 commit 1ad4afa

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

flutter-idea/src/io/flutter/run/FlutterReloadManager.java

+5-13
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
import com.intellij.notification.NotificationGroup;
1919
import com.intellij.notification.NotificationGroupManager;
2020
import com.intellij.notification.NotificationType;
21-
import com.intellij.openapi.actionSystem.AnAction;
22-
import com.intellij.openapi.actionSystem.AnActionEvent;
23-
import com.intellij.openapi.actionSystem.CommonDataKeys;
24-
import com.intellij.openapi.actionSystem.DataContext;
21+
import com.intellij.openapi.actionSystem.*;
2522
import com.intellij.openapi.actionSystem.ex.AnActionListener;
2623
import com.intellij.openapi.application.ApplicationManager;
2724
import com.intellij.openapi.application.ModalityState;
@@ -133,11 +130,8 @@ private FlutterReloadManager(@NotNull Project project) {
133130
private @Nullable Project eventProject;
134131
private @Nullable Editor eventEditor;
135132

136-
/**
137-
* WARNING on the deprecation of this API: the modification of this file was made at one point to resolve this error, but Flutter
138-
* Hot Reload was broken, see https://github.com/flutter/flutter-intellij/issues/6996, the change had to be rolled back.
139-
*/
140-
public void beforeActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext, @NotNull AnActionEvent event) {
133+
public void beforeActionPerformed(@NotNull AnAction action, @NotNull AnActionEvent event) {
134+
// In case of hot-reload breakages, see: https://github.com/flutter/flutter-intellij/issues/6996
141135
if (!(action instanceof SaveAllAction)) {
142136
return;
143137
}
@@ -154,10 +148,8 @@ public void beforeActionPerformed(@NotNull AnAction action, @NotNull DataContext
154148
}
155149
}
156150

157-
/**
158-
* See note above on {{@link #beforeActionPerformed(AnAction, DataContext, AnActionEvent)}}.
159-
*/
160-
public void afterActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext, @NotNull AnActionEvent event) {
151+
public void afterActionPerformed(@NotNull AnAction action, @NotNull AnActionEvent event, @NotNull AnActionResult result) {
152+
// In case of hot-reload breakages, see: https://github.com/flutter/flutter-intellij/issues/6996
161153
if (!(action instanceof SaveAllAction)) {
162154
return;
163155
}

0 commit comments

Comments
 (0)