[squeak-dev] The Inbox: ToolBuilder-Morphic-jr.202.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 10 16:22:05 UTC 2017


A new version of ToolBuilder-Morphic was added to project The Inbox:
http://source.squeak.org/inbox/ToolBuilder-Morphic-jr.202.mcz

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

Name: ToolBuilder-Morphic-jr.202
Author: jr
Time: 10 December 2017, 5:21:48.408893 pm
UUID: 4731ca9c-b924-514d-8f13-19a9913addb5
Ancestors: ToolBuilder-Morphic-tpr.201

fix choice from an empty list

Before the preceding changes in 2016, the MorphicUIManager would answer 0 when the list to choose from was empty.
After the changes, it would signal an error here:
     dialog selectedButtonIndex: 1.
So guard against an empty list and answer 0 immediately.

The case can be triggered in a fresh trunk image when you try to add a repository to an existing package without first adding an additional repository via the '+ Repository' button. There will be zero repositories to choose from.

=============== Diff against ToolBuilder-Morphic-tpr.201 ===============

Item was changed:
  ----- Method: MorphicUIManager>>chooseFrom:lines:title: (in category 'ui requests') -----
  chooseFrom: aList lines: linesArray title: aString 
  	"Choose an item from the given list. Answer the index of the selected item."
  	
+ 	aList ifEmpty: [^ 0].
  	aList size <= 7 ifTrue: [
  		| dialog |
  		dialog := DialogWindow new
  			title: 'Please Choose';
  			message: aString;
  			filterEnabled: true;
  			autoCancel: true;
  			yourself.
  		aList doWithIndex: [:ea :index |
  			dialog createButton: ea value: index].
  		dialog selectedButtonIndex: 1.
  		^ dialog getUserResponseAtHand ifNil: [0]].
  	
  	^ ListChooser chooseFrom: aList title: aString!



More information about the Squeak-dev mailing list