| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 new InlineLocalRefactoring(searchEngine, units[0], offset); | 286 new InlineLocalRefactoring(searchEngine, units[0], offset); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 if (kind == RefactoringKind.INLINE_METHOD) { | 289 if (kind == RefactoringKind.INLINE_METHOD) { |
| 290 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); | 290 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); |
| 291 if (units.isNotEmpty) { | 291 if (units.isNotEmpty) { |
| 292 refactoring = | 292 refactoring = |
| 293 new InlineMethodRefactoring(searchEngine, units[0], offset); | 293 new InlineMethodRefactoring(searchEngine, units[0], offset); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 if (kind == RefactoringKind.MOVE_FILE) { |
| 297 engine.AnalysisContext context = server.getAnalysisContext(file); |
| 298 Source source = server.getSource(file); |
| 299 refactoring = new MoveFileRefactoring(searchEngine, context, source); |
| 300 } |
| 296 if (kind == RefactoringKind.RENAME) { | 301 if (kind == RefactoringKind.RENAME) { |
| 297 List<AstNode> nodes = server.getNodesAtOffset(file, offset); | 302 List<AstNode> nodes = server.getNodesAtOffset(file, offset); |
| 298 List<Element> elements = server.getElementsAtOffset(file, offset); | 303 List<Element> elements = server.getElementsAtOffset(file, offset); |
| 299 if (nodes.isNotEmpty && elements.isNotEmpty) { | 304 if (nodes.isNotEmpty && elements.isNotEmpty) { |
| 300 AstNode node = nodes[0]; | 305 AstNode node = nodes[0]; |
| 301 Element element = elements[0]; | 306 Element element = elements[0]; |
| 302 refactoring = new RenameRefactoring(searchEngine, element); | 307 refactoring = new RenameRefactoring(searchEngine, element); |
| 303 feedback = | 308 feedback = |
| 304 new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); | 309 new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); |
| 305 } | 310 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 extractRefactoring.returnType = extractOptions.returnType; | 404 extractRefactoring.returnType = extractOptions.returnType; |
| 400 return extractRefactoring.checkName(); | 405 return extractRefactoring.checkName(); |
| 401 } | 406 } |
| 402 if (refactoring is InlineMethodRefactoring) { | 407 if (refactoring is InlineMethodRefactoring) { |
| 403 InlineMethodRefactoring inlineRefactoring = this.refactoring; | 408 InlineMethodRefactoring inlineRefactoring = this.refactoring; |
| 404 InlineMethodOptions inlineOptions = params.options; | 409 InlineMethodOptions inlineOptions = params.options; |
| 405 inlineRefactoring.deleteSource = inlineOptions.deleteSource; | 410 inlineRefactoring.deleteSource = inlineOptions.deleteSource; |
| 406 inlineRefactoring.inlineAll = inlineOptions.inlineAll; | 411 inlineRefactoring.inlineAll = inlineOptions.inlineAll; |
| 407 return new RefactoringStatus(); | 412 return new RefactoringStatus(); |
| 408 } | 413 } |
| 414 if (refactoring is MoveFileRefactoring) { |
| 415 MoveFileRefactoring moveRefactoring = this.refactoring; |
| 416 MoveFileOptions moveOptions = params.options; |
| 417 moveRefactoring.newFile = moveOptions.newFile; |
| 418 return new RefactoringStatus(); |
| 419 } |
| 409 if (refactoring is RenameRefactoring) { | 420 if (refactoring is RenameRefactoring) { |
| 410 RenameRefactoring renameRefactoring = refactoring; | 421 RenameRefactoring renameRefactoring = refactoring; |
| 411 RenameOptions renameOptions = params.options; | 422 RenameOptions renameOptions = params.options; |
| 412 renameRefactoring.newName = renameOptions.newName; | 423 renameRefactoring.newName = renameOptions.newName; |
| 413 return renameRefactoring.checkNewName(); | 424 return renameRefactoring.checkNewName(); |
| 414 } | 425 } |
| 415 return new RefactoringStatus(); | 426 return new RefactoringStatus(); |
| 416 } | 427 } |
| 417 } | 428 } |
| OLD | NEW |