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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java

Issue 542323003: Search domain implementation in the Remote java server, using generated types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit merge issue fixed Created 6 years, 3 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
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java
index 50df23ef212fe459d7aad345b83a2e3dd98a8c17..dc9b2c900774996529dbe76a6de7db6cf86410ca 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationSearchResultsProcessor.java
@@ -13,18 +13,10 @@
*/
package com.google.dart.server.internal.remote.processor;
-import com.google.dart.server.SearchResult;
-import com.google.dart.server.SearchResultKind;
-import com.google.dart.server.generated.types.Element;
-import com.google.dart.server.generated.types.Location;
+import com.google.dart.server.generated.types.SearchResult;
import com.google.dart.server.internal.BroadcastAnalysisServerListener;
-import com.google.dart.server.internal.SearchResultImpl;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import java.util.Iterator;
-
/**
* Processor for "search.results" notification.
*
@@ -41,29 +33,7 @@ public class NotificationSearchResultsProcessor extends NotificationProcessor {
JsonObject params = response.getAsJsonObject("params");
getListener().computedSearchResults(
params.get("id").getAsString(),
- constructSearchResultArray(params.getAsJsonArray("results")),
+ SearchResult.fromJsonArray(params.getAsJsonArray("results")),
params.get("last").getAsBoolean());
}
-
- protected SearchResult[] constructSearchResultArray(JsonArray jsonArray) {
- if (jsonArray == null) {
- return new SearchResult[] {};
- }
- int i = 0;
- SearchResult[] results = new SearchResult[jsonArray.size()];
- Iterator<JsonElement> iterator = jsonArray.iterator();
- while (iterator.hasNext()) {
- results[i] = constructSearchResult(iterator.next().getAsJsonObject());
- ++i;
- }
- return results;
- }
-
- private SearchResult constructSearchResult(JsonObject resultObject) {
- return new SearchResultImpl(
- Element.fromJsonArray(resultObject.getAsJsonArray("path")),
- SearchResultKind.valueOf(resultObject.get("kind").getAsString()),
- Location.fromJson(resultObject.getAsJsonObject("location")),
- resultObject.get("isPotential").getAsBoolean());
- }
}

Powered by Google App Engine
This is Rietveld 408576698