refactorings on SHIFT-codeMenu
authorClaus Gittinger <cg@exept.de>
Wed, 09 Jun 2004 11:50:57 +0200
changeset 5899 248a934c7599
parent 5898 f6214812e1d2
child 5900 0ee7462ed8e5
refactorings on SHIFT-codeMenu
NewSystemBrowser.st
Tools__NewSystemBrowser.st
--- a/NewSystemBrowser.st	Tue Jun 08 20:10:03 2004 +0200
+++ b/NewSystemBrowser.st	Wed Jun 09 11:50:57 2004 +0200
@@ -5621,155 +5621,155 @@
      the MenuEditor may not be able to read the specification."
 
     "
-     MenuEditor new openOnClass:NewSystemBrowser andSelector:#codeMenu
-     (Menu new fromLiteralArrayEncoding:(NewSystemBrowser codeMenu)) startUp
+     MenuEditor new openOnClass:Tools::NewSystemBrowser andSelector:#codeMenu
+     (Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowser codeMenu)) startUp
     "
 
     <resource: #menu>
 
     ^ 
-     #(#Menu
-        #(
-         #(#MenuItem
-            #label: 'Variables'
-            #translateLabel: true
-            #enabled: #canUseRefactoringSupport
-            #submenu: 
-           #(#Menu
-              #(
-               #(#MenuItem
-                  #label: 'Move to Inner Scope...'
-                  #translateLabel: true
-                  #value: #codeMenuMoveVariableToInnerScope
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: '-'
-                )
-               #(#MenuItem
-                  #label: 'Rename Local Variable...'
-                  #translateLabel: true
-                  #value: #codeMenuRenameTemporary
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: '-'
-                )
-               #(#MenuItem
-                  #label: 'Make Instance Variable'
-                  #translateLabel: true
-                  #value: #codeMenuMakeInstanceVariable
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #isVisible: #hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: 'Make Instance Variables'
-                  #translateLabel: true
-                  #value: #codeMenuMakeInstanceVariable
-                  #enabled: #hasMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #isVisible: #hasMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               )
-              nil
-              nil
-            )
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Inline Message'
-            #translateLabel: true
-            #value: #codeMenuInlineMessage
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Selection to Temporary...'
-            #translateLabel: true
-            #value: #codeMenuExtractSelectionToTemporary
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Method...'
-            #translateLabel: true
-            #value: #codeMenuExtractMethod
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Method to Component...'
-            #translateLabel: true
-            #value: #codeMenuExtractMethodToComponent
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Add Parameter to Method...'
-            #translateLabel: true
-            #value: #codeMenuAddParameter
-            #enabled: #hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Remove Parameter from Method'
-            #translateLabel: true
-            #value: #codeMenuRemoveParameter
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndSingleSelectedMethodHasParameterAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Format'
-            #translateLabel: true
-            #value: #codeMenuFormat
-            #enabled: #hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Syntax Coloring'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #doSyntaxColoring
-          )
-         #(#MenuItem
-            #label: 'Immediate Syntax Coloring'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #enabled: #doSyntaxColoring
-            #indication: #doImmediateSyntaxColoring
-          )
-         #(#MenuItem
-            #label: 'Auto-Format Code'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #doAutoFormat
-          )
-         #(#MenuItem
-            #label: 'Show MethodTemplate for New Methods'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #showMethodTemplate
-          )
-         #(#MenuItem
-            #label: 'Load Refactoring and Undo Features'
-            #translateLabel: true
-            #showBusyCursorWhilePerforming: true
-            #value: #doLoadRefactoringSupport
-            #isVisible: #canLoadRefactoringSupport
+     #(Menu
+        (
+         (MenuItem
+            enabled: canUseRefactoringSupport
+            label: 'Variables'
+            translateLabel: true
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Rename Local Variable...'
+                  itemValue: codeMenuRenameTemporary
+                  translateLabel: true
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Move to Inner Scope...'
+                  itemValue: codeMenuMoveVariableToInnerScope
+                  translateLabel: true
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Make Instance Variable'
+                  itemValue: codeMenuMakeInstanceVariable
+                  translateLabel: true
+                  isVisible: hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  enabled: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  label: 'Make Instance Variables'
+                  itemValue: codeMenuMakeInstanceVariable
+                  translateLabel: true
+                  isVisible: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  showBusyCursorWhilePerforming: true
+                )
+               )
+              nil
+              nil
+            )
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Inline Message'
+            itemValue: codeMenuInlineMessage
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Selection to Temporary...'
+            itemValue: codeMenuExtractSelectionToTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method...'
+            itemValue: codeMenuExtractMethod
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method to Component...'
+            itemValue: codeMenuExtractMethodToComponent
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Add Parameter to Method...'
+            itemValue: codeMenuAddParameter
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndSingleSelectedMethodHasParameterAndCanUseRefactoringSupportHolder
+            label: 'Remove Parameter from Method'
+            itemValue: codeMenuRemoveParameter
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Format'
+            itemValue: codeMenuFormat
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            label: 'Syntax Coloring'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doSyntaxColoring
+          )
+         (MenuItem
+            enabled: doSyntaxColoring
+            label: 'Immediate Syntax Coloring'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doImmediateSyntaxColoring
+          )
+         (MenuItem
+            label: 'Auto-Format Code'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doAutoFormat
+          )
+         (MenuItem
+            label: 'Show MethodTemplate for New Methods'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: showMethodTemplate
+          )
+         (MenuItem
+            label: 'Load Refactoring and Undo Features'
+            itemValue: doLoadRefactoringSupport
+            translateLabel: true
+            isVisible: canLoadRefactoringSupport
+            showBusyCursorWhilePerforming: true
           )
          )
         nil
