--- a/UIPainter.st Wed May 13 19:18:29 2009 +0200
+++ b/UIPainter.st Wed May 13 20:00:04 2009 +0200
@@ -4871,7 +4871,7 @@
doBrowseAspectMethod:aspectSelector nameAs:aspectNameShown
"browse or create the aspect method as entered in the field"
- |cls spec aspect code implementingClass|
+ |cls spec aspect code implementingClass answer|
cls := self specClass.
cls isNil ifTrue:[
@@ -4881,6 +4881,7 @@
spec := painter specForSelection.
spec isNil ifTrue:[^ self].
+
aspect := spec perform:aspectSelector.
aspect isString ifFalse:[
"ignore non-strings (list may be an Array)"
@@ -4897,25 +4898,41 @@
implementingClass := (cls class whichClassImplements:aspect asSymbol).
].
implementingClass isNil ifTrue:[
- (Dialog confirm:(resources
- stringWithCRs:'%1 does not implement %2.\\Create ?'
- with:(cls name allBold)
- with:aspect allBold))
- ifFalse:[
- (Dialog confirm:(resources
- stringWithCRs:'Browse implementors of %1 ?'
- with:aspect allBold))
- ifTrue:[
- UserPreferences current systemBrowserClass browseImplementorsOf:aspect
- ].
+ answer := OptionBox
+ request:(resources
+ stringWithCRs:'%1 does not implement %2.\\Create ?'
+ with:(cls name allBold)
+ with:aspect allBold)
+ label:'Create/Browse Aspect Method'
+ image:(WarningBox iconBitmap)
+ buttonLabels:#('Cancel' 'Browse Implementors' 'Create & Browse' 'Create' )
+ values:#(abort browseImplementors createAndBrowse create )
+ default:#create
+ onCancel:#abort.
+
+ answer == #browseImplementors ifTrue:[
+ UserPreferences current systemBrowserClass browseImplementorsOf:aspect.
^ self
].
- code := painter
- generateAspectMethodFor:aspect
- spec:spec
- inClass:cls.
- code readStream fileIn.
+ answer == #abort ifTrue:[
+ ^ self
+ ].
+
+ self doGenerateAspectMethodsForAll:(Array with:aspect).
+ implementingClass := self painter targetClass.
+"/ code := painter
+"/ generateAspectMethodFor:aspect
+"/ spec:spec
+"/ inClass:cls.
+"/ code readStream fileIn.
+
+ answer == #create ifTrue:[^ self].
+ ] ifFalse:[
+ (Dialog confirm:(resources string:'Browse the implementation of %1?')) ifFalse:[
+ ^ self.
+ ].
].
+
UserPreferences current systemBrowserClass
openInClass:implementingClass selector:aspect
!
@@ -5115,7 +5132,7 @@
!
doGenerateAspectMethodFor
- |cls code aspectList displayedList selectorsToGenerateCode
+ |cls aspectList displayedList selectorsToGenerateCode
doBrowse methods|
self askForSectionModification.
@@ -5168,8 +5185,7 @@
selectorsToGenerateCode isEmptyOrNil ifTrue:[^ self].
- code := self painter generateAspectMethodCodeFiltering:selectorsToGenerateCode.
- code readStream fileIn.
+ self doGenerateAspectMethodsForAll:selectorsToGenerateCode.
"/ refetch - cls is now obsolete
cls := self painter targetClass.
@@ -5197,6 +5213,13 @@
]
!
+doGenerateAspectMethodsForAll:selectorsToGenerateCode
+ |code|
+
+ code := self painter generateAspectMethodCodeFiltering:selectorsToGenerateCode.
+ code readStream fileIn.
+!
+
doGenerateAspectSelectorsMethod
"generates aspectSelectors method for the exported aspects"