[squeak-dev] The Trunk: Kernel-lrnp.1456.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Apr 18 10:07:50 UTC 2022

Marcel Taeumel uploaded a new version of Kernel to project The Trunk:

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

Name: Kernel-lrnp.1456
Author: lrnp
Time: 13 April 2022, 9:41:17.632425 pm
UUID: b898a4db-72a4-4e26-a17a-5effa6bd87c9
Ancestors: Kernel-mt.1455

list variables in current class first

Reverses the order classes are inspected to make the currently browsed class' variable are first, then its superclass, etc., up to Object.

Improves usability when viewing references and a superclass defines many variables, such as Morph by placing the current class' variables first in the list by removing the need to scroll to the bottom of the list.

=============== Diff against Kernel-mt.1455 ===============

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
  	| 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:
- 	self withAllSuperclasses reverseDo:
  		[ : class | | vars |
  		vars := class instVarNames , class theNonMetaClass classVarNames.
  		vars do:
  			[ : var | labelStream
  				 nextPutAll: var ;
  			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 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