| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/TypeHierarchyProcessor.java
|
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/TypeHierarchyProcessor.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/TypeHierarchyProcessor.java
|
| index 98230ace57d8a9222e560bb276eac4fa1ef24fe3..03b9dffc05fc40f8b48443d25f0dec4201f98661 100644
|
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/TypeHierarchyProcessor.java
|
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/TypeHierarchyProcessor.java
|
| @@ -13,18 +13,11 @@
|
| */
|
| package com.google.dart.server.internal.remote.processor;
|
|
|
| -import com.google.common.collect.Lists;
|
| import com.google.dart.server.GetTypeHierarchyConsumer;
|
| -import com.google.dart.server.TypeHierarchyItem;
|
| -import com.google.dart.server.generated.types.Element;
|
| -import com.google.dart.server.internal.TypeHierarchyItemImpl;
|
| +import com.google.dart.server.generated.types.TypeHierarchyItem;
|
| import com.google.gson.JsonArray;
|
| -import com.google.gson.JsonElement;
|
| import com.google.gson.JsonObject;
|
|
|
| -import java.util.Iterator;
|
| -import java.util.List;
|
| -
|
| /**
|
| * Instances of {@code TypeHierarchyResultProcessor} translate JSON result objects for a given
|
| * {@link GetTypeHierarchyConsumer}.
|
| @@ -40,62 +33,9 @@ public class TypeHierarchyProcessor extends ResultProcessor {
|
| }
|
|
|
| public void process(JsonObject resultObject) {
|
| - JsonObject hierarchyObject = resultObject.get("hierarchy").getAsJsonObject();
|
| - // construct type hierarchy and notify listener
|
| - consumer.computedHierarchy(constructTypeHierarchyItem(hierarchyObject));
|
| - }
|
| -
|
| - private TypeHierarchyItem constructTypeHierarchyItem(JsonObject hierarchyObject) {
|
| - // classElement
|
| - Element classElement = Element.fromJson(hierarchyObject.get("classElement").getAsJsonObject());
|
| -
|
| - // displayName
|
| - String displayName = safelyGetAsString(hierarchyObject, "displayName");
|
| -
|
| - // memberElement
|
| - JsonObject memberElementObject = safelyGetAsJsonObject(hierarchyObject, "memberElement");
|
| - Element memberElement = memberElementObject != null ? Element.fromJson(memberElementObject)
|
| - : null;
|
| -
|
| - // superclass
|
| - JsonObject superclassObject = safelyGetAsJsonObject(hierarchyObject, "superclass");
|
| - TypeHierarchyItem superclassItem = superclassObject != null
|
| - ? constructTypeHierarchyItem(superclassObject) : null;
|
| -
|
| - // interfaces
|
| - JsonArray interfacesArray = hierarchyObject.get("interfaces").getAsJsonArray();
|
| - List<TypeHierarchyItem> interfacesList = Lists.newArrayList();
|
| - Iterator<JsonElement> interfaceElementIterator = interfacesArray.iterator();
|
| - while (interfaceElementIterator.hasNext()) {
|
| - JsonObject interfaceObject = interfaceElementIterator.next().getAsJsonObject();
|
| - interfacesList.add(constructTypeHierarchyItem(interfaceObject));
|
| - }
|
| -
|
| - // mixins
|
| - JsonArray mixinsArray = hierarchyObject.get("mixins").getAsJsonArray();
|
| - List<TypeHierarchyItem> mixinsList = Lists.newArrayList();
|
| - Iterator<JsonElement> mixinElementIterator = mixinsArray.iterator();
|
| - while (mixinElementIterator.hasNext()) {
|
| - JsonObject mixinObject = mixinElementIterator.next().getAsJsonObject();
|
| - mixinsList.add(constructTypeHierarchyItem(mixinObject));
|
| - }
|
| -
|
| - // subclasses
|
| - JsonArray subclassesArray = hierarchyObject.get("subclasses").getAsJsonArray();
|
| - List<TypeHierarchyItem> subclassesList = Lists.newArrayList();
|
| - Iterator<JsonElement> subclassElementIterator = subclassesArray.iterator();
|
| - while (subclassElementIterator.hasNext()) {
|
| - JsonObject subclassObject = subclassElementIterator.next().getAsJsonObject();
|
| - subclassesList.add(constructTypeHierarchyItem(subclassObject));
|
| - }
|
| -
|
| - return new TypeHierarchyItemImpl(
|
| - classElement,
|
| - displayName,
|
| - memberElement,
|
| - superclassItem,
|
| - interfacesList.toArray(new TypeHierarchyItem[interfacesList.size()]),
|
| - mixinsList.toArray(new TypeHierarchyItem[mixinsList.size()]),
|
| - subclassesList.toArray(new TypeHierarchyItem[subclassesList.size()]));
|
| + JsonArray typeHierarchyItemsArray = resultObject.get("hierarchyItems") != null
|
| + ? resultObject.get("hierarchyItems").getAsJsonArray() : null;
|
| + // construct type hierarchy item list and notify listener
|
| + consumer.computedHierarchy(TypeHierarchyItem.fromJsonArray(typeHierarchyItemsArray));
|
| }
|
| }
|
|
|