@@ -7400,6 +7400,86 @@
       )
 !
 
+refactoringMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:Tools::NewSystemBrowser andSelector:#refactoringMenu
+     (Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowser refactoringMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            enabled: hasTemporaryVariableSelectedInCodeViewHolder
+            label: 'Rename Local Variable...'
+            itemValue: codeMenuRenameTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasTemporaryVariableSelectedInCodeViewHolder
+            label: 'Make Instance Variable'
+            itemValue: codeMenuMakeInstanceVariable
+            translateLabel: true
+            isVisible: hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+            label: 'Make Instance Variables'
+            itemValue: codeMenuMakeInstanceVariable
+            translateLabel: true
+            isVisible: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Inline Message'
+            itemValue: codeMenuInlineMessage
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Selection to Temporary...'
+            itemValue: codeMenuExtractSelectionToTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method...'
+            itemValue: codeMenuExtractMethod
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Format'
+            itemValue: codeMenuFormat
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         )
+        nil
+        nil
+      )
+!
+
 searchMenu
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
@@ -9153,6 +9233,14 @@
     "Created: / 18.2.2000 / 11:58:25 / cg"
 !
 
+shiftedCodeViewPopUpMenu
+    "return the Shift-popUpMenu for the code-view"
+
+    <resource: #programMenu>
+
+    ^ self refactoringMenu
+!
+
 variablesPopUpMenu
     "return the popUpMenu for the variable-list view"
 
@@ -9494,14 +9582,14 @@
 enterBoxTitle:title okText:okText label:label
     "convenient method: setup an enterBox"
 
-    |box resources|
-
-    resources := self classResources.
+    |box rresources|
+
+    rresources := self classResources.
     box := EnterBox new.
-    box label:(resources string:label).
+    box label:(rresources string:label).
     box 
-        title:(resources string:title) 
-        okText:(resources string:okText).
+        title:(rresources string:title) 
+        okText:(rresources string:okText).
     ^ box
 
     "Created: / 6.2.2000 / 01:07:11 / cg"
@@ -20270,7 +20358,7 @@
     immediateUpdate value:false.
 
     "/ must reselect manually here
