| 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 edit.domain; | 5 library edit.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (kind == RefactoringKind.INLINE_METHOD) { | 302 if (kind == RefactoringKind.INLINE_METHOD) { |
| 303 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); | 303 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); |
| 304 if (units.isNotEmpty) { | 304 if (units.isNotEmpty) { |
| 305 refactoring = | 305 refactoring = |
| 306 new InlineMethodRefactoring(searchEngine, units[0], offset); | 306 new InlineMethodRefactoring(searchEngine, units[0], offset); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 if (kind == RefactoringKind.MOVE_FILE) { | 309 if (kind == RefactoringKind.MOVE_FILE) { |
| 310 engine.AnalysisContext context = server.getAnalysisContext(file); | 310 engine.AnalysisContext context = server.getAnalysisContext(file); |
| 311 Source source = server.getSource(file); | 311 Source source = server.getSource(file); |
| 312 refactoring = new MoveFileRefactoring(searchEngine, context, source); | 312 refactoring = new MoveFileRefactoring( |
| 313 server.resourceProvider.pathContext, |
| 314 searchEngine, |
| 315 context, |
| 316 source); |
| 313 } | 317 } |
| 314 if (kind == RefactoringKind.RENAME) { | 318 if (kind == RefactoringKind.RENAME) { |
| 315 List<AstNode> nodes = server.getNodesAtOffset(file, offset); | 319 List<AstNode> nodes = server.getNodesAtOffset(file, offset); |
| 316 List<Element> elements = server.getElementsAtOffset(file, offset); | 320 List<Element> elements = server.getElementsAtOffset(file, offset); |
| 317 if (nodes.isNotEmpty && elements.isNotEmpty) { | 321 if (nodes.isNotEmpty && elements.isNotEmpty) { |
| 318 AstNode node = nodes[0]; | 322 AstNode node = nodes[0]; |
| 319 Element element = elements[0]; | 323 Element element = elements[0]; |
| 320 refactoring = new RenameRefactoring(searchEngine, element); | 324 refactoring = new RenameRefactoring(searchEngine, element); |
| 321 feedback = | 325 feedback = |
| 322 new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); | 326 new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 439 } |
| 436 if (refactoring is RenameRefactoring) { | 440 if (refactoring is RenameRefactoring) { |
| 437 RenameRefactoring renameRefactoring = refactoring; | 441 RenameRefactoring renameRefactoring = refactoring; |
| 438 RenameOptions renameOptions = params.options; | 442 RenameOptions renameOptions = params.options; |
| 439 renameRefactoring.newName = renameOptions.newName; | 443 renameRefactoring.newName = renameOptions.newName; |
| 440 return renameRefactoring.checkNewName(); | 444 return renameRefactoring.checkNewName(); |
| 441 } | 445 } |
| 442 return new RefactoringStatus(); | 446 return new RefactoringStatus(); |
| 443 } | 447 } |
| 444 } | 448 } |
| OLD | NEW |