| 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.move_file; | 5 library services.src.refactoring.move_file; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' hide Element; | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| 11 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 11 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 12 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da
rt'; | 12 import 'package:analysis_server/src/services/refactoring/refactoring_internal.da
rt'; |
| 13 import 'package:analysis_server/src/services/search/search_engine.dart'; | 13 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 17 import 'package:path/path.dart' as pathos; | 17 import 'package:path/path.dart' as pathos; |
| 18 | 18 |
| 19 | 19 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 void _updateUriReference(UriReferencedElement element) { | 142 void _updateUriReference(UriReferencedElement element) { |
| 143 if (!element.isSynthetic) { | 143 if (!element.isSynthetic) { |
| 144 String elementUri = element.uri; | 144 String elementUri = element.uri; |
| 145 if (_isRelativeUri(elementUri)) { | 145 if (_isRelativeUri(elementUri)) { |
| 146 String elementPath = pathContext.join(oldLibraryDir, elementUri); | 146 String elementPath = pathContext.join(oldLibraryDir, elementUri); |
| 147 String newUri = _getRelativeUri(elementPath, newLibraryDir); | 147 String newUri = _getRelativeUri(elementPath, newLibraryDir); |
| 148 int uriOffset = element.uriOffset; | 148 int uriOffset = element.uriOffset; |
| 149 int uriLength = element.uriEnd - uriOffset; | 149 int uriLength = element.uriEnd - uriOffset; |
| 150 change.addElementEdit( | 150 doSourceChange_addElementEdit( |
| 151 change, |
| 151 library, | 152 library, |
| 152 new SourceEdit(uriOffset, uriLength, "'$newUri'")); | 153 new SourceEdit(uriOffset, uriLength, "'$newUri'")); |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 | 157 |
| 157 void _updateUriReferences(List<UriReferencedElement> elements) { | 158 void _updateUriReferences(List<UriReferencedElement> elements) { |
| 158 for (UriReferencedElement element in elements) { | 159 for (UriReferencedElement element in elements) { |
| 159 _updateUriReference(element); | 160 _updateUriReference(element); |
| 160 } | 161 } |
| 161 } | 162 } |
| 162 } | 163 } |
| OLD | NEW |