| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationTarget.java
|
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationTarget.java
|
| similarity index 63%
|
| copy from editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java
|
| copy to editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationTarget.java
|
| index a0eac2035ef2922d8ec2e92e24b8614ceb09db56..43ed40686d569c7f966c9d179a2fe3e1300bbddf 100644
|
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java
|
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationTarget.java
|
| @@ -32,47 +32,55 @@ import java.util.Iterator;
|
| import org.apache.commons.lang3.StringUtils;
|
|
|
| /**
|
| - * A location (character range) within a file.
|
| + * A description of a target to which the user can navigate to.
|
| *
|
| * @coverage dart.server.generated.types
|
| */
|
| @SuppressWarnings("unused")
|
| -public class Location {
|
| +public class NavigationTarget {
|
|
|
| - public static final Location[] EMPTY_ARRAY = new Location[0];
|
| + public static final NavigationTarget[] EMPTY_ARRAY = new NavigationTarget[0];
|
|
|
| - public static final List<Location> EMPTY_LIST = Lists.newArrayList();
|
| + public static final List<NavigationTarget> EMPTY_LIST = Lists.newArrayList();
|
|
|
| /**
|
| - * The file containing the range.
|
| + * The kind of the element.
|
| */
|
| - private final String file;
|
| + private final String kind;
|
|
|
| /**
|
| - * The offset of the range.
|
| + * The index of the file (in the enclosing navigation response) to navigate to.
|
| + */
|
| + private final int fileIndex;
|
| +
|
| + /**
|
| + * The offset of the region from which the user can navigate.
|
| */
|
| private final int offset;
|
|
|
| /**
|
| - * The length of the range.
|
| + * The length of the region from which the user can navigate.
|
| */
|
| private final int length;
|
|
|
| /**
|
| - * The one-based index of the line containing the first character of the range.
|
| + * The one-based index of the line containing the first character of the region.
|
| */
|
| private final int startLine;
|
|
|
| /**
|
| - * The one-based index of the column containing the first character of the range.
|
| + * The one-based index of the column containing the first character of the region.
|
| */
|
| private final int startColumn;
|
|
|
| + private String[] allTargetFiles;
|
| +
|
| /**
|
| - * Constructor for {@link Location}.
|
| + * Constructor for {@link NavigationTarget}.
|
| */
|
| - public Location(String file, int offset, int length, int startLine, int startColumn) {
|
| - this.file = file;
|
| + public NavigationTarget(String kind, int fileIndex, int offset, int length, int startLine, int startColumn) {
|
| + this.kind = kind;
|
| + this.fileIndex = fileIndex;
|
| this.offset = offset;
|
| this.length = length;
|
| this.startLine = startLine;
|
| @@ -81,10 +89,11 @@ public class Location {
|
|
|
| @Override
|
| public boolean equals(Object obj) {
|
| - if (obj instanceof Location) {
|
| - Location other = (Location) obj;
|
| + if (obj instanceof NavigationTarget) {
|
| + NavigationTarget other = (NavigationTarget) obj;
|
| return
|
| - ObjectUtilities.equals(other.file, file) &&
|
| + ObjectUtilities.equals(other.kind, kind) &&
|
| + other.fileIndex == fileIndex &&
|
| other.offset == offset &&
|
| other.length == length &&
|
| other.startLine == startLine &&
|
| @@ -93,20 +102,21 @@ public class Location {
|
| return false;
|
| }
|
|
|
| - public static Location fromJson(JsonObject jsonObject) {
|
| - String file = jsonObject.get("file").getAsString();
|
| + public static NavigationTarget fromJson(JsonObject jsonObject) {
|
| + String kind = jsonObject.get("kind").getAsString();
|
| + int fileIndex = jsonObject.get("fileIndex").getAsInt();
|
| int offset = jsonObject.get("offset").getAsInt();
|
| int length = jsonObject.get("length").getAsInt();
|
| int startLine = jsonObject.get("startLine").getAsInt();
|
| int startColumn = jsonObject.get("startColumn").getAsInt();
|
| - return new Location(file, offset, length, startLine, startColumn);
|
| + return new NavigationTarget(kind, fileIndex, offset, length, startLine, startColumn);
|
| }
|
|
|
| - public static List<Location> fromJsonArray(JsonArray jsonArray) {
|
| + public static List<NavigationTarget> fromJsonArray(JsonArray jsonArray) {
|
| if (jsonArray == null) {
|
| return EMPTY_LIST;
|
| }
|
| - ArrayList<Location> list = new ArrayList<Location>(jsonArray.size());
|
| + ArrayList<NavigationTarget> list = new ArrayList<NavigationTarget>(jsonArray.size());
|
| Iterator<JsonElement> iterator = jsonArray.iterator();
|
| while (iterator.hasNext()) {
|
| list.add(fromJson(iterator.next().getAsJsonObject()));
|
| @@ -114,36 +124,47 @@ public class Location {
|
| return list;
|
| }
|
|
|
| + public String getFile() {
|
| + return allTargetFiles[fileIndex];
|
| + }
|
| +
|
| /**
|
| - * The file containing the range.
|
| + * The index of the file (in the enclosing navigation response) to navigate to.
|
| */
|
| - public String getFile() {
|
| - return file;
|
| + public int getFileIndex() {
|
| + return fileIndex;
|
| }
|
|
|
| /**
|
| - * The length of the range.
|
| + * The kind of the element.
|
| + */
|
| + public String getKind() {
|
| + return kind;
|
| + }
|
| +
|
| + /**
|
| + * The length of the region from which the user can navigate.
|
| */
|
| public int getLength() {
|
| return length;
|
| }
|
|
|
| /**
|
| - * The offset of the range.
|
| + * The offset of the region from which the user can navigate.
|
| */
|
| public int getOffset() {
|
| return offset;
|
| }
|
|
|
| /**
|
| - * The one-based index of the column containing the first character of the range.
|
| + * The one-based index of the column containing the first character of the region.
|
| */
|
| public int getStartColumn() {
|
| return startColumn;
|
| }
|
|
|
| /**
|
| - * The one-based index of the line containing the first character of the range.
|
| + * The one-based index of the line containing the first character of the region.
|
| */
|
| public int getStartLine() {
|
| return startLine;
|
| @@ -152,7 +173,8 @@ public class Location {
|
| @Override
|
| public int hashCode() {
|
| HashCodeBuilder builder = new HashCodeBuilder();
|
| - builder.append(file);
|
| + builder.append(kind);
|
| + builder.append(fileIndex);
|
| builder.append(offset);
|
| builder.append(length);
|
| builder.append(startLine);
|
| @@ -160,9 +182,14 @@ public class Location {
|
| return builder.toHashCode();
|
| }
|
|
|
| + public void setAllTargetFiles(String[] allTargetFiles) {
|
| + this.allTargetFiles = allTargetFiles;
|
| + }
|
| +
|
| public JsonObject toJson() {
|
| JsonObject jsonObject = new JsonObject();
|
| - jsonObject.addProperty("file", file);
|
| + jsonObject.addProperty("kind", kind);
|
| + jsonObject.addProperty("fileIndex", fileIndex);
|
| jsonObject.addProperty("offset", offset);
|
| jsonObject.addProperty("length", length);
|
| jsonObject.addProperty("startLine", startLine);
|
| @@ -174,8 +201,10 @@ public class Location {
|
| public String toString() {
|
| StringBuilder builder = new StringBuilder();
|
| builder.append("[");
|
| - builder.append("file=");
|
| - builder.append(file + ", ");
|
| + builder.append("kind=");
|
| + builder.append(kind + ", ");
|
| + builder.append("fileIndex=");
|
| + builder.append(fileIndex + ", ");
|
| builder.append("offset=");
|
| builder.append(offset + ", ");
|
| builder.append("length=");
|
|
|