[Pkg] The Trunk: Kernel-ul.594.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Jun 10 20:32:17 UTC 2011
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.594.mcz
==================== Summary ====================
Name: Kernel-ul.594
Author: ul
Time: 10 June 2011, 10:31:35.642 pm
UUID: 385c8487-9a12-1d42-a932-625ab60ddc72
Ancestors: Kernel-wiz.592
Fixed a typo.
=============== Diff against Kernel-wiz.592 ===============
Item was changed:
----- Method: ClassDescription>>chooseVarThenDo: (in category 'instance variables') -----
chooseVarThenDo: aBlock
"Put up a menu of all the instance variables in the receiver, and when
the user chooses one, evaluate aBlock with the chosen variable as its
parameter."
| lines labelStream allVars index |
(self allInstVarNames size + self allClassVarNames size) = 0 ifTrue: [ ^ self inform: 'There are no variables.' ].
allVars := OrderedCollection new.
lines := OrderedCollection new.
labelStream := WriteStream on: (String new: 200).
self withAllSuperclasses reverseDo:
[ : class | | vars |
vars := class instVarNames , class classVarNames.
vars do:
[ : var | labelStream
nextPutAll: var ;
cr.
allVars add: var ].
vars isEmpty ifFalse: [ lines add: allVars size ] ].
labelStream skip: -1.
"cut last CR"
(lines size > 0 and: [ lines last = allVars size ]) ifTrue: [ lines removeLast ].
"dispense with inelegant line beneath last item"
index := UIManager default
chooseFrom: (labelStream contents subStrings: {Character cr})
lines: lines
+ title: 'Variables in ' , self name.
- title: 'Variables in' , self name.
index = 0 ifTrue: [ ^ self ].
aBlock value: (allVars at: index)!
More information about the Packages
mailing list