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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/RenameWizard_NEW.java

Issue 548593002: Integrate 'Rename' refactoring into Editor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/RenameWizard_NEW.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/RenameWizard_NEW.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/RenameWizard_NEW.java
new file mode 100644
index 0000000000000000000000000000000000000000..ea37a5a6659963f900269c3dfa52c8de05c5f79a
--- /dev/null
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/RenameWizard_NEW.java
@@ -0,0 +1,75 @@
+package com.google.dart.tools.ui.internal.refactoring;
+
+import com.google.dart.tools.ui.internal.util.GridLayoutFactory;
+import com.google.dart.tools.ui.internal.util.RowLayouter;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @coverage dart.editor.ui.refactoring.ui
+ */
+public class RenameWizard_NEW extends ServerRefactoringWizard {
+
+ private class RenameInputPage extends TextInputWizardPage {
+ public RenameInputPage() {
+ super(null, true, refactoring.getOldName());
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite result = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.create(result).columns(2).spacingVertical(8);
+ setControl(result);
+
+ RowLayouter layouter = new RowLayouter(2);
+
+ Label label = new Label(result, SWT.NONE);
+ label.setText("New &name:");
+
+ Text text = createTextInputField(result);
+ text.selectAll();
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ layouter.perform(label, text, 1);
+
+ Dialog.applyDialogFont(result);
+ }
+
+ @Override
+ protected boolean isEmptyInputValid() {
+ return true;
+ }
+
+ @Override
+ protected void textModified(String text) {
+ refactoring.setNewName(text);
+ super.textModified(text);
+ }
+
+ @Override
+ protected RefactoringStatus validateTextField(String text) {
+ return refactoring.setNewName(text);
+ }
+ }
+
+ static final String DIALOG_SETTING_SECTION = "RenameWizard";
+ private ServerRenameRefactoring refactoring;
+
+ public RenameWizard_NEW(ServerRenameRefactoring refactoring) {
+ super(refactoring, DIALOG_BASED_USER_INTERFACE | PREVIEW_EXPAND_FIRST_NODE);
+ this.refactoring = refactoring;
+ setDefaultPageTitle("Rename");
+ }
+
+ @Override
+ protected void addUserInputPages() {
+ setDefaultPageTitle("Rename " + refactoring.getElementKindName());
+ addPage(new RenameInputPage());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698