-    newClass := Smalltalk at:(mClass name).
+    newClass := Smalltalk classNamed:(mClass name).
     newMethod := newClass compiledMethodAt:mSelector.
     newClass ~~ self theSingleSelectedClass ifTrue:[
         self halt.
@@ -20973,8 +21061,8 @@
                         selector:mthd selector.
     refactoring source:(self codeView contentsAsString).
 
+"/    refactoring model name:('rename local variable %1 to %2' bindWith:oldName with:newName).
     self performRefactoring:refactoring.
-    "/ self switchToSelector:mthd selector.
     self switchToMethod:mthd.
 !
 
@@ -26348,35 +26436,11 @@
 selectorMenuPushDownMethod
     "push method(s) into subclass(s)"
 
-    |selectedMethods refactoring|
-
-    (self askIfModified:'Code was modified.\\Push method(s) anyway ?')
-    ifFalse:[^ self].
-
-    selectedMethods := self selectedMethods value.
-
-    (selectedMethods collect:[:m | m mclass]) asIdentitySet do:[:eachClass |
-        |methods selectors nm|
-
-        methods := selectedMethods select:[:m | m mclass == eachClass].
-        selectedMethods := selectedMethods select:[:m | m mclass ~~ eachClass].
-        selectors := methods collect:[:each | each  selector].
-        refactoring := PushDownMethodRefactoring pushDown:selectors from:eachClass.
-
-        nm := 'Push down '. 
-        selectors size == 1 ifTrue:[
-            nm := nm , selectors first.
-        ] ifFalse:[
-            nm := nm , selectors size printString , ' methods'.
-        ].
-        nm := nm , ' from ' , eachClass name.
-        refactoring model name:nm.
-        self performRefactoring:refactoring.    
-    ].
-!
-
-selectorMenuPushUpMethod
-    "push method(s) into superclass"
+    self selectorMenuPushMethod:#down
+!
+
+selectorMenuPushMethod:upOrDown
+    "push method(s) into subclass(s) or up into superclas"
 
     |selectedMethods refactoring|
 
@@ -26391,9 +26455,13 @@
         methods := selectedMethods select:[:m | m mclass == eachClass].
         selectedMethods := selectedMethods select:[:m | m mclass ~~ eachClass].
         selectors := methods collect:[:each | each  selector].
-        refactoring := PushUpMethodRefactoring pushUp:selectors from:eachClass.
-
-        nm := 'Push up '. 
+        upOrDown == #down ifTrue:[
+            refactoring := PushDownMethodRefactoring pushDown:selectors from:eachClass.
+            nm := 'Push down '. 
+        ] ifFalse:[
+            refactoring := PushUpMethodRefactoring pushUp:selectors from:eachClass.
+            nm := 'Push up '. 
+        ].
         selectors size == 1 ifTrue:[
             nm := nm , selectors first.
         ] ifFalse:[
@@ -26405,6 +26473,12 @@
     ].
 !
 
+selectorMenuPushUpMethod
+    "push method(s) into superclass"
+
+    self selectorMenuPushMethod:#up
+!
+
 selectorMenuRemove
     "confirm removal of the selected methods (but does not search for senders),
      then remove them."
@@ -28685,6 +28759,23 @@
       ].
 !
 
+codeViewMenu
+    |shiftedMenu codeView menu|
+
+    shiftedMenu := self class shiftedCodeViewPopUpMenu decodeAsLiteralArray.
+    shiftedMenu receiver:self.
+    shiftedMenu findGuiResourcesIn:self.
+
+    codeView := self codeView.
+    codeView sensor shiftDown ifFalse:[
+        menu := codeView editMenu.
+        "/ would like to add the shifted-menu here
+        "/ (after the CTRL-menu)
+        ^ menu
+    ].
+    ^ shiftedMenu
+!
+
 findHistoryMenu
     <resource: #programMenu >
 
@@ -30948,7 +31039,7 @@
 askForMethodCategory:title okLabel:okLabel list:someCategories recentList:recentListOrNil initialAnswer:initialText
     "convenient helper method: setup a box asking for a method category"
 
