The Trunk: Protocols-fbs.43.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Protocols-fbs.43.mcz

commits-2
Frank Shearar uploaded a new version of Protocols to project The Trunk:
http://source.squeak.org/trunk/Protocols-fbs.43.mcz

==================== Summary ====================

Name: Protocols-fbs.43
Author: fbs
Time: 2 September 2013, 6:11:27.487 pm
UUID: 51179ae8-2441-b541-8916-f31433213a17
Ancestors: Protocols-fbs.42

Kernel shouldn't reference UI stuff. Even though this could well belong in System, I'm moving it to Protocol because that's the only in-image user of the message.

=============== Diff against Protocols-fbs.42 ===============

Item was added:
+ ----- Method: ClassDescription>>chooseClassVarName (in category '*Protocols-Tools') -----
+ chooseClassVarName
+ "Present the user with a list of class variable names and answer the one selected, or nil if none"
+
+ | lines labelStream allVars index |
+ lines := OrderedCollection new.
+ allVars := OrderedCollection new.
+ labelStream := WriteStream on: (String new: 200).
+ self withAllSuperclasses reverseDo:
+ [:class | | vars |
+ vars := class classVarNames.
+ vars do:
+ [:var |
+ labelStream nextPutAll: var; cr.
+ allVars add: var].
+ vars isEmpty ifFalse: [lines add: allVars size]].
+ labelStream contents isEmpty ifTrue: [^Beeper beep]. "handle nil superclass better"
+ labelStream skip: -1 "cut last CR".
+ index := (UIManager default chooseFrom: (labelStream contents substrings) lines: lines).
+ index = 0 ifTrue: [^ nil].
+ ^ allVars at: index!