Tools__NewSystemBrowser.st
changeset 16928 f0d5e9bc4c93
parent 16927 700a69ddec83
child 16929 fe71fe5bf044
--- a/Tools__NewSystemBrowser.st	Tue Oct 11 17:20:54 2016 +0200
+++ b/Tools__NewSystemBrowser.st	Tue Oct 11 20:10:20 2016 +0200
@@ -38811,10 +38811,17 @@
         ^ self
     ].
     (cls := aClass whichClassDefinesInstVar:newName) notNil ifTrue:[
-        Dialog warn:(resources string:'Sorry: a variable named ''%1'' is already defined in ''%2''.\\Proceed ?'
+        Dialog warn:(resources stringWithCRs:'A variable named ''%1'' is already defined in ''%2''.'
                                 with:newName allBold
                                 with:cls name allBold).
         ^ self
+"/ disabled, because refactoring will fail (need a new one: rewrite uses of var1 to use var2        
+"/        (Dialog confirm:(resources stringWithCRs:'A variable named ''%1'' is already defined in ''%2''.\\Change the code to use that one as well?'
+"/                                with:newName allBold
+"/                                with:cls name allBold)) ifFalse:[
+"/            ^ self
+"/        ].
+"/        self halt.
     ].
 
     (Dialog
@@ -38847,7 +38854,13 @@
 
     oldName := node name.
     definingNode := node whoDefines: oldName.
-    definingNode isNil ifTrue: [self warn: oldName , ' is not a temporary variable in the method'. ^ self].
+    definingNode isNil ifTrue: [
+        self hasInstanceVariableSelectedInCodeView ifTrue:[
+            self codeMenuRenameInstanceVariable.
+            ^ self.
+        ].    
+        self warn: oldName , ' is not a temporary variable in the method'. ^ self
+    ].
 
     LastVariableRenames isNil ifTrue:[
         LastVariableRenames := CacheDictionary new:30.