-    |box retVal|
+    |box retVal shownCategories allMethodCategories|
 
     box := self 
             listBoxTitle:title 
@@ -30958,7 +31049,7 @@
     recentListOrNil notNil ifTrue:[
         box useComboBoxWithList:recentListOrNil.
     ].
-
+    shownCategories := someCategories.
     box initialText:initialText.
     box action:[:aString | aString notEmpty ifTrue:[retVal := aString] ].
     box entryCompletionBlock:[:contents |
@@ -30968,7 +31059,15 @@
         what := self navigationState environment methodProtocolCompletion:s.
         best := what first.
         box contents:best.
-        idx := someCategories findFirst:[:l | l startsWith:best].
+        idx := shownCategories findFirst:[:l | l startsWith:best].
+        idx == 0 ifTrue:[
+            allMethodCategories isNil ifTrue:[ 
+                allMethodCategories := Smalltalk allMethodCategories asArray sort.
+            ].
+            box list:allMethodCategories.
+            shownCategories := allMethodCategories.
+            idx := shownCategories findFirst:[:l | l startsWith:best].
+        ].
         idx ~~ 0 ifTrue:[
             box listView scrollToLine:idx.
         ].
@@ -33785,6 +33884,7 @@
     ].
     codeView layout bottomOffset:bottomOffset.   
     codeView formatAction:[:code | self formatCode ].
+    codeView menuHolder:self; menuMessage:#codeViewMenu.
 !
 
 postBuildFixup
@@ -34435,7 +34535,7 @@
     "filter keyboard events for Find key (unless typed into the codeView)"
 
     |codeView classListView categoryListView methodListView methodCategoryListView
-     variableListView evView key rawKey inCodeView app variablesToRemove msg|
+     variableListView evView key rawKey inCodeView app variablesToRemove msg sensor|
 
     codeView := self codeView.
     evView := anEvent targetView.
@@ -34554,22 +34654,24 @@
         ].
 
         anEvent isButtonReleaseEvent ifTrue:[
-            evView == codeView ifTrue:[
-                self codeInfoVisible value ifTrue:[
-                    anEvent delegatedFrom notNil ifTrue:[
-                        ^ false
-                    ].
-                    anEvent delegatedFrom:self.
-                    evView windowGroup sensor 
-                        pushEvent:anEvent. "/ must be first in queue
-                                            "/ (for the buttonRelease to be processed)    
-                    self
-                        enqueueMessage:#delayedExplainSelection
-                        for:self
-                        arguments:#() .
-
-                    ^ true "/ release event has been added already
-                ].
+            anEvent delegatedFrom isNil ifTrue:[
+                evView == codeView ifTrue:[
+                    sensor := evView sensor.
+                    self codeInfoVisible value ifTrue:[
+                        anEvent delegatedFrom notNil ifTrue:[
+                            ^ false
+                        ].
+                        anEvent delegatedFrom:self.
+                        sensor pushEvent:anEvent.  "/ must be first in queue
+                                                   "/ (for the buttonRelease to be processed)    
+                        self
+                            enqueueMessage:#delayedExplainSelection
+                            for:self
+                            arguments:#() .
+
+                        ^ false "/ release event has been added already
+                    ].
+                ]
             ]
         ].
     ].
@@ -35652,7 +35754,7 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.750 2004-06-08 06:50:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.751 2004-06-09 09:50:57 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!
--- a/Tools__NewSystemBrowser.st	Tue Jun 08 20:10:03 2004 +0200
+++ b/Tools__NewSystemBrowser.st	Wed Jun 09 11:50:57 2004 +0200
@@ -5621,155 +5621,155 @@
      the MenuEditor may not be able to read the specification."
 
     "
