Skip to content

Commit 85db686

Browse files
authored
[CQ] migrate off slated-for-removal DataContext functional interface (#8228)
The (neat) `DataContext` functional interface is slated to be removed. ![image](https://github.com/user-attachments/assets/dceb05c7-aa6a-4b20-bbd6-def43062e66e) This migrates us to a `SimpleDataContext` builder which is the [new path forward](https://github.com/JetBrains/intellij-community/blob/7b62c265ab76de3c80882525fdc4047895f3f4b1/platform/core-ui/src/openapi/actionSystem/DataContext.java#L18). See: #7718 --- - [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 44e0418 commit 85db686

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

flutter-idea/src/io/flutter/editor/NativeEditorNotificationProvider.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package io.flutter.editor;
77

88
import com.intellij.openapi.actionSystem.*;
9+
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
910
import com.intellij.openapi.fileEditor.FileEditor;
1011
import com.intellij.openapi.project.Project;
1112
import com.intellij.openapi.util.SystemInfo;
@@ -143,15 +144,7 @@ private void performAction() {
143144
}
144145

145146
private DataContext makeContext() {
146-
return dataId -> {
147-
if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) {
148-
return myFile;
149-
}
150-
if (CommonDataKeys.PROJECT.is(dataId)) {
151-
return project;
152-
}
153-
return null;
154-
};
147+
return SimpleDataContext.builder().add(CommonDataKeys.VIRTUAL_FILE, myFile).add(CommonDataKeys.PROJECT, project).build();
155148
}
156149
}
157150
}

0 commit comments

Comments
 (0)