[Element model] Migrate edit_import_elements.dart

Change-Id: If81e7081207960b3a55bc6d6dc0b5488b50e35a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
diff --git a/pkg/analysis_server/analyzer_use_new_elements.txt b/pkg/analysis_server/analyzer_use_new_elements.txt
index 0518eb0..6e2b200 100644
--- a/pkg/analysis_server/analyzer_use_new_elements.txt
+++ b/pkg/analysis_server/analyzer_use_new_elements.txt
@@ -74,6 +74,7 @@
 lib/src/handler/legacy/edit_get_postfix_completion.dart
 lib/src/handler/legacy/edit_get_refactoring.dart
 lib/src/handler/legacy/edit_get_statement_completion.dart
+lib/src/handler/legacy/edit_import_elements.dart
 lib/src/handler/legacy/edit_is_postfix_completion_applicable.dart
 lib/src/handler/legacy/edit_list_postfix_completion_templates.dart
 lib/src/handler/legacy/edit_organize_directives.dart
diff --git a/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart b/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart
index f87f15f..996b514 100644
--- a/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart
+++ b/pkg/analysis_server/lib/src/handler/legacy/edit_import_elements.dart
@@ -34,8 +34,8 @@
       sendResponse(Response.importElementsInvalidFile(request));
       return;
     }
-    var libraryUnit = result.libraryElement.definingCompilationUnit;
-    if (libraryUnit != result.unit.declaredElement) {
+    var libraryUnit = result.libraryElement2.firstFragment;
+    if (libraryUnit != result.libraryFragment) {
       // The file in the request is a part of a library. We need to pass the
       // defining compilation unit to the computer, not the part.
       result = await server.getResolvedUnit(libraryUnit.source.fullName);