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

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

Issue 517043002: Re-implementation of the analysis.outline in the java layer, this uses the generated types, and rem… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase with bleeding_edge Created 6 years, 4 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/NotificationAnalysisOutlineProcessor.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationAnalysisOutlineProcessor.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationAnalysisOutlineProcessor.java
index a4cc5ad6be2da5f5297bac19753c3491261a70b1..1313174b9f14e9984cdb414332cddc2508a7aca9 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationAnalysisOutlineProcessor.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/NotificationAnalysisOutlineProcessor.java
@@ -13,18 +13,10 @@
*/
package com.google.dart.server.internal.remote.processor;
-import com.google.common.collect.Lists;
import com.google.dart.server.AnalysisServerListener;
-import com.google.dart.server.Outline;
-import com.google.dart.server.generated.types.Element;
-import com.google.dart.server.internal.OutlineImpl;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
+import com.google.dart.server.generated.types.Outline;
import com.google.gson.JsonObject;
-import java.util.Iterator;
-import java.util.List;
-
/**
* Processor for "analysis.outline" notification.
*
@@ -45,33 +37,7 @@ public class NotificationAnalysisOutlineProcessor extends NotificationProcessor
String file = paramsObject.get("file").getAsString();
JsonObject outlineObject = paramsObject.get("outline").getAsJsonObject();
// compute outline and notify listener
- getListener().computedOutline(file, constructOutline(null, outlineObject));
+ getListener().computedOutline(file, Outline.fromJson(null, outlineObject));
}
- private Outline constructOutline(Outline parent, JsonObject outlineObject) {
- JsonObject elementObject = outlineObject.get("element").getAsJsonObject();
- Element element = Element.fromJson(elementObject);
- int offset = outlineObject.get("offset").getAsInt();
- int length = outlineObject.get("length").getAsInt();
-
- // create outline object
- OutlineImpl outline = new OutlineImpl(parent, element, offset, length);
-
- // compute children recursively
- List<Outline> childrenList = Lists.newArrayList();
- if (outlineObject.has("children")) {
- JsonElement childrenJsonArray = outlineObject.get("children");
- if (childrenJsonArray instanceof JsonArray) {
- Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
- while (childrenElementIterator.hasNext()) {
- JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
- childrenList.add(constructOutline(outline, childObject));
- }
- }
- }
-
- // set children onto outline
- outline.setChildren(childrenList.toArray(new Outline[childrenList.size()]));
- return outline;
- }
}

Powered by Google App Engine
This is Rietveld 408576698