UIPainter.st
changeset 1683 f95658463570
parent 1671 493e0430518e
child 1684 34b35b8ae80f
--- a/UIPainter.st	Fri Feb 21 13:20:17 2003 +0100
+++ b/UIPainter.st	Fri Feb 21 16:26:07 2003 +0100
@@ -1096,9 +1096,17 @@
                           #enabled: #hasSpecClass
                       )
                        #(#MenuItem
+                          #label: 'Aspect Method For...'
+                          #translateLabel: true
+                          #value: #doGenerateAspectMethodFor
+                          #activeHelpKey: #generateAspectMethodFor
+                          #enabled: #hasSpecClass
+                      )
+                       #(#MenuItem
                           #label: 'Menu Stub Methods'
                           #translateLabel: true
                           #value: #doGenerateMenuMethods
+                          #enabled: #hasSpecClass
                       )
                        #(#MenuItem
                           #label: '-'
@@ -3370,7 +3378,7 @@
     ].
 
     (methods := self painter aspectMethods) isEmpty ifTrue:[
-        self warn:'No aspect methods found!!'.
+        self warn:'No aspect methods found !!'.
         ^ self.
     ].
     UserPreferences systemBrowserClass browseMethods:methods title:'Aspect methods'.
@@ -3484,13 +3492,55 @@
     "Modified: / 4.2.1999 / 15:36:34 / cg"
 !
 
+doGenerateAspectMethodFor
+    |cls code aspectList displayedList selectorsToGenerateCode|
+
+    self askForSectionModification.
+
+    cls := self targetClass.
+
+    aspectList := OrderedCollection new.
+
+    self aspectSelectorsAndTypesDo:
+        [:selector :type | 
+            ( #(#modelAspect channelAspect actionSelector valueSelector) includes:type) ifTrue:[
+                (cls includesSelector:selector) ifFalse:[
+                    aspectList add:( Array with:selector with:type ).
+                ]
+            ]
+        ].
+    
+    aspectList isEmpty ifTrue:[
+        self information:'All aspect methods exist.'.
+        ^ self.
+    ].
+
+    displayedList := aspectList collect:[:entry | (((entry first) paddedTo:25) contractTo:25) , ' -> ' , entry second ].
+    aspectList := aspectList collect:[:each | each first].
+
+    selectorsToGenerateCode := Dialog
+        chooseMultiple:'Select aspect(s) for which code shall be generated:' 
+        fromList:displayedList 
+        values:aspectList 
+        initialSelection:nil 
+        lines:15.
+
+    selectorsToGenerateCode isEmptyOrNil ifTrue:[^ self].
+
+    code := self painter generateAspectMethodCodeFiltering:selectorsToGenerateCode.
+    code readStream fileIn.
+!
+
 doGenerateAspectMethods
     "generates aspect and action methods for the application class"
 
     self askForSectionModification.
-
-    (ReadStream on:self painter generateAspectMethods) fileIn.
-
+    self withWaitCursorDo:[
+        |code|
+
+        code := self painter generateAspectMethodCode.
+        code readStream fileIn.
+    ]
 !
 
 doGenerateAspectSelectorsMethod