| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.services.refactoring.rename; | 5 library test.services.refactoring.rename; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element; |
| 8 import 'package:analysis_server/src/services/correction/namespace.dart'; | 8 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 9 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 9 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 element = getImportElement(identifier); | 50 element = getImportElement(identifier); |
| 51 } | 51 } |
| 52 createRenameRefactoringForElement(element); | 52 createRenameRefactoringForElement(element); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Creates a new [RenameRefactoring] in [refactoring] for [element]. | 56 * Creates a new [RenameRefactoring] in [refactoring] for [element]. |
| 57 * Fails if no [RenameRefactoring] can be created. | 57 * Fails if no [RenameRefactoring] can be created. |
| 58 */ | 58 */ |
| 59 void createRenameRefactoringForElement(Element element) { | 59 void createRenameRefactoringForElement(Element element) { |
| 60 refactoring = new RenameRefactoring(searchEngine, element); | 60 refactoring = new RenameRefactoring(searchEngine, astProvider, element); |
| 61 expect(refactoring, isNotNull, reason: "No refactoring for '$element'."); | 61 expect(refactoring, isNotNull, reason: "No refactoring for '$element'."); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Returns the [Edit] with the given [id], maybe `null`. | 65 * Returns the [Edit] with the given [id], maybe `null`. |
| 66 */ | 66 */ |
| 67 SourceEdit findEditById(String id) { | 67 SourceEdit findEditById(String id) { |
| 68 for (SourceFileEdit fileEdit in refactoringChange.edits) { | 68 for (SourceFileEdit fileEdit in refactoringChange.edits) { |
| 69 for (SourceEdit edit in fileEdit.edits) { | 69 for (SourceEdit edit in fileEdit.edits) { |
| 70 if (edit.id == id) { | 70 if (edit.id == id) { |
| 71 return edit; | 71 return edit; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 return null; | 75 return null; |
| 76 } | 76 } |
| 77 } | 77 } |
| OLD | NEW |