| 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/collections.dart'; | 10 import 'package:analysis_server/src/collections.dart'; |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (units.isNotEmpty) { | 484 if (units.isNotEmpty) { |
| 485 refactoring = | 485 refactoring = |
| 486 new InlineMethodRefactoring(searchEngine, units[0], offset); | 486 new InlineMethodRefactoring(searchEngine, units[0], offset); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 if (kind == RefactoringKind.MOVE_FILE) { | 489 if (kind == RefactoringKind.MOVE_FILE) { |
| 490 ContextSourcePair contextSource = server.getContextSourcePair(file); | 490 ContextSourcePair contextSource = server.getContextSourcePair(file); |
| 491 engine.AnalysisContext context = contextSource.context; | 491 engine.AnalysisContext context = contextSource.context; |
| 492 Source source = contextSource.source; | 492 Source source = contextSource.source; |
| 493 refactoring = new MoveFileRefactoring( | 493 refactoring = new MoveFileRefactoring( |
| 494 server.resourceProvider.pathContext, searchEngine, context, source); | 494 server.resourceProvider, searchEngine, context, source, file); |
| 495 } | 495 } |
| 496 if (kind == RefactoringKind.RENAME) { | 496 if (kind == RefactoringKind.RENAME) { |
| 497 List<AstNode> nodes = server.getNodesAtOffset(file, offset); | 497 List<AstNode> nodes = server.getNodesAtOffset(file, offset); |
| 498 List<Element> elements = server.getElementsOfNodes(nodes, offset); | 498 List<Element> elements = server.getElementsOfNodes(nodes, offset); |
| 499 if (nodes.isNotEmpty && elements.isNotEmpty) { | 499 if (nodes.isNotEmpty && elements.isNotEmpty) { |
| 500 AstNode node = nodes[0]; | 500 AstNode node = nodes[0]; |
| 501 Element element = elements[0]; | 501 Element element = elements[0]; |
| 502 if (element is FieldFormalParameterElement) { | 502 if (element is FieldFormalParameterElement) { |
| 503 element = (element as FieldFormalParameterElement).field; | 503 element = (element as FieldFormalParameterElement).field; |
| 504 } | 504 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 } | 625 } |
| 626 if (refactoring is RenameRefactoring) { | 626 if (refactoring is RenameRefactoring) { |
| 627 RenameRefactoring renameRefactoring = refactoring; | 627 RenameRefactoring renameRefactoring = refactoring; |
| 628 RenameOptions renameOptions = params.options; | 628 RenameOptions renameOptions = params.options; |
| 629 renameRefactoring.newName = renameOptions.newName; | 629 renameRefactoring.newName = renameOptions.newName; |
| 630 return renameRefactoring.checkNewName(); | 630 return renameRefactoring.checkNewName(); |
| 631 } | 631 } |
| 632 return new RefactoringStatus(); | 632 return new RefactoringStatus(); |
| 633 } | 633 } |
| 634 } | 634 } |
| OLD | NEW |