UIPainter.st
changeset 1683 f95658463570
parent 1671 493e0430518e
child 1684 34b35b8ae80f
equal deleted inserted replaced
1682:f1b2491c9dc2 1683:f95658463570
  1094                           #value: #doGenerateAspectMethods
  1094                           #value: #doGenerateAspectMethods
  1095                           #activeHelpKey: #generateAspectMethods
  1095                           #activeHelpKey: #generateAspectMethods
  1096                           #enabled: #hasSpecClass
  1096                           #enabled: #hasSpecClass
  1097                       )
  1097                       )
  1098                        #(#MenuItem
  1098                        #(#MenuItem
       
  1099                           #label: 'Aspect Method For...'
       
  1100                           #translateLabel: true
       
  1101                           #value: #doGenerateAspectMethodFor
       
  1102                           #activeHelpKey: #generateAspectMethodFor
       
  1103                           #enabled: #hasSpecClass
       
  1104                       )
       
  1105                        #(#MenuItem
  1099                           #label: 'Menu Stub Methods'
  1106                           #label: 'Menu Stub Methods'
  1100                           #translateLabel: true
  1107                           #translateLabel: true
  1101                           #value: #doGenerateMenuMethods
  1108                           #value: #doGenerateMenuMethods
       
  1109                           #enabled: #hasSpecClass
  1102                       )
  1110                       )
  1103                        #(#MenuItem
  1111                        #(#MenuItem
  1104                           #label: '-'
  1112                           #label: '-'
  1105                       )
  1113                       )
  1106                        #(#MenuItem
  1114                        #(#MenuItem
  3368     self painter isModified ifTrue:[
  3376     self painter isModified ifTrue:[
  3369         self warn:'The current window spec has not yet been saved!!\\The System Browser may show the code of the old aspect methods.' withCRs.
  3377         self warn:'The current window spec has not yet been saved!!\\The System Browser may show the code of the old aspect methods.' withCRs.
  3370     ].
  3378     ].
  3371 
  3379 
  3372     (methods := self painter aspectMethods) isEmpty ifTrue:[
  3380     (methods := self painter aspectMethods) isEmpty ifTrue:[
  3373         self warn:'No aspect methods found!!'.
  3381         self warn:'No aspect methods found !!'.
  3374         ^ self.
  3382         ^ self.
  3375     ].
  3383     ].
  3376     UserPreferences systemBrowserClass browseMethods:methods title:'Aspect methods'.
  3384     UserPreferences systemBrowserClass browseMethods:methods title:'Aspect methods'.
  3377 !
  3385 !
  3378 
  3386 
  3482     painter clear.
  3490     painter clear.
  3483 
  3491 
  3484     "Modified: / 4.2.1999 / 15:36:34 / cg"
  3492     "Modified: / 4.2.1999 / 15:36:34 / cg"
  3485 !
  3493 !
  3486 
  3494 
       
  3495 doGenerateAspectMethodFor
       
  3496     |cls code aspectList displayedList selectorsToGenerateCode|
       
  3497 
       
  3498     self askForSectionModification.
       
  3499 
       
  3500     cls := self targetClass.
       
  3501 
       
  3502     aspectList := OrderedCollection new.
       
  3503 
       
  3504     self aspectSelectorsAndTypesDo:
       
  3505         [:selector :type | 
       
  3506             ( #(#modelAspect channelAspect actionSelector valueSelector) includes:type) ifTrue:[
       
  3507                 (cls includesSelector:selector) ifFalse:[
       
  3508                     aspectList add:( Array with:selector with:type ).
       
  3509                 ]
       
  3510             ]
       
  3511         ].
       
  3512     
       
  3513     aspectList isEmpty ifTrue:[
       
  3514         self information:'All aspect methods exist.'.
       
  3515         ^ self.
       
  3516     ].
       
  3517 
       
  3518     displayedList := aspectList collect:[:entry | (((entry first) paddedTo:25) contractTo:25) , ' -> ' , entry second ].
       
  3519     aspectList := aspectList collect:[:each | each first].
       
  3520 
       
  3521     selectorsToGenerateCode := Dialog
       
  3522         chooseMultiple:'Select aspect(s) for which code shall be generated:' 
       
  3523         fromList:displayedList 
       
  3524         values:aspectList 
       
  3525         initialSelection:nil 
       
  3526         lines:15.
       
  3527 
       
  3528     selectorsToGenerateCode isEmptyOrNil ifTrue:[^ self].
       
  3529 
       
  3530     code := self painter generateAspectMethodCodeFiltering:selectorsToGenerateCode.
       
  3531     code readStream fileIn.
       
  3532 !
       
  3533 
  3487 doGenerateAspectMethods
  3534 doGenerateAspectMethods
  3488     "generates aspect and action methods for the application class"
  3535     "generates aspect and action methods for the application class"
  3489 
  3536 
  3490     self askForSectionModification.
  3537     self askForSectionModification.
  3491 
  3538     self withWaitCursorDo:[
  3492     (ReadStream on:self painter generateAspectMethods) fileIn.
  3539         |code|
  3493 
  3540 
       
  3541         code := self painter generateAspectMethodCode.
       
  3542         code readStream fileIn.
       
  3543     ]
  3494 !
  3544 !
  3495 
  3545 
  3496 doGenerateAspectSelectorsMethod
  3546 doGenerateAspectSelectorsMethod
  3497     "generates aspectSelectors method for the exported aspects"
  3547     "generates aspectSelectors method for the exported aspects"
  3498 
  3548