[Pkg] The Trunk: System-topa.378.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 27 12:08:32 UTC 2010

Levente Uzonyi uploaded a new version of System to project The Trunk:

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

Name: System-topa.378
Author: topa
Time: 27 September 2010, 11:17:30.574 am
UUID: beb6b8d8-c9fb-41ff-b859-731ca8f6b843
Ancestors: System-nice.377

Fix the menu build method that relied on 
coverting a collection of strings to a large string just to split it again.

=============== Diff against System-nice.377 ===============

Item was changed:
  ----- Method: SystemNavigation>>showMenuOf:withFirstItem:ifChosenDo:withCaption: (in category 'ui') -----
  showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption
  	"Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters.  Use aCaption as the menu title, if it is not nil.  Evaluate choiceBlock if a message is chosen."
  	| index menuLabels sortedList |
  	sortedList := selectorCollection asSortedCollection.
+ 	menuLabels := Array streamContents: 
+ 		[:strm | strm nextPut: (firstItem contractTo: 40).
+ 		sortedList do: [:sel | strm nextPut: (sel contractTo: 40)]].
+ 	index := UIManager default chooseFrom: menuLabels lines: #(1).
- 	menuLabels := String streamContents: 
- 		[:strm | strm nextPutAll: (firstItem contractTo: 40).
- 		sortedList do: [:sel | strm cr; nextPutAll: (sel contractTo: 40)]].
- 	index := UIManager default chooseFrom: (menuLabels substrings) lines: #(1).
  	index = 1 ifTrue: [choiceBlock value: firstItem].
  	index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]!

More information about the Packages mailing list