Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2464)

Unified Diff: pkg/analysis_server/lib/src/domain_analysis.dart

Issue 308703005: Extract constants into separate libarary. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/constants.dart ('k') | pkg/analysis_server/lib/src/domain_context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_analysis.dart
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index c0d2983d5934141772631c704db1757ef591421c..c57731ddf1f1c3f55a337aef841bb2b73600b7b6 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -5,6 +5,7 @@
library domain.analysis;
import 'package:analysis_server/src/analysis_server.dart';
+import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/protocol.dart';
/**
@@ -13,161 +14,6 @@ import 'package:analysis_server/src/protocol.dart';
*/
class AnalysisDomainHandler implements RequestHandler {
/**
- * The name of the `analysis.getFixes` request.
- */
- static const String GET_FIXES_METHOD = 'analysis.getFixes';
-
- /**
- * The name of the `analysis.getMinorRefactorings` request.
- */
- static const String GET_MINOR_REFACTORINGS_METHOD = 'analysis.getMinorRefactorings';
-
- /**
- * The name of the `analysis.setAnalysisRoots` request.
- */
- static const String SET_ANALYSIS_ROOTS_METHOD = 'analysis.setAnalysisRoots';
-
- /**
- * The name of the `analysis.setPriorityFiles` request.
- */
- static const String SET_PRIORITY_FILES_METHOD = 'analysis.setPriorityFiles';
-
- /**
- * The name of the `analysis.setSubscriptions` request.
- */
- static const String SET_SUBSCRIPTIONS_METHOD = 'analysis.setSubscriptions';
-
- /**
- * The name of the `analysis.updateContent` request.
- */
- static const String UPDATE_CONTENT_METHOD = 'analysis.updateContent';
-
- /**
- * The name of the `analysis.updateOptions` request.
- */
- static const String UPDATE_OPTIONS_METHOD = 'analysis.updateOptions';
-
- /**
- * The name of the `analysis.updateSdks` request.
- */
- static const String UPDATE_SDKS_METHOD = 'analysis.updateSdks';
-
- /**
- * The name of the `analysis.errors` notification.
- */
- static const String ERRORS_NOTIFICATION = 'analysis.errors';
-
- /**
- * The name of the `analysis.highlights` notification.
- */
- static const String HIGHLIGHTS_NOTIFICATION = 'analysis.highlights';
-
- /**
- * The name of the `analysis.navigation` notification.
- */
- static const String NAVIGATION_NOTIFICATION = 'analysis.navigation';
-
- /**
- * The name of the `analysis.outline` notification.
- */
- static const String OUTLINE_NOTIFICATION = 'analysis.outline';
-
- /**
- * The name of the `aadded` parameter.
- */
- static const String ADDED_PARAM = 'added';
-
- /**
- * The name of the `content` parameter.
- */
- static const String CONTENT_PARAM = 'content';
-
- /**
- * The name of the `default` parameter.
- */
- static const String DEFAULT_PARAM = 'default';
-
- /**
- * The name of the `errors` parameter.
- */
- static const String ERRORS_PARAM = 'errors';
-
- /**
- * The name of the `excluded` parameter.
- */
- static const String EXCLUDED_PARAM = 'excluded';
-
- /**
- * The name of the `file` parameter.
- */
- static const String FILE_PARAM = 'file';
-
- /**
- * The name of the `files` parameter.
- */
- static const String FILES_PARAM = 'files';
-
- /**
- * The name of the `fixes` parameter.
- */
- static const String FIXES_PARAM = 'fixes';
-
- /**
- * The name of the `included` parameter.
- */
- static const String INCLUDED_PARAM = 'included';
-
- /**
- * The name of the `length` parameter.
- */
- static const String LENGTH_PARAM = 'length';
-
- /**
- * The name of the `newLength` parameter.
- */
- static const String NEW_LENGTH_PARAM = 'newLength';
-
- /**
- * The name of the `offset` parameter.
- */
- static const String OFFSET_PARAM = 'offset';
-
- /**
- * The name of the `oldLength` parameter.
- */
- static const String OLD_LENGTH_PARAM = 'oldLength';
-
- /**
- * The name of the `options` parameter.
- */
- static const String OPTIONS_PARAM = 'options';
-
- /**
- * The name of the `outline` parameter.
- */
- static const String OUTLINE_PARAM = 'outline';
-
- /**
- * The name of the `refactorings` parameter.
- */
- static const String REFACTORINGS_PARAM = 'refactorings';
-
- /**
- * The name of the `regions` parameter.
- */
- static const String REGIONS_PARAM = 'regions';
-
- /**
- * The name of the `removed` parameter.
- */
- static const String REMOVED_PARAM = 'removed';
-
- /**
- * The name of the `subscriptions` parameter.
- */
- static const String SUBSCRIPTIONS_PARAM = 'subscriptions';
-
- /**
* The analysis server that is using this handler to process requests.
*/
final AnalysisServer server;
@@ -181,21 +27,21 @@ class AnalysisDomainHandler implements RequestHandler {
Response handleRequest(Request request) {
try {
String requestName = request.method;
- if (requestName == GET_FIXES_METHOD) {
+ if (requestName == METHOD_GET_FIXES) {
return getFixes(request);
- } else if (requestName == GET_MINOR_REFACTORINGS_METHOD) {
+ } else if (requestName == METHOD_GET_MINOR_REFACTORINGS) {
return getMinorRefactorings(request);
- } else if (requestName == SET_ANALYSIS_ROOTS_METHOD) {
+ } else if (requestName == METHOD_SET_ANALYSIS_ROOTS) {
return setAnalysisRoots(request);
- } else if (requestName == SET_PRIORITY_FILES_METHOD) {
+ } else if (requestName == METHOD_SET_PRIORITY_FILES) {
return setPriorityFiles(request);
- } else if (requestName == SET_SUBSCRIPTIONS_METHOD) {
+ } else if (requestName == METHOD_SET_SUBSCRIPTIONS) {
return setSubscriptions(request);
- } else if (requestName == UPDATE_CONTENT_METHOD) {
+ } else if (requestName == METHOD_UPDATE_CONTENT) {
return updateContent(request);
- } else if (requestName == UPDATE_OPTIONS_METHOD) {
+ } else if (requestName == METHOD_UPDATE_OPTIONS) {
return updateOptions(request);
- } else if (requestName == UPDATE_SDKS_METHOD) {
+ } else if (requestName == METHOD_UPDATE_SDKS) {
return updateSdks(request);
}
} on RequestFailure catch (exception) {
@@ -216,10 +62,10 @@ class AnalysisDomainHandler implements RequestHandler {
Response setAnalysisRoots(Request request) {
// included
- RequestDatum includedDatum = request.getRequiredParameter(INCLUDED_PARAM);
+ RequestDatum includedDatum = request.getRequiredParameter(INCLUDED);
List<String> includedPaths = includedDatum.asStringList();
// excluded
- RequestDatum excludedDatum = request.getRequiredParameter(EXCLUDED_PARAM);
+ RequestDatum excludedDatum = request.getRequiredParameter(EXCLUDED);
List<String> excludedPaths = excludedDatum.asStringList();
// continue in server
server.setAnalysisRoots(request.id, includedPaths, excludedPaths);
@@ -238,14 +84,14 @@ class AnalysisDomainHandler implements RequestHandler {
Response updateContent(Request request) {
var changes = new Map<String, ContentChange>();
- RequestDatum filesDatum = request.getRequiredParameter(FILES_PARAM);
+ RequestDatum filesDatum = request.getRequiredParameter(FILES);
filesDatum.forEachMap((file, changeDatum) {
var change = new ContentChange();
- change.content = changeDatum[CONTENT_PARAM].asString();
- if (changeDatum.hasKey(OFFSET_PARAM)) {
- change.offset = changeDatum[OFFSET_PARAM].asInt();
- change.oldLength = changeDatum[OLD_LENGTH_PARAM].asInt();
- change.newLength = changeDatum[NEW_LENGTH_PARAM].asInt();
+ change.content = changeDatum[CONTENT].asString();
+ if (changeDatum.hasKey(OFFSET)) {
+ change.offset = changeDatum[OFFSET].asInt();
+ change.oldLength = changeDatum[OLD_LENGTH].asInt();
+ change.newLength = changeDatum[NEW_LENGTH].asInt();
}
changes[file] = change;
});
« no previous file with comments | « pkg/analysis_server/lib/src/constants.dart ('k') | pkg/analysis_server/lib/src/domain_context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698