| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 | 197 |
| 198 void getRefactoring(Request request) { | 198 void getRefactoring(Request request) { |
| 199 // prepare for processing the request | 199 // prepare for processing the request |
| 200 requestId = request.id; | 200 requestId = request.id; |
| 201 result = new EditGetRefactoringResult(<RefactoringProblem>[]); | 201 result = new EditGetRefactoringResult(<RefactoringProblem>[]); |
| 202 // process the request | 202 // process the request |
| 203 var params = new EditGetRefactoringParams.fromRequest(request); | 203 var params = new EditGetRefactoringParams.fromRequest(request); |
| 204 _init(params.kind, params.file, params.offset, params.length).then((_) { | 204 _init(params.kind, params.file, params.offset, params.length).then((_) { |
| 205 if (_hasFatalError) { | 205 if (initStatus.hasFatalError) { |
| 206 return _sendResultResponse(); | 206 return _sendResultResponse(); |
| 207 } | 207 } |
| 208 // set options | 208 // set options |
| 209 if (_requiresOptions) { | 209 if (_requiresOptions) { |
| 210 if (params.options == null) { | 210 if (params.options == null) { |
| 211 optionsStatus = new RefactoringStatus(); |
| 211 return _sendResultResponse(); | 212 return _sendResultResponse(); |
| 212 } | 213 } |
| 213 optionsStatus = _setOptions(params); | 214 optionsStatus = _setOptions(params); |
| 214 if (_hasFatalError) { | 215 if (_hasFatalError) { |
| 215 return _sendResultResponse(); | 216 return _sendResultResponse(); |
| 216 } | 217 } |
| 217 } | 218 } |
| 218 // done if just validation | 219 // done if just validation |
| 219 if (params.validateOnly) { | 220 if (params.validateOnly) { |
| 221 finalStatus = new RefactoringStatus(); |
| 220 return _sendResultResponse(); | 222 return _sendResultResponse(); |
| 221 } | 223 } |
| 222 // validation and create change | 224 // validation and create change |
| 223 refactoring.checkFinalConditions().then((_finalStatus) { | 225 refactoring.checkFinalConditions().then((_finalStatus) { |
| 224 finalStatus = _finalStatus; | 226 finalStatus = _finalStatus; |
| 225 if (_hasFatalError) { | 227 if (_hasFatalError) { |
| 226 return _sendResultResponse(); | 228 return _sendResultResponse(); |
| 227 } | 229 } |
| 228 return refactoring.createChange().then((change) { | 230 return refactoring.createChange().then((change) { |
| 229 result.change = new SourceChange(change.message, edits: change.edits); | 231 result.change = new SourceChange(change.message, edits: change.edits); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 387 } |
| 386 if (refactoring is RenameRefactoring) { | 388 if (refactoring is RenameRefactoring) { |
| 387 RenameRefactoring renameRefactoring = refactoring; | 389 RenameRefactoring renameRefactoring = refactoring; |
| 388 RenameOptions renameOptions = params.options; | 390 RenameOptions renameOptions = params.options; |
| 389 renameRefactoring.newName = renameOptions.newName; | 391 renameRefactoring.newName = renameOptions.newName; |
| 390 return renameRefactoring.checkNewName(); | 392 return renameRefactoring.checkNewName(); |
| 391 } | 393 } |
| 392 return new RefactoringStatus(); | 394 return new RefactoringStatus(); |
| 393 } | 395 } |
| 394 } | 396 } |
| OLD | NEW |