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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:core'; | 7 import 'dart:core'; |
8 | 8 |
9 import 'package:analysis_server/protocol/protocol.dart'; | 9 import 'package:analysis_server/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/protocol/protocol_constants.dart'; |
10 import 'package:analysis_server/protocol/protocol_generated.dart'; | 11 import 'package:analysis_server/protocol/protocol_generated.dart'; |
11 import 'package:analysis_server/src/analysis_server.dart'; | 12 import 'package:analysis_server/src/analysis_server.dart'; |
12 import 'package:analysis_server/src/constants.dart'; | |
13 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
14 import 'package:analyzer/src/dart/analysis/driver.dart'; | 14 import 'package:analyzer/src/dart/analysis/driver.dart'; |
15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * Instances of the class [ExecutionDomainHandler] implement a [RequestHandler] | 18 * Instances of the class [ExecutionDomainHandler] implement a [RequestHandler] |
19 * that handles requests in the `execution` domain. | 19 * that handles requests in the `execution` domain. |
20 */ | 20 */ |
21 class ExecutionDomainHandler implements RequestHandler { | 21 class ExecutionDomainHandler implements RequestHandler { |
22 /** | 22 /** |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 Response deleteContext(Request request) { | 62 Response deleteContext(Request request) { |
63 String contextId = new ExecutionDeleteContextParams.fromRequest(request).id; | 63 String contextId = new ExecutionDeleteContextParams.fromRequest(request).id; |
64 contextMap.remove(contextId); | 64 contextMap.remove(contextId); |
65 return new ExecutionDeleteContextResult().toResponse(request.id); | 65 return new ExecutionDeleteContextResult().toResponse(request.id); |
66 } | 66 } |
67 | 67 |
68 @override | 68 @override |
69 Response handleRequest(Request request) { | 69 Response handleRequest(Request request) { |
70 try { | 70 try { |
71 String requestName = request.method; | 71 String requestName = request.method; |
72 if (requestName == EXECUTION_CREATE_CONTEXT) { | 72 if (requestName == EXECUTION_REQUEST_CREATE_CONTEXT) { |
73 return createContext(request); | 73 return createContext(request); |
74 } else if (requestName == EXECUTION_DELETE_CONTEXT) { | 74 } else if (requestName == EXECUTION_REQUEST_DELETE_CONTEXT) { |
75 return deleteContext(request); | 75 return deleteContext(request); |
76 } else if (requestName == EXECUTION_MAP_URI) { | 76 } else if (requestName == EXECUTION_REQUEST_MAP_URI) { |
77 return mapUri(request); | 77 return mapUri(request); |
78 } else if (requestName == EXECUTION_SET_SUBSCRIPTIONS) { | 78 } else if (requestName == EXECUTION_REQUEST_SET_SUBSCRIPTIONS) { |
79 return setSubscriptions(request); | 79 return setSubscriptions(request); |
80 } | 80 } |
81 } on RequestFailure catch (exception) { | 81 } on RequestFailure catch (exception) { |
82 return exception.response; | 82 return exception.response; |
83 } | 83 } |
84 return null; | 84 return null; |
85 } | 85 } |
86 | 86 |
87 /** | 87 /** |
88 * Implement the 'execution.mapUri' request. | 88 * Implement the 'execution.mapUri' request. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 /** | 140 /** |
141 * Implement the 'execution.setSubscriptions' request. | 141 * Implement the 'execution.setSubscriptions' request. |
142 */ | 142 */ |
143 Response setSubscriptions(Request request) { | 143 Response setSubscriptions(Request request) { |
144 // Under the analysis driver, setSubscriptions() becomes a no-op. | 144 // Under the analysis driver, setSubscriptions() becomes a no-op. |
145 return new ExecutionSetSubscriptionsResult().toResponse(request.id); | 145 return new ExecutionSetSubscriptionsResult().toResponse(request.id); |
146 } | 146 } |
147 } | 147 } |
OLD | NEW |