-     MenuEditor new openOnClass:NewSystemBrowser andSelector:#codeMenu
-     (Menu new fromLiteralArrayEncoding:(NewSystemBrowser codeMenu)) startUp
+     MenuEditor new openOnClass:Tools::NewSystemBrowser andSelector:#codeMenu
+     (Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowser codeMenu)) startUp
     "
 
     <resource: #menu>
 
     ^ 
-     #(#Menu
-        #(
-         #(#MenuItem
-            #label: 'Variables'
-            #translateLabel: true
-            #enabled: #canUseRefactoringSupport
-            #submenu: 
-           #(#Menu
-              #(
-               #(#MenuItem
-                  #label: 'Move to Inner Scope...'
-                  #translateLabel: true
-                  #value: #codeMenuMoveVariableToInnerScope
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: '-'
-                )
-               #(#MenuItem
-                  #label: 'Rename Local Variable...'
-                  #translateLabel: true
-                  #value: #codeMenuRenameTemporary
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: '-'
-                )
-               #(#MenuItem
-                  #label: 'Make Instance Variable'
-                  #translateLabel: true
-                  #value: #codeMenuMakeInstanceVariable
-                  #enabled: #hasTemporaryVariableSelectedInCodeViewHolder
-                  #isVisible: #hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               #(#MenuItem
-                  #label: 'Make Instance Variables'
-                  #translateLabel: true
-                  #value: #codeMenuMakeInstanceVariable
-                  #enabled: #hasMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #isVisible: #hasMultipleTemporaryVariablesSelectedInCodeViewHolder
-                  #showBusyCursorWhilePerforming: true
-                )
-               )
-              nil
-              nil
-            )
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Inline Message'
-            #translateLabel: true
-            #value: #codeMenuInlineMessage
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Selection to Temporary...'
-            #translateLabel: true
-            #value: #codeMenuExtractSelectionToTemporary
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Method...'
-            #translateLabel: true
-            #value: #codeMenuExtractMethod
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Extract Method to Component...'
-            #translateLabel: true
-            #value: #codeMenuExtractMethodToComponent
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Add Parameter to Method...'
-            #translateLabel: true
-            #value: #codeMenuAddParameter
-            #enabled: #hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: 'Remove Parameter from Method'
-            #translateLabel: true
-            #value: #codeMenuRemoveParameter
-            #enabled: #hasSingleMethodSelectedAndSelectionInCodeViewAndSingleSelectedMethodHasParameterAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Format'
-            #translateLabel: true
-            #value: #codeMenuFormat
-            #enabled: #hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
-            #showBusyCursorWhilePerforming: true
-          )
-         #(#MenuItem
-            #label: '-'
-          )
-         #(#MenuItem
-            #label: 'Syntax Coloring'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #doSyntaxColoring
-          )
-         #(#MenuItem
-            #label: 'Immediate Syntax Coloring'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #enabled: #doSyntaxColoring
-            #indication: #doImmediateSyntaxColoring
-          )
-         #(#MenuItem
-            #label: 'Auto-Format Code'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #doAutoFormat
-          )
-         #(#MenuItem
-            #label: 'Show MethodTemplate for New Methods'
-            #translateLabel: true
-            #hideMenuOnActivated: false
-            #indication: #showMethodTemplate
-          )
-         #(#MenuItem
-            #label: 'Load Refactoring and Undo Features'
-            #translateLabel: true
-            #showBusyCursorWhilePerforming: true
-            #value: #doLoadRefactoringSupport
-            #isVisible: #canLoadRefactoringSupport
+     #(Menu
+        (
+         (MenuItem
+            enabled: canUseRefactoringSupport
+            label: 'Variables'
+            translateLabel: true
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Rename Local Variable...'
+                  itemValue: codeMenuRenameTemporary
+                  translateLabel: true
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Move to Inner Scope...'
+                  itemValue: codeMenuMoveVariableToInnerScope
+                  translateLabel: true
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  enabled: hasTemporaryVariableSelectedInCodeViewHolder
+                  label: 'Make Instance Variable'
+                  itemValue: codeMenuMakeInstanceVariable
+                  translateLabel: true
+                  isVisible: hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  showBusyCursorWhilePerforming: true
+                )
+               (MenuItem
+                  enabled: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  label: 'Make Instance Variables'
+                  itemValue: codeMenuMakeInstanceVariable
+                  translateLabel: true
+                  isVisible: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+                  showBusyCursorWhilePerforming: true
+                )
+               )
+              nil
+              nil
+            )
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Inline Message'
+            itemValue: codeMenuInlineMessage
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Selection to Temporary...'
+            itemValue: codeMenuExtractSelectionToTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method...'
+            itemValue: codeMenuExtractMethod
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method to Component...'
+            itemValue: codeMenuExtractMethodToComponent
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Add Parameter to Method...'
+            itemValue: codeMenuAddParameter
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndSingleSelectedMethodHasParameterAndCanUseRefactoringSupportHolder
+            label: 'Remove Parameter from Method'
+            itemValue: codeMenuRemoveParameter
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Format'
+            itemValue: codeMenuFormat
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            label: 'Syntax Coloring'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doSyntaxColoring
+          )
+         (MenuItem
+            enabled: doSyntaxColoring
+            label: 'Immediate Syntax Coloring'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doImmediateSyntaxColoring
+          )
+         (MenuItem
+            label: 'Auto-Format Code'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: doAutoFormat
+          )
+         (MenuItem
+            label: 'Show MethodTemplate for New Methods'
+            translateLabel: true
+            hideMenuOnActivated: false
+            indication: showMethodTemplate
+          )
+         (MenuItem
+            label: 'Load Refactoring and Undo Features'
+            itemValue: doLoadRefactoringSupport
+            translateLabel: true
+            isVisible: canLoadRefactoringSupport
+            showBusyCursorWhilePerforming: true
           )
          )
         nil
