| 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 services.refactoring; | 5 library services.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_services/correction/change.dart'; | 9 import 'package:analysis_services/correction/change.dart'; |
| 10 import 'package:analysis_services/correction/status.dart'; | 10 import 'package:analysis_services/correction/status.dart'; |
| 11 import 'package:analysis_services/search/search_engine.dart'; | 11 import 'package:analysis_services/search/search_engine.dart'; |
| 12 import 'package:analysis_services/src/refactoring/rename_import.dart'; |
| 12 import 'package:analysis_services/src/refactoring/rename_library.dart'; | 13 import 'package:analysis_services/src/refactoring/rename_library.dart'; |
| 13 import 'package:analysis_services/src/refactoring/rename_local.dart'; | 14 import 'package:analysis_services/src/refactoring/rename_local.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 15 import 'package:analyzer/src/generated/element.dart'; |
| 15 | 16 |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Abstract interface for all refactorings. | 19 * Abstract interface for all refactorings. |
| 19 */ | 20 */ |
| 20 abstract class Refactoring { | 21 abstract class Refactoring { |
| 21 /** | 22 /** |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 /** | 60 /** |
| 60 * Abstract [Refactoring] for renaming some [Element]. | 61 * Abstract [Refactoring] for renaming some [Element]. |
| 61 */ | 62 */ |
| 62 abstract class RenameRefactoring implements Refactoring { | 63 abstract class RenameRefactoring implements Refactoring { |
| 63 /** | 64 /** |
| 64 * Returns a new [RenameRefactoring] instance for renaming [element], | 65 * Returns a new [RenameRefactoring] instance for renaming [element], |
| 65 * maybe `null` if there is no support for renaming [Element]s of the given | 66 * maybe `null` if there is no support for renaming [Element]s of the given |
| 66 * type. | 67 * type. |
| 67 */ | 68 */ |
| 68 factory RenameRefactoring(SearchEngine searchEngine, Element element) { | 69 factory RenameRefactoring(SearchEngine searchEngine, Element element) { |
| 70 if (element is ImportElement) { |
| 71 return new RenameImportRefactoringImpl(searchEngine, element); |
| 72 } |
| 69 if (element is LibraryElement) { | 73 if (element is LibraryElement) { |
| 70 return new RenameLibraryRefactoringImpl(searchEngine, element); | 74 return new RenameLibraryRefactoringImpl(searchEngine, element); |
| 71 } | 75 } |
| 72 if (element is LocalElement) { | 76 if (element is LocalElement) { |
| 73 return new RenameLocalRefactoringImpl(searchEngine, element); | 77 return new RenameLocalRefactoringImpl(searchEngine, element); |
| 74 } | 78 } |
| 75 return null; | 79 return null; |
| 76 } | 80 } |
| 77 | 81 |
| 78 /** | 82 /** |
| (...skipping 10 matching lines...) Expand all Loading... |
| 89 * Validates that the [newName] is a valid identifier and is appropriate for | 93 * Validates that the [newName] is a valid identifier and is appropriate for |
| 90 * the type of the [Element] being renamed. | 94 * the type of the [Element] being renamed. |
| 91 * | 95 * |
| 92 * It does not perform all the checks (such as checking for conflicts with any | 96 * It does not perform all the checks (such as checking for conflicts with any |
| 93 * existing names in any of the scopes containing the current name), as many | 97 * existing names in any of the scopes containing the current name), as many |
| 94 * of these checkes require search engine. Use [checkFinalConditions] for this | 98 * of these checkes require search engine. Use [checkFinalConditions] for this |
| 95 * level of checking. | 99 * level of checking. |
| 96 */ | 100 */ |
| 97 RefactoringStatus checkNewName(); | 101 RefactoringStatus checkNewName(); |
| 98 } | 102 } |
| OLD | NEW |