|
From: <mir...@us...> - 2007-03-16 12:23:47
|
Revision: 2184
http://svn.sourceforge.net/rubyeclipse/?rev=2184&view=rev
Author: mirkostocker
Date: 2007-03-16 05:23:45 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
rename temp to local again.. I hope this were the last ones
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ConvertTempToFieldAction.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/InlineTempAction.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/splitlocal/SplitTempRefactoring.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinetemp/TempInlinerTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinetemp/conditionchecks/InlineTempConditionTester.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertLocalToFieldRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineLocalRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalValueReplaceProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalVariableInliner.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertLocalToFieldPage.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineLocalPage.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/SplitLocalPage.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertTempToFieldRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineTempRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempInliner.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempValueReplaceProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertTempToFieldPage.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineTempPage.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/SplitTempPage.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ConvertTempToFieldAction.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ConvertTempToFieldAction.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ConvertTempToFieldAction.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -28,12 +28,12 @@
package org.rubypeople.rdt.refactoring.action;
-import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertTempToFieldRefactoring;
+import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertLocalToFieldRefactoring;
public class ConvertTempToFieldAction extends WorkbenchWindowActionDelegate {
@Override
public void run() {
- run(ConvertTempToFieldRefactoring.class, ConvertTempToFieldRefactoring.NAME);
+ run(ConvertLocalToFieldRefactoring.class, ConvertLocalToFieldRefactoring.NAME);
}
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/InlineTempAction.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/InlineTempAction.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/InlineTempAction.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -30,13 +30,13 @@
package org.rubypeople.rdt.refactoring.action;
-import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineTempRefactoring;
+import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalRefactoring;
public class InlineTempAction extends WorkbenchWindowActionDelegate {
@Override
public void run() {
- run(InlineTempRefactoring.class, InlineTempRefactoring.NAME);
+ run(InlineLocalRefactoring.class, InlineLocalRefactoring.NAME);
}
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -33,13 +33,13 @@
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.actions.ActionGroup;
import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
-import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertTempToFieldRefactoring;
+import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertLocalToFieldRefactoring;
import org.rubypeople.rdt.refactoring.core.encapsulatefield.EncapsulateFieldRefactoring;
import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodRefactoring;
import org.rubypeople.rdt.refactoring.core.generateaccessors.GenerateAccessorsRefactoring;
import org.rubypeople.rdt.refactoring.core.generateconstructor.GenerateConstructorRefactoring;
import org.rubypeople.rdt.refactoring.core.inlineclass.InlineClassRefactoring;
-import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineTempRefactoring;
+import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalRefactoring;
import org.rubypeople.rdt.refactoring.core.inlinemethod.InlineMethodRefactoring;
import org.rubypeople.rdt.refactoring.core.mergeclasspartsinfile.MergeClassPartsInFileRefactoring;
import org.rubypeople.rdt.refactoring.core.mergewithexternalclassparts.MergeWithExternalClassPartsRefactoring;
@@ -64,11 +64,11 @@
private IMenuManager getRefactorMenu(TextSelectionProvider selectionProvider) {
IMenuManager submenu = new MenuManager(Messages.RefactoringActionGroup);
- submenu.add(new RefactoringAction(ConvertTempToFieldRefactoring.class, ConvertTempToFieldRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(ConvertLocalToFieldRefactoring.class, ConvertLocalToFieldRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(EncapsulateFieldRefactoring.class, EncapsulateFieldRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(ExtractMethodRefactoring.class, ExtractMethodRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(InlineClassRefactoring.class, InlineClassRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(InlineTempRefactoring.class, InlineTempRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(InlineLocalRefactoring.class, InlineLocalRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(InlineMethodRefactoring.class, InlineMethodRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(MergeClassPartsInFileRefactoring.class, MergeClassPartsInFileRefactoring.NAME, selectionProvider));
submenu.add(new RefactoringAction(MergeWithExternalClassPartsRefactoring.class, MergeWithExternalClassPartsRefactoring.NAME, selectionProvider));
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertLocalToFieldRefactoring.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertTempToFieldRefactoring.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertLocalToFieldRefactoring.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertLocalToFieldRefactoring.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,71 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.convertlocaltofield;
+
+import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
+import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
+import org.rubypeople.rdt.refactoring.ui.pages.ConvertLocalToFieldPage;
+import org.rubypeople.rdt.refactoring.ui.pages.ConverterPageParameters;
+
+public class ConvertLocalToFieldRefactoring extends RubyRefactoring {
+
+ public static final String NAME = Messages.ConvertLocalToFieldRefactoring_Name;
+
+ public ConvertLocalToFieldRefactoring(TextSelectionProvider selectionProvider) {
+ super(NAME);
+
+ LocalToFieldConfig config = new LocalToFieldConfig(getDocumentProvider(), selectionProvider.getCarretPosition());
+ LocalToFieldConditionChecker checker = new LocalToFieldConditionChecker(config);
+
+ setRefactoringConditionChecker(checker);
+
+ if(checker.shouldPerform()) {
+ LocalToFieldConverter tempToFieldConverter = new LocalToFieldConverter(config);
+ setEditProvider(tempToFieldConverter);
+ ConverterPageParameters pageParameters = createPageParameters(tempToFieldConverter);
+ ConvertLocalToFieldPage page = new ConvertLocalToFieldPage(tempToFieldConverter, pageParameters);
+ pages.add(page);
+ }
+ }
+
+ private ConverterPageParameters createPageParameters(LocalToFieldConverter tempToFieldConverter) {
+ ConverterPageParameters pageParameters = new ConverterPageParameters();
+
+ if (tempToFieldConverter.isVariableInConstructor()) {
+ pageParameters.setInClassConstructorRadioEnabled(false);
+ }
+
+ if (!tempToFieldConverter.isInitializationExternalizable()) {
+ pageParameters.setInClassConstructorRadioEnabled(false);
+
+ }
+
+ return pageParameters;
+ }
+}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertTempToFieldRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertTempToFieldRefactoring.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/convertlocaltofield/ConvertTempToFieldRefactoring.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -1,71 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.core.convertlocaltofield;
-
-import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
-import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
-import org.rubypeople.rdt.refactoring.ui.pages.ConvertTempToFieldPage;
-import org.rubypeople.rdt.refactoring.ui.pages.ConverterPageParameters;
-
-public class ConvertTempToFieldRefactoring extends RubyRefactoring {
-
- public static final String NAME = Messages.ConvertLocalToFieldRefactoring_Name;
-
- public ConvertTempToFieldRefactoring(TextSelectionProvider selectionProvider) {
- super(NAME);
-
- LocalToFieldConfig config = new LocalToFieldConfig(getDocumentProvider(), selectionProvider.getCarretPosition());
- LocalToFieldConditionChecker checker = new LocalToFieldConditionChecker(config);
-
- setRefactoringConditionChecker(checker);
-
- if(checker.shouldPerform()) {
- LocalToFieldConverter tempToFieldConverter = new LocalToFieldConverter(config);
- setEditProvider(tempToFieldConverter);
- ConverterPageParameters pageParameters = createPageParameters(tempToFieldConverter);
- ConvertTempToFieldPage page = new ConvertTempToFieldPage(tempToFieldConverter, pageParameters);
- pages.add(page);
- }
- }
-
- private ConverterPageParameters createPageParameters(LocalToFieldConverter tempToFieldConverter) {
- ConverterPageParameters pageParameters = new ConverterPageParameters();
-
- if (tempToFieldConverter.isVariableInConstructor()) {
- pageParameters.setInClassConstructorRadioEnabled(false);
- }
-
- if (!tempToFieldConverter.isInitializationExternalizable()) {
- pageParameters.setInClassConstructorRadioEnabled(false);
-
- }
-
- return pageParameters;
- }
-}
\ No newline at end of file
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineLocalRefactoring.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineTempRefactoring.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineLocalRefactoring.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineLocalRefactoring.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,56 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.inlinelocal;
+
+import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
+import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
+import org.rubypeople.rdt.refactoring.ui.pages.InlineLocalPage;
+
+public class InlineLocalRefactoring extends RubyRefactoring {
+
+ public static final String NAME = Messages.InlineLocalRefactoring_Name;
+
+ private LocalVariableInliner tempInliner;
+
+ public InlineLocalRefactoring(TextSelectionProvider selectionProvider) {
+ super(NAME);
+
+ InlineLocalConfig config = new InlineLocalConfig(getDocumentProvider(), selectionProvider.getCarretPosition());
+ InlineLocalConditionChecker checker = new InlineLocalConditionChecker(config);
+ setRefactoringConditionChecker(checker);
+
+ if(checker.shouldPerform()) {
+ tempInliner = new LocalVariableInliner(config);
+ setEditProvider(tempInliner);
+ pages.add(new InlineLocalPage(config, tempInliner.getOccurrencesCount(), tempInliner.getSelectedItemName()));
+ }
+ }
+}
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineTempRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineTempRefactoring.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/InlineTempRefactoring.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -1,56 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- * Copyright (C) 2006 Mirko Stocker <me...@mi...>
- * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.core.inlinelocal;
-
-import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
-import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
-import org.rubypeople.rdt.refactoring.ui.pages.InlineTempPage;
-
-public class InlineTempRefactoring extends RubyRefactoring {
-
- public static final String NAME = Messages.InlineLocalRefactoring_Name;
-
- private TempInliner tempInliner;
-
- public InlineTempRefactoring(TextSelectionProvider selectionProvider) {
- super(NAME);
-
- InlineLocalConfig config = new InlineLocalConfig(getDocumentProvider(), selectionProvider.getCarretPosition());
- InlineLocalConditionChecker checker = new InlineLocalConditionChecker(config);
- setRefactoringConditionChecker(checker);
-
- if(checker.shouldPerform()) {
- tempInliner = new TempInliner(config);
- setEditProvider(tempInliner);
- pages.add(new InlineTempPage(config, tempInliner.getOccurrencesCount(), tempInliner.getSelectedItemName()));
- }
- }
-}
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalValueReplaceProvider.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempValueReplaceProvider.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalValueReplaceProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalValueReplaceProvider.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,118 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.inlinelocal;
+
+
+import org.jruby.ast.CallNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.visitor.rewriter.DefaultFormatHelper;
+import org.jruby.ast.visitor.rewriter.FormatHelper;
+import org.jruby.lexer.yacc.ISourcePosition;
+import org.rubypeople.rdt.refactoring.core.NodeProvider;
+import org.rubypeople.rdt.refactoring.editprovider.ReplaceEditProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.LocalNodeWrapper;
+import org.rubypeople.rdt.refactoring.nodewrapper.MethodCallNodeWrapper;
+import org.rubypeople.rdt.refactoring.util.JRubyRefactoringUtils;
+import org.rubypeople.rdt.refactoring.util.NodeUtil;
+
+public class LocalValueReplaceProvider extends ReplaceEditProvider {
+
+ private LocalNodeWrapper targetNode;
+
+ private LocalNodeWrapper inlinedNode;
+
+ private boolean addBrackets;
+
+ private InlineLocalConfig config;
+
+ public LocalValueReplaceProvider(LocalNodeWrapper targetNode, InlineLocalConfig config, boolean addBrackets) {
+ super(false);
+ this.config = config;
+ this.inlinedNode = config.getDefinitionNode();
+ this.targetNode = targetNode;
+ this.addBrackets = addBrackets;
+ }
+
+ @Override
+ protected int getOffsetLength() {
+ ISourcePosition replacePos = targetNode.getWrappedNode().getPosition();
+ return replacePos.getEndOffset() - replacePos.getStartOffset();
+ }
+
+ @Override
+ protected Node getEditNode(int offset, String document) {
+ return inlinedNode.getValueNode();
+ }
+
+ @Override
+ protected int getOffset(String document) {
+ return targetNode.getWrappedNode().getPosition().getStartOffset();
+ }
+
+ protected String getFormatedNode(String document) {
+ if(addBrackets) {
+ return '(' + super.getFormatedNode(document) + ')';
+ }
+ return super.getFormatedNode(document);
+ }
+
+ @Override
+ protected FormatHelper getFormatHelper() {
+ if(callNeedsBrackets()) {
+ return new DefaultFormatHelper() {
+
+ @Override
+ public String afterCallArguments() {
+ return ")";
+ }
+
+ @Override
+ public String beforeCallArguments() {
+ return "(";
+ }};
+ } else {
+ return super.getFormatHelper();
+ }
+ }
+
+ private boolean callNeedsBrackets() {
+ Node targetEnclosingNode = NodeProvider.findParentNode(config.getDocumentProvider().getActiveFileRootNode(), targetNode.getWrappedNode());
+ boolean isTargetEnclosingNodeCallNode = NodeUtil.nodeAssignableFrom(targetEnclosingNode, MethodCallNodeWrapper.METHOD_CALL_NODE_CLASSES());
+ if(NodeUtil.nodeAssignableFrom(targetEnclosingNode, CallNode.class)) {
+ isTargetEnclosingNodeCallNode &= !JRubyRefactoringUtils.isMathematicalExpression(targetEnclosingNode);
+ }
+ boolean isInlinedNodeCallNode = NodeUtil.nodeAssignableFrom(inlinedNode.getValueNode(), MethodCallNodeWrapper.METHOD_CALL_NODE_CLASSES());
+ if(NodeUtil.nodeAssignableFrom(inlinedNode.getValueNode(), CallNode.class)) {
+ isInlinedNodeCallNode &= !JRubyRefactoringUtils.isMathematicalExpression(inlinedNode.getValueNode());
+ }
+ return isTargetEnclosingNodeCallNode && isInlinedNodeCallNode;
+ }
+}
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalVariableInliner.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempInliner.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalVariableInliner.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/LocalVariableInliner.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,112 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.inlinelocal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.rubypeople.rdt.refactoring.core.SelectionInformation;
+import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodConditionChecker;
+import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodConfig;
+import org.rubypeople.rdt.refactoring.core.extractmethod.MethodExtractor;
+import org.rubypeople.rdt.refactoring.editprovider.DeleteEditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.EditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.MultiEditProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.LocalNodeWrapper;
+import org.rubypeople.rdt.refactoring.util.JRubyRefactoringUtils;
+
+public class LocalVariableInliner extends MultiEditProvider {
+
+ private InlineLocalConfig config;
+
+ private ExtractMethodConfig extractConfig;
+
+ public LocalVariableInliner(InlineLocalConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ protected Collection<EditProvider> getEditProviders() {
+ ArrayList<EditProvider> editProviders = new ArrayList<EditProvider>();
+ editProviders.add(createDeleteEdit());
+
+ if (config.isReplaceTempWithQuery()) {
+ editProviders.add(extractMethodProvider());
+ for (LocalNodeWrapper currentLocalNode : config.getLocalOccurrences()) {
+ editProviders.add(replaceWithMethodCallProvider(currentLocalNode));
+ }
+ } else {
+ for (LocalNodeWrapper currentLocalNode : config.getLocalOccurrences()) {
+ editProviders.add(replaceWithValueProvider(currentLocalNode));
+ }
+ }
+ return editProviders;
+ }
+
+ private EditProvider replaceWithMethodCallProvider(LocalNodeWrapper targetNode) {
+ return new MethodCallReplaceProvider(targetNode, extractConfig.getHelper().getMethodCallNode());
+ }
+
+ private EditProvider replaceWithValueProvider(LocalNodeWrapper targetNode) {
+
+ boolean addBrackets = JRubyRefactoringUtils.isMathematicalExpression(config.getDefinitionNode().getValueNode());
+ return new LocalValueReplaceProvider(targetNode, config, addBrackets);
+ }
+
+ private EditProvider extractMethodProvider() {
+
+ int startPos = config.getDefinitionNode().getValueNode().getPosition().getStartOffset();
+ int endPos = config.getDefinitionNode().getValueNode().getPosition().getEndOffset();
+
+ extractConfig = new ExtractMethodConfig(config.getDocumentProvider(), new SelectionInformation(startPos, endPos, "")); //$NON-NLS-1$
+ new ExtractMethodConditionChecker(extractConfig);
+ MethodExtractor methodExtractor = new MethodExtractor(extractConfig);
+ extractConfig.getHelper().setMethodName(config.getNewMethodName());
+
+ return methodExtractor.getDefEdit();
+ }
+
+ private EditProvider createDeleteEdit() {
+ return new DeleteEditProvider(config.getDefinitionNode().getWrappedNode());
+ }
+
+ public int getOccurrencesCount() {
+ return config.getLocalOccurrences() == null ? 0 : config.getLocalOccurrences().size();
+ }
+
+ public String getSelectedItemName() {
+ return config.getSelectedItemName();
+ }
+
+ public InlineLocalConfig getConfig() {
+ return config;
+ }
+}
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempInliner.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempInliner.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempInliner.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -1,112 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- * Copyright (C) 2006 Mirko Stocker <me...@mi...>
- * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.core.inlinelocal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.rubypeople.rdt.refactoring.core.SelectionInformation;
-import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodConditionChecker;
-import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodConfig;
-import org.rubypeople.rdt.refactoring.core.extractmethod.MethodExtractor;
-import org.rubypeople.rdt.refactoring.editprovider.DeleteEditProvider;
-import org.rubypeople.rdt.refactoring.editprovider.EditProvider;
-import org.rubypeople.rdt.refactoring.editprovider.MultiEditProvider;
-import org.rubypeople.rdt.refactoring.nodewrapper.LocalNodeWrapper;
-import org.rubypeople.rdt.refactoring.util.JRubyRefactoringUtils;
-
-public class TempInliner extends MultiEditProvider {
-
- private InlineLocalConfig config;
-
- private ExtractMethodConfig extractConfig;
-
- public TempInliner(InlineLocalConfig config) {
- this.config = config;
- }
-
- @Override
- protected Collection<EditProvider> getEditProviders() {
- ArrayList<EditProvider> editProviders = new ArrayList<EditProvider>();
- editProviders.add(createDeleteEdit());
-
- if (config.isReplaceTempWithQuery()) {
- editProviders.add(extractMethodProvider());
- for (LocalNodeWrapper currentLocalNode : config.getLocalOccurrences()) {
- editProviders.add(replaceWithMethodCallProvider(currentLocalNode));
- }
- } else {
- for (LocalNodeWrapper currentLocalNode : config.getLocalOccurrences()) {
- editProviders.add(replaceWithValueProvider(currentLocalNode));
- }
- }
- return editProviders;
- }
-
- private EditProvider replaceWithMethodCallProvider(LocalNodeWrapper targetNode) {
- return new MethodCallReplaceProvider(targetNode, extractConfig.getHelper().getMethodCallNode());
- }
-
- private EditProvider replaceWithValueProvider(LocalNodeWrapper targetNode) {
-
- boolean addBrackets = JRubyRefactoringUtils.isMathematicalExpression(config.getDefinitionNode().getValueNode());
- return new TempValueReplaceProvider(targetNode, config, addBrackets);
- }
-
- private EditProvider extractMethodProvider() {
-
- int startPos = config.getDefinitionNode().getValueNode().getPosition().getStartOffset();
- int endPos = config.getDefinitionNode().getValueNode().getPosition().getEndOffset();
-
- extractConfig = new ExtractMethodConfig(config.getDocumentProvider(), new SelectionInformation(startPos, endPos, "")); //$NON-NLS-1$
- new ExtractMethodConditionChecker(extractConfig);
- MethodExtractor methodExtractor = new MethodExtractor(extractConfig);
- extractConfig.getHelper().setMethodName(config.getNewMethodName());
-
- return methodExtractor.getDefEdit();
- }
-
- private EditProvider createDeleteEdit() {
- return new DeleteEditProvider(config.getDefinitionNode().getWrappedNode());
- }
-
- public int getOccurrencesCount() {
- return config.getLocalOccurrences() == null ? 0 : config.getLocalOccurrences().size();
- }
-
- public String getSelectedItemName() {
- return config.getSelectedItemName();
- }
-
- public InlineLocalConfig getConfig() {
- return config;
- }
-}
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempValueReplaceProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempValueReplaceProvider.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinelocal/TempValueReplaceProvider.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -1,118 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- * Copyright (C) 2006 Mirko Stocker <me...@mi...>
- * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.core.inlinelocal;
-
-
-import org.jruby.ast.CallNode;
-import org.jruby.ast.Node;
-import org.jruby.ast.visitor.rewriter.DefaultFormatHelper;
-import org.jruby.ast.visitor.rewriter.FormatHelper;
-import org.jruby.lexer.yacc.ISourcePosition;
-import org.rubypeople.rdt.refactoring.core.NodeProvider;
-import org.rubypeople.rdt.refactoring.editprovider.ReplaceEditProvider;
-import org.rubypeople.rdt.refactoring.nodewrapper.LocalNodeWrapper;
-import org.rubypeople.rdt.refactoring.nodewrapper.MethodCallNodeWrapper;
-import org.rubypeople.rdt.refactoring.util.JRubyRefactoringUtils;
-import org.rubypeople.rdt.refactoring.util.NodeUtil;
-
-public class TempValueReplaceProvider extends ReplaceEditProvider {
-
- private LocalNodeWrapper targetNode;
-
- private LocalNodeWrapper inlinedNode;
-
- private boolean addBrackets;
-
- private InlineLocalConfig config;
-
- public TempValueReplaceProvider(LocalNodeWrapper targetNode, InlineLocalConfig config, boolean addBrackets) {
- super(false);
- this.config = config;
- this.inlinedNode = config.getDefinitionNode();
- this.targetNode = targetNode;
- this.addBrackets = addBrackets;
- }
-
- @Override
- protected int getOffsetLength() {
- ISourcePosition replacePos = targetNode.getWrappedNode().getPosition();
- return replacePos.getEndOffset() - replacePos.getStartOffset();
- }
-
- @Override
- protected Node getEditNode(int offset, String document) {
- return inlinedNode.getValueNode();
- }
-
- @Override
- protected int getOffset(String document) {
- return targetNode.getWrappedNode().getPosition().getStartOffset();
- }
-
- protected String getFormatedNode(String document) {
- if(addBrackets) {
- return '(' + super.getFormatedNode(document) + ')';
- }
- return super.getFormatedNode(document);
- }
-
- @Override
- protected FormatHelper getFormatHelper() {
- if(callNeedsBrackets()) {
- return new DefaultFormatHelper() {
-
- @Override
- public String afterCallArguments() {
- return ")";
- }
-
- @Override
- public String beforeCallArguments() {
- return "(";
- }};
- } else {
- return super.getFormatHelper();
- }
- }
-
- private boolean callNeedsBrackets() {
- Node targetEnclosingNode = NodeProvider.findParentNode(config.getDocumentProvider().getActiveFileRootNode(), targetNode.getWrappedNode());
- boolean isTargetEnclosingNodeCallNode = NodeUtil.nodeAssignableFrom(targetEnclosingNode, MethodCallNodeWrapper.METHOD_CALL_NODE_CLASSES());
- if(NodeUtil.nodeAssignableFrom(targetEnclosingNode, CallNode.class)) {
- isTargetEnclosingNodeCallNode &= !JRubyRefactoringUtils.isMathematicalExpression(targetEnclosingNode);
- }
- boolean isInlinedNodeCallNode = NodeUtil.nodeAssignableFrom(inlinedNode.getValueNode(), MethodCallNodeWrapper.METHOD_CALL_NODE_CLASSES());
- if(NodeUtil.nodeAssignableFrom(inlinedNode.getValueNode(), CallNode.class)) {
- isInlinedNodeCallNode &= !JRubyRefactoringUtils.isMathematicalExpression(inlinedNode.getValueNode());
- }
- return isTargetEnclosingNodeCallNode && isInlinedNodeCallNode;
- }
-}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/splitlocal/SplitTempRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/splitlocal/SplitTempRefactoring.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/splitlocal/SplitTempRefactoring.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -30,7 +30,7 @@
import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
-import org.rubypeople.rdt.refactoring.ui.pages.SplitTempPage;
+import org.rubypeople.rdt.refactoring.ui.pages.SplitLocalPage;
public class SplitTempRefactoring extends RubyRefactoring {
@@ -46,7 +46,7 @@
if(checker.shouldPerform()) {
SplitTempEditProvider splitTempEditProvider = new SplitTempEditProvider(config);
setEditProvider(splitTempEditProvider);
- pages.add(new SplitTempPage(splitTempEditProvider.getLocalUsages(), config.getDocumentProvider().getActiveFileContent(), splitTempEditProvider));
+ pages.add(new SplitLocalPage(splitTempEditProvider.getLocalUsages(), config.getDocumentProvider().getActiveFileContent(), splitTempEditProvider));
}
}
}
\ No newline at end of file
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertLocalToFieldPage.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertTempToFieldPage.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertLocalToFieldPage.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertLocalToFieldPage.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,143 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.ui.pages;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.rubypeople.rdt.refactoring.core.convertlocaltofield.LocalToFieldConverter;
+import org.rubypeople.rdt.refactoring.ui.LabeledTextField;
+import org.rubypeople.rdt.refactoring.util.NameValidator;
+
+public class ConvertLocalToFieldPage extends RefactoringWizardPage {
+
+ private static final String TITLE = Messages.ConvertTempToFieldPage_ConvertLocalVariableToField;
+
+ private LocalToFieldConverter converter;
+
+ private ConverterPageParameters pageParameters;
+
+ public ConvertLocalToFieldPage(LocalToFieldConverter converter, ConverterPageParameters parameters) {
+ super(TITLE);
+ this.converter = converter;
+ this.pageParameters = parameters;
+ }
+
+ public void createControl(Composite parent) {
+
+ Composite control = new Composite(parent, SWT.None);
+ setControl(control);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 8;
+ control.setLayout(layout);
+
+ final LabeledTextField labeledText = new LabeledTextField(control, Messages.ConvertTempToFieldPage_FieldName, converter.getLocalVarName());
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
+ labeledText.setLayoutData(layoutData);
+ labeledText.getText().addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ String newName = labeledText.getText().getText();
+ converter.setNewName(newName);
+ checkInput(newName);
+ }
+
+ private void checkInput(String newName) {
+ if (NameValidator.isValidLocalVariableName(newName)) {
+ ConvertLocalToFieldPage.this.setMessage(null);
+ ConvertLocalToFieldPage.this.setPageComplete(true);
+ } else {
+ ConvertLocalToFieldPage.this.setMessage("'" + newName + Messages.ConvertTempToFieldPage_IsNotValid, ConvertLocalToFieldPage.ERROR); //$NON-NLS-1$
+ ConvertLocalToFieldPage.this.setPageComplete(false);
+ }
+
+ }
+ });
+
+ initInitializeRadioGroup(control);
+
+ final Button declareClassField = new Button(control, SWT.CHECK);
+ GridData checkData = new GridData();
+ declareClassField.setLayoutData(checkData);
+ declareClassField.setText(Messages.ConvertTempToFieldPage_DeclareAsClassField);
+ declareClassField.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ converter.setIsClassField(declareClassField.getSelection());
+ }
+ });
+ }
+
+ private void initInitializeRadioGroup(Composite control) {
+ Group initializeInGroup = new Group(control, SWT.NONE);
+ RowLayout radioGroupLayout = new RowLayout(SWT.VERTICAL);
+ initializeInGroup.setLayout(radioGroupLayout);
+ initializeInGroup.setText(Messages.ConvertTempToFieldPage_InitializeIn);
+
+ Button inCurrentMethod = new Button(initializeInGroup, SWT.RADIO);
+ inCurrentMethod.setText(Messages.ConvertTempToFieldPage_CurrentMethod);
+ inCurrentMethod.setEnabled(pageParameters.isInCurrentMethodRadioEnabled());
+ addRadioListener(inCurrentMethod, LocalToFieldConverter.INIT_IN_METHOD);
+ inCurrentMethod.setSelection(true);
+
+ Button inClassConstructor = new Button(initializeInGroup, SWT.RADIO);
+ inClassConstructor.setText(Messages.ConvertTempToFieldPage_ClassConstructor);
+ inClassConstructor.setEnabled(pageParameters.isInClassConstructorRadioEnabled());
+ addRadioListener(inClassConstructor, LocalToFieldConverter.INIT_IN_CONSTRUCTOR);
+
+ GridData groupData = new GridData(GridData.FILL_HORIZONTAL);
+ initializeInGroup.setLayoutData(groupData);
+ }
+
+ private void addRadioListener(Button button, final int initPlace) {
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ converter.setInitPlace(initPlace);
+ }
+ });
+ }
+}
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertTempToFieldPage.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertTempToFieldPage.java 2007-03-16 12:18:37 UTC (rev 2183)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ConvertTempToFieldPage.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -1,143 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- * Copyright (C) 2006 Mirko Stocker <me...@mi...>
- * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.ui.pages;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.rubypeople.rdt.refactoring.core.convertlocaltofield.LocalToFieldConverter;
-import org.rubypeople.rdt.refactoring.ui.LabeledTextField;
-import org.rubypeople.rdt.refactoring.util.NameValidator;
-
-public class ConvertTempToFieldPage extends RefactoringWizardPage {
-
- private static final String TITLE = Messages.ConvertTempToFieldPage_ConvertLocalVariableToField;
-
- private LocalToFieldConverter converter;
-
- private ConverterPageParameters pageParameters;
-
- public ConvertTempToFieldPage(LocalToFieldConverter converter, ConverterPageParameters parameters) {
- super(TITLE);
- this.converter = converter;
- this.pageParameters = parameters;
- }
-
- public void createControl(Composite parent) {
-
- Composite control = new Composite(parent, SWT.None);
- setControl(control);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.verticalSpacing = 8;
- control.setLayout(layout);
-
- final LabeledTextField labeledText = new LabeledTextField(control, Messages.ConvertTempToFieldPage_FieldName, converter.getLocalVarName());
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
- labeledText.setLayoutData(layoutData);
- labeledText.getText().addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- String newName = labeledText.getText().getText();
- converter.setNewName(newName);
- checkInput(newName);
- }
-
- private void checkInput(String newName) {
- if (NameValidator.isValidLocalVariableName(newName)) {
- ConvertTempToFieldPage.this.setMessage(null);
- ConvertTempToFieldPage.this.setPageComplete(true);
- } else {
- ConvertTempToFieldPage.this.setMessage("'" + newName + Messages.ConvertTempToFieldPage_IsNotValid, ConvertTempToFieldPage.ERROR); //$NON-NLS-1$
- ConvertTempToFieldPage.this.setPageComplete(false);
- }
-
- }
- });
-
- initInitializeRadioGroup(control);
-
- final Button declareClassField = new Button(control, SWT.CHECK);
- GridData checkData = new GridData();
- declareClassField.setLayoutData(checkData);
- declareClassField.setText(Messages.ConvertTempToFieldPage_DeclareAsClassField);
- declareClassField.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- converter.setIsClassField(declareClassField.getSelection());
- }
- });
- }
-
- private void initInitializeRadioGroup(Composite control) {
- Group initializeInGroup = new Group(control, SWT.NONE);
- RowLayout radioGroupLayout = new RowLayout(SWT.VERTICAL);
- initializeInGroup.setLayout(radioGroupLayout);
- initializeInGroup.setText(Messages.ConvertTempToFieldPage_InitializeIn);
-
- Button inCurrentMethod = new Button(initializeInGroup, SWT.RADIO);
- inCurrentMethod.setText(Messages.ConvertTempToFieldPage_CurrentMethod);
- inCurrentMethod.setEnabled(pageParameters.isInCurrentMethodRadioEnabled());
- addRadioListener(inCurrentMethod, LocalToFieldConverter.INIT_IN_METHOD);
- inCurrentMethod.setSelection(true);
-
- Button inClassConstructor = new Button(initializeInGroup, SWT.RADIO);
- inClassConstructor.setText(Messages.ConvertTempToFieldPage_ClassConstructor);
- inClassConstructor.setEnabled(pageParameters.isInClassConstructorRadioEnabled());
- addRadioListener(inClassConstructor, LocalToFieldConverter.INIT_IN_CONSTRUCTOR);
-
- GridData groupData = new GridData(GridData.FILL_HORIZONTAL);
- initializeInGroup.setLayoutData(groupData);
- }
-
- private void addRadioListener(Button button, final int initPlace) {
- button.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- converter.setInitPlace(initPlace);
- }
- });
- }
-}
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineLocalPage.java (from rev 2183, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineTempPage.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineLocalPage.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/InlineLocalPage.java 2007-03-16 12:23:45 UTC (rev 2184)
@@ -0,0 +1,158 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Lukas Felber <lf...@hs...>
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2006 Thomas Corbat <tc...@hs...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.ui.pages;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalConfig;
+import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalRefactoring;
+import org.rubypeople.rdt.refac...
[truncated message content] |