| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/ExtractLocalVariableOptions.java
|
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/FoldingRegion.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/ExtractLocalVariableOptions.java
|
| similarity index 50%
|
| copy from editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/FoldingRegion.java
|
| copy to editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/ExtractLocalVariableOptions.java
|
| index 348862a955d9c6623dfad694bce95fd37a5b040b..ec708b351db562cf9aba667503ddddbbcbd71d5b 100644
|
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/FoldingRegion.java
|
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/ExtractLocalVariableOptions.java
|
| @@ -32,65 +32,57 @@ import java.util.Iterator;
|
| import org.apache.commons.lang3.StringUtils;
|
|
|
| /**
|
| - * A description of a region that can be folded.
|
| - *
|
| * @coverage dart.server.generated.types
|
| */
|
| @SuppressWarnings("unused")
|
| -public class FoldingRegion {
|
| -
|
| - public static final FoldingRegion[] EMPTY_ARRAY = new FoldingRegion[0];
|
| +public class ExtractLocalVariableOptions extends RefactoringOptions {
|
|
|
| - public static final List<FoldingRegion> EMPTY_LIST = Lists.newArrayList();
|
| + public static final ExtractLocalVariableOptions[] EMPTY_ARRAY = new ExtractLocalVariableOptions[0];
|
|
|
| - /**
|
| - * The kind of the region.
|
| - */
|
| - private final String kind;
|
| + public static final List<ExtractLocalVariableOptions> EMPTY_LIST = Lists.newArrayList();
|
|
|
| /**
|
| - * The offset of the region to be folded.
|
| + * The name that the local variable should be given.
|
| */
|
| - private final Integer offset;
|
| + private final String name;
|
|
|
| /**
|
| - * The length of the region to be folded.
|
| + * True if all occurrences of the expression within the scope in which the variable will be defined
|
| + * should be replaced by a reference to the local variable. The expression used to initiate the
|
| + * refactoring will always be replaced.
|
| */
|
| - private final Integer length;
|
| + private final Boolean extractAll;
|
|
|
| /**
|
| - * Constructor for {@link FoldingRegion}.
|
| + * Constructor for {@link ExtractLocalVariableOptions}.
|
| */
|
| - public FoldingRegion(String kind, Integer offset, Integer length) {
|
| - this.kind = kind;
|
| - this.offset = offset;
|
| - this.length = length;
|
| + public ExtractLocalVariableOptions(String name, Boolean extractAll) {
|
| + this.name = name;
|
| + this.extractAll = extractAll;
|
| }
|
|
|
| @Override
|
| public boolean equals(Object obj) {
|
| - if (obj instanceof FoldingRegion) {
|
| - FoldingRegion other = (FoldingRegion) obj;
|
| + if (obj instanceof ExtractLocalVariableOptions) {
|
| + ExtractLocalVariableOptions other = (ExtractLocalVariableOptions) obj;
|
| return
|
| - ObjectUtilities.equals(other.kind, kind) &&
|
| - other.offset == offset &&
|
| - other.length == length;
|
| + ObjectUtilities.equals(other.name, name) &&
|
| + ObjectUtilities.equals(other.extractAll, extractAll);
|
| }
|
| return false;
|
| }
|
|
|
| - public static FoldingRegion fromJson(JsonObject jsonObject) {
|
| - String kind = jsonObject.get("kind").getAsString();
|
| - Integer offset = jsonObject.get("offset").getAsInt();
|
| - Integer length = jsonObject.get("length").getAsInt();
|
| - return new FoldingRegion(kind, offset, length);
|
| + public static ExtractLocalVariableOptions fromJson(JsonObject jsonObject) {
|
| + String name = jsonObject.get("name").getAsString();
|
| + Boolean extractAll = jsonObject.get("extractAll").getAsBoolean();
|
| + return new ExtractLocalVariableOptions(name, extractAll);
|
| }
|
|
|
| - public static List<FoldingRegion> fromJsonArray(JsonArray jsonArray) {
|
| + public static List<ExtractLocalVariableOptions> fromJsonArray(JsonArray jsonArray) {
|
| if (jsonArray == null) {
|
| return EMPTY_LIST;
|
| }
|
| - ArrayList<FoldingRegion> list = new ArrayList<FoldingRegion>(jsonArray.size());
|
| + ArrayList<ExtractLocalVariableOptions> list = new ArrayList<ExtractLocalVariableOptions>(jsonArray.size());
|
| Iterator<JsonElement> iterator = jsonArray.iterator();
|
| while (iterator.hasNext()) {
|
| list.add(fromJson(iterator.next().getAsJsonObject()));
|
| @@ -99,40 +91,33 @@ public class FoldingRegion {
|
| }
|
|
|
| /**
|
| - * The kind of the region.
|
| - */
|
| - public String getKind() {
|
| - return kind;
|
| - }
|
| -
|
| - /**
|
| - * The length of the region to be folded.
|
| + * True if all occurrences of the expression within the scope in which the variable will be defined
|
| + * should be replaced by a reference to the local variable. The expression used to initiate the
|
| + * refactoring will always be replaced.
|
| */
|
| - public Integer getLength() {
|
| - return length;
|
| + public Boolean extractAll() {
|
| + return extractAll;
|
| }
|
|
|
| /**
|
| - * The offset of the region to be folded.
|
| + * The name that the local variable should be given.
|
| */
|
| - public Integer getOffset() {
|
| - return offset;
|
| + public String getName() {
|
| + return name;
|
| }
|
|
|
| @Override
|
| public int hashCode() {
|
| HashCodeBuilder builder = new HashCodeBuilder();
|
| - builder.append(kind);
|
| - builder.append(offset);
|
| - builder.append(length);
|
| + builder.append(name);
|
| + builder.append(extractAll);
|
| return builder.toHashCode();
|
| }
|
|
|
| public JsonObject toJson() {
|
| JsonObject jsonObject = new JsonObject();
|
| - jsonObject.addProperty("kind", kind);
|
| - jsonObject.addProperty("offset", offset);
|
| - jsonObject.addProperty("length", length);
|
| + jsonObject.addProperty("name", name);
|
| + jsonObject.addProperty("extractAll", extractAll);
|
| return jsonObject;
|
| }
|
|
|
| @@ -140,12 +125,10 @@ public class FoldingRegion {
|
| public String toString() {
|
| StringBuilder builder = new StringBuilder();
|
| builder.append("[");
|
| - builder.append("kind=");
|
| - builder.append(kind + ", ");
|
| - builder.append("offset=");
|
| - builder.append(offset + ", ");
|
| - builder.append("length=");
|
| - builder.append(length);
|
| + builder.append("name=");
|
| + builder.append(name + ", ");
|
| + builder.append("extractAll=");
|
| + builder.append(extractAll);
|
| builder.append("]");
|
| return builder.toString();
|
| }
|
|
|