[squeak-dev] The Trunk: Kernel-tpr.1457.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Apr 19 19:09:04 UTC 2022


tim Rowledge uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-tpr.1457.mcz

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

Name: Kernel-tpr.1457
Author: tpr
Time: 19 April 2022, 12:09:00.431765 pm
UUID: a359d391-43ed-4f7b-bf44-250205de2ac3
Ancestors: Kernel-lrnp.1456

Use the new ToolBuilder ability to show a list of options - typically a small number, maybe with a cancel button etc - as opposed to an arbitrary list of values. This separates it out from the chooseFrom:... protocol.
Also update "UIManager default" with "Project uiManager"

=============== Diff against Kernel-lrnp.1456 ===============

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 theNonMetaClass allClassVarNames size) = 0 ifTrue: [ ^ self inform: 'There are no variables.' ].
  	allVars := OrderedCollection new.
  	lines := OrderedCollection new.
  	labelStream := WriteStream on: (String new: 200).
  	self withAllSuperclasses do:
  		[ : class | | vars |
  		vars := class instVarNames , class theNonMetaClass 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 := Project uiManager
+ 		chooseOptionFrom: (labelStream contents lines)
- 	index := UIManager default
- 		chooseFrom: (labelStream contents lines)
  		lines: lines
  		title: 'Variables in ' , self name.
  	index = 0 ifTrue: [ ^ self ].
  	aBlock value: (allVars at: index)!



More information about the Squeak-dev mailing list