| Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerRenameRefactoring.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerExtractLocalRefactoring.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerRenameRefactoring.java
|
| similarity index 51%
|
| copy from editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerExtractLocalRefactoring.java
|
| copy to editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerRenameRefactoring.java
|
| index db3f836916e7f7021e5e1836020fb48ade4dd7a2..9a8c4601f9114fbde5958b0d4dec5aa6564af4be 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerExtractLocalRefactoring.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerRenameRefactoring.java
|
| @@ -14,43 +14,39 @@
|
|
|
| package com.google.dart.tools.ui.internal.refactoring;
|
|
|
| -import com.google.dart.server.generated.types.ExtractLocalVariableFeedback;
|
| -import com.google.dart.server.generated.types.ExtractLocalVariableOptions;
|
| import com.google.dart.server.generated.types.RefactoringFeedback;
|
| import com.google.dart.server.generated.types.RefactoringKind;
|
| import com.google.dart.server.generated.types.RefactoringOptions;
|
| +import com.google.dart.server.generated.types.RenameFeedback;
|
| +import com.google.dart.server.generated.types.RenameOptions;
|
|
|
| +import org.apache.commons.lang3.text.WordUtils;
|
| import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
|
|
| /**
|
| - * LTK wrapper around Analysis Server 'Extract Local' refactoring.
|
| + * LTK wrapper around Analysis Server 'Rename' refactoring.
|
| *
|
| * @coverage dart.editor.ui.refactoring.ui
|
| */
|
| -public class ServerExtractLocalRefactoring extends ServerRefactoring {
|
| - private ExtractLocalVariableOptions options = new ExtractLocalVariableOptions("name", true);
|
| - private boolean hasSeveralOccurrences;
|
| +public class ServerRenameRefactoring extends ServerRefactoring {
|
| + private RenameOptions options;
|
| + private String elementKindName;
|
| + private String oldName;
|
|
|
| - private String[] names;
|
| -
|
| - public ServerExtractLocalRefactoring(String file, int offset, int length) {
|
| - super(RefactoringKind.EXTRACT_LOCAL_VARIABLE, "Extract Local", file, offset, length);
|
| - }
|
| -
|
| - public String[] getNames() {
|
| - return names;
|
| + public ServerRenameRefactoring(String file, int offset, int length) {
|
| + super(RefactoringKind.RENAME, "Rename", file, offset, length);
|
| }
|
|
|
| - public boolean hasSeveralOccurrences() {
|
| - return hasSeveralOccurrences;
|
| + public String getElementKindName() {
|
| + return elementKindName;
|
| }
|
|
|
| - public void setExtractAll(boolean extractAll) {
|
| - options.setExtractAll(extractAll);
|
| + public String getOldName() {
|
| + return oldName;
|
| }
|
|
|
| - public RefactoringStatus setName(String name) {
|
| - options.setName(name);
|
| + public RefactoringStatus setNewName(String newName) {
|
| + options.setNewName(newName);
|
| return setOptions(true);
|
| }
|
|
|
| @@ -61,8 +57,11 @@ public class ServerExtractLocalRefactoring extends ServerRefactoring {
|
|
|
| @Override
|
| protected void setFeedback(RefactoringFeedback _feedback) {
|
| - ExtractLocalVariableFeedback feedback = (ExtractLocalVariableFeedback) _feedback;
|
| - hasSeveralOccurrences = feedback.getOffsets().length > 1;
|
| - names = toStringArray(feedback.getNames());
|
| + RenameFeedback feedback = (RenameFeedback) _feedback;
|
| + elementKindName = WordUtils.capitalize(feedback.getElementKindName());
|
| + oldName = feedback.getOldName();
|
| + if (options == null) {
|
| + options = new RenameOptions(oldName);
|
| + }
|
| }
|
| }
|
|
|