| 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.src.refactoring.rename; | 5 library services.src.refactoring.rename; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol.dart' hide Element; | 10 import 'package:analysis_server/src/protocol.dart' hide Element; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * An abstract implementation of [RenameRefactoring]. | 149 * An abstract implementation of [RenameRefactoring]. |
| 150 */ | 150 */ |
| 151 abstract class RenameRefactoringImpl extends RefactoringImpl implements | 151 abstract class RenameRefactoringImpl extends RefactoringImpl implements |
| 152 RenameRefactoring { | 152 RenameRefactoring { |
| 153 final SearchEngine searchEngine; | 153 final SearchEngine searchEngine; |
| 154 final Element element; | 154 final Element element; |
| 155 final AnalysisContext context; | 155 final AnalysisContext context; |
| 156 final String elementKindName; |
| 156 final String oldName; | 157 final String oldName; |
| 157 | 158 |
| 158 String newName; | 159 String newName; |
| 159 | 160 |
| 160 RenameRefactoringImpl(SearchEngine searchEngine, Element element) | 161 RenameRefactoringImpl(SearchEngine searchEngine, Element element) |
| 161 : searchEngine = searchEngine, | 162 : searchEngine = searchEngine, |
| 162 element = element, | 163 element = element, |
| 163 context = element.context, | 164 context = element.context, |
| 165 elementKindName = element.kind.displayName, |
| 164 oldName = _getDisplayName(element); | 166 oldName = _getDisplayName(element); |
| 165 | 167 |
| 166 /** | 168 /** |
| 167 * Adds the "Update declaration" [Edit] to [change]. | 169 * Adds the "Update declaration" [Edit] to [change]. |
| 168 */ | 170 */ |
| 169 void addDeclarationEdit(SourceChange change, Element element) { | 171 void addDeclarationEdit(SourceChange change, Element element) { |
| 170 if (element != null) { | 172 if (element != null) { |
| 171 String file = getElementFile(element); | 173 String file = getElementFile(element); |
| 172 SourceEdit edit = new SourceEdit.range(rangeElementName(element), newName)
; | 174 SourceEdit edit = new SourceEdit.range(rangeElementName(element), newName)
; |
| 173 change.addEdit(file, edit); | 175 change.addEdit(file, edit); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 244 } |
| 243 if (other is SourceReference) { | 245 if (other is SourceReference) { |
| 244 return other.file == file && other.range == range; | 246 return other.file == file && other.range == range; |
| 245 } | 247 } |
| 246 return false; | 248 return false; |
| 247 } | 249 } |
| 248 | 250 |
| 249 @override | 251 @override |
| 250 String toString() => '${file}@${range}'; | 252 String toString() => '${file}@${range}'; |
| 251 } | 253 } |
| OLD | NEW |