The Trunk: ToolBuilder-Morphic-jr.202.mcz

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

The Trunk: ToolBuilder-Morphic-jr.202.mcz

commits-2
Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/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!