@@ -7400,6 +7400,86 @@
       )
 !
 
+refactoringMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:Tools::NewSystemBrowser andSelector:#refactoringMenu
+     (Menu new fromLiteralArrayEncoding:(Tools::NewSystemBrowser refactoringMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            enabled: hasTemporaryVariableSelectedInCodeViewHolder
+            label: 'Rename Local Variable...'
+            itemValue: codeMenuRenameTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasTemporaryVariableSelectedInCodeViewHolder
+            label: 'Make Instance Variable'
+            itemValue: codeMenuMakeInstanceVariable
+            translateLabel: true
+            isVisible: hasNotMultipleTemporaryVariablesSelectedInCodeViewHolder
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+            label: 'Make Instance Variables'
+            itemValue: codeMenuMakeInstanceVariable
+            translateLabel: true
+            isVisible: hasMultipleTemporaryVariablesSelectedInCodeViewHolder
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Inline Message'
+            itemValue: codeMenuInlineMessage
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Selection to Temporary...'
+            itemValue: codeMenuExtractSelectionToTemporary
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndSelectionInCodeViewAndCanUseRefactoringSupportHolder
+            label: 'Extract Method...'
+            itemValue: codeMenuExtractMethod
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: hasSingleMethodSelectedAndCanUseRefactoringSupportHolder
+            label: 'Format'
+            itemValue: codeMenuFormat
+            translateLabel: true
+            showBusyCursorWhilePerforming: true
+          )
+         )
+        nil
+        nil
+      )
+!
+
 searchMenu
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
@@ -9153,6 +9233,14 @@
     "Created: / 18.2.2000 / 11:58:25 / cg"
 !
 
+shiftedCodeViewPopUpMenu
+    "return the Shift-popUpMenu for the code-view"
+
+    <resource: #programMenu>
+
+    ^ self refactoringMenu
+!
+
 variablesPopUpMenu
     "return the popUpMenu for the variable-list view"
 
@@ -9494,14 +9582,14 @@
 enterBoxTitle:title okText:okText label:label
     "convenient method: setup an enterBox"
 
-    |box resources|
-
-    resources := self classResources.
+    |box rresources|
+
+    rresources := self classResources.
     box := EnterBox new.
