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

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

Issue 9834028: Initial implementation of "Rename Local Variable" refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: LInked/inline mode for rename Created 8 years, 9 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/UserInterfaceStarter.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/UserInterfaceStarter.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/UserInterfaceStarter.java
new file mode 100644
index 0000000000000000000000000000000000000000..09e3cd66f175e4f1b1654424552a642efc1bd418
--- /dev/null
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/UserInterfaceStarter.java
@@ -0,0 +1,46 @@
+package com.google.dart.tools.ui.internal.refactoring;
+
+import com.google.dart.tools.ui.internal.refactoring.actions.RefactoringStarter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Opens the user interface for a given refactoring.
+ */
+public class UserInterfaceStarter {
+
+ private RefactoringWizard fWizard;
+
+ /**
+ * Actually activates the user interface. This default implementation assumes that the
+ * configuration element passed to <code>initialize
+ * </code> has an attribute wizard denoting the wizard class to be used for the given refactoring.
+ * <p>
+ * Subclasses may override to open a different user interface
+ *
+ * @param refactoring the refactoring for which the user interface should be opened
+ * @param parent the parent shell to be used
+ * @param saveMode a save mode from {@link RefactoringSaveHelper}
+ * @return <code>true</code> iff the refactoring was executed, <code>false</code> otherwise
+ * @exception CoreException if the user interface can't be activated
+ */
+ public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException {
+ String title = fWizard.getDefaultPageTitle();
+ if (title == null) {
+ title = ""; //$NON-NLS-1$
+ }
+ return new RefactoringStarter().activate(fWizard, parent, title, saveMode);
+ }
+
+ /**
+ * Initializes this user interface starter with the given wizard.
+ *
+ * @param wizard the refactoring wizard to use
+ */
+ public void initialize(RefactoringWizard wizard) {
+ fWizard = wizard;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698