-    box label:(resources string:label).
+    box label:(rresources string:label).
     box 
-        title:(resources string:title) 
-        okText:(resources string:okText).
+        title:(rresources string:title) 
+        okText:(rresources string:okText).
     ^ box
 
     "Created: / 6.2.2000 / 01:07:11 / cg"
@@ -20270,7 +20358,7 @@
     immediateUpdate value:false.
 
     "/ must reselect manually here
-    newClass := Smalltalk at:(mClass name).
+    newClass := Smalltalk classNamed:(mClass name).
     newMethod := newClass compiledMethodAt:mSelector.
     newClass ~~ self theSingleSelectedClass ifTrue:[
         self halt.
@@ -20973,8 +21061,8 @@
                         selector:mthd selector.
     refactoring source:(self codeView contentsAsString).
 
+"/    refactoring model name:('rename local variable %1 to %2' bindWith:oldName with:newName).
     self performRefactoring:refactoring.
-    "/ self switchToSelector:mthd selector.
     self switchToMethod:mthd.
 !
 
@@ -26348,35 +26436,11 @@
 selectorMenuPushDownMethod
     "push method(s) into subclass(s)"
 
-    |selectedMethods refactoring|
-
-    (self askIfModified:'Code was modified.\\Push method(s) anyway ?')
-    ifFalse:[^ self].
-
-    selectedMethods := self selectedMethods value.
-
-    (selectedMethods collect:[:m | m mclass]) asIdentitySet do:[:eachClass |
-        |methods selectors nm|
-
-        methods := selectedMethods select:[:m | m mclass == eachClass].
-        selectedMethods := selectedMethods select:[:m | m mclass ~~ eachClass].
-        selectors := methods collect:[:each | each  selector].
-        refactoring := PushDownMethodRefactoring pushDown:selectors from:eachClass.
-
-        nm := 'Push down '. 
-        selectors size == 1 ifTrue:[
-            nm := nm , selectors first.
-        ] ifFalse:[
-            nm := nm , selectors size printString , ' methods'.
-        ].
-        nm := nm , ' from ' , eachClass name.
-        refactoring model name:nm.
-        self performRefactoring:refactoring.    
-    ].
-!
-
-selectorMenuPushUpMethod
-    "push method(s) into superclass"
+    self selectorMenuPushMethod:#down
+!
+
+selectorMenuPushMethod:upOrDown
+    "push method(s) into subclass(s) or up into superclas"
 
     |selectedMethods refactoring|
 
@@ -26391,9 +26455,13 @@
         methods := selectedMethods select:[:m | m mclass == eachClass].
         selectedMethods := selectedMethods select:[:m | m mclass ~~ eachClass].
         selectors := methods collect:[:each | each  selector].
-        refactoring := PushUpMethodRefactoring pushUp:selectors from:eachClass.
-
-        nm := 'Push up '. 
+        upOrDown == #down ifTrue:[
+            refactoring := PushDownMethodRefactoring pushDown:selectors from:eachClass.
+            nm := 'Push down '. 
+        ] ifFalse:[
+            refactoring := PushUpMethodRefactoring pushUp:selectors from:eachClass.
+            nm := 'Push up '. 
+        ].
         selectors size == 1 ifTrue:[
             nm := nm , selectors first.
         ] ifFalse:[
@@ -26405,6 +26473,12 @@
     ].
 !
 
+selectorMenuPushUpMethod
+    "push method(s) into superclass"
+
+    self selectorMenuPushMethod:#up
+!
+
 selectorMenuRemove
     "confirm removal of the selected methods (but does not search for senders),
      then remove them."
@@ -28685,6 +28759,23 @@
       ].
 !
 
+codeViewMenu
+    |shiftedMenu codeView menu|
+
+    shiftedMenu := self class shiftedCodeViewPopUpMenu decodeAsLiteralArray.
+    shiftedMenu receiver:self.
+    shiftedMenu findGuiResourcesIn:self.
+
+    codeView := self codeView.
+    codeView sensor shiftDown ifFalse:[
+        menu := codeView editMenu.
+        "/ would like to add the shifted-menu here
+        "/ (after the CTRL-menu)
+        ^ menu
+    ].
+    ^ shiftedMenu
+!
+
 findHistoryMenu
     <resource: #programMenu >
 
@@ -30948,7 +31039,7 @@
 askForMethodCategory:title okLabel:okLabel list:someCategories recentList:recentListOrNil initialAnswer:initialText
     "convenient helper method: setup a box asking for a method category"
 
-    |box retVal|
+    |box retVal shownCategories allMethodCategories|
 
     box := self 
             listBoxTitle:title 
@@ -30958,7 +31049,7 @@
     recentListOrNil notNil ifTrue:[
         box useComboBoxWithList:recentListOrNil.
     ].
-
+    shownCategories := someCategories.
     box initialText:initialText.
     box action:[:aString | aString notEmpty ifTrue:[retVal := aString] ].
     box entryCompletionBlock:[:contents |
@@ -30968,7 +31059,15 @@
         what := self navigationState environment methodProtocolCompletion:s.
         best := what first.
         box contents:best.
-        idx := someCategories findFirst:[:l | l startsWith:best].
+        idx := shownCategories findFirst:[:l | l startsWith:best].
+        idx == 0 ifTrue:[
+            allMethodCategories isNil ifTrue:[ 
+                allMethodCategories := Smalltalk allMethodCategories asArray sort.
+            ].
+            box list:allMethodCategories.
+            shownCategories := allMethodCategories.
+            idx := shownCategories findFirst:[:l | l startsWith:best].
+        ].
         idx ~~ 0 ifTrue:[
             box listView scrollToLine:idx.
         ].
@@ -33785,6 +33884,7 @@
     ].
     codeView layout bottomOffset:bottomOffset.   
     codeView formatAction:[:code | self formatCode ].
+    codeView menuHolder:self; menuMessage:#codeViewMenu.
 !
 
 postBuildFixup
@@ -34435,7 +34535,7 @@
     "filter keyboard events for Find key (unless typed into the codeView)"
 
     |codeView classListView categoryListView methodListView methodCategoryListView
-     variableListView evView key rawKey inCodeView app variablesToRemove msg|
+     variableListView evView key rawKey inCodeView app variablesToRemove msg sensor|
 
     codeView := self codeView.
     evView := anEvent targetView.
@@ -34554,22 +34654,24 @@
         ].
 
         anEvent isButtonReleaseEvent ifTrue:[
-            evView == codeView ifTrue:[
-                self codeInfoVisible value ifTrue:[
-                    anEvent delegatedFrom notNil ifTrue:[
-                        ^ false
-                    ].
-                    anEvent delegatedFrom:self.
-                    evView windowGroup sensor 
-                        pushEvent:anEvent. "/ must be first in queue
-                                            "/ (for the buttonRelease to be processed)    
-                    self
-                        enqueueMessage:#delayedExplainSelection
-                        for:self
-                        arguments:#() .
-
-                    ^ true "/ release event has been added already
-                ].
+            anEvent delegatedFrom isNil ifTrue:[
+                evView == codeView ifTrue:[
+                    sensor := evView sensor.
+                    self codeInfoVisible value ifTrue:[
+                        anEvent delegatedFrom notNil ifTrue:[
+                            ^ false
+                        ].
+                        anEvent delegatedFrom:self.
+                        sensor pushEvent:anEvent.  "/ must be first in queue
+                                                   "/ (for the buttonRelease to be processed)    
+                        self
+                            enqueueMessage:#delayedExplainSelection
+                            for:self
+                            arguments:#() .
+
+                        ^ false "/ release event has been added already
+                    ].
+                ]
             ]
         ].
     ].
@@ -35652,7 +35754,7 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.750 2004-06-08 06:50:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.751 2004-06-09 09:50:57 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!