[squeak-dev] The Trunk: ToolBuilder-Morphic-fbs.88.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Feb 27 13:09:36 UTC 2013
Frank Shearar uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-fbs.88.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-fbs.88
Author: fbs
Time: 27 February 2013, 1:09:05.096 pm
UUID: 4d9369c3-4545-408c-8fdf-976048e72eb0
Ancestors: ToolBuilder-Morphic-cwp.87
Allow finding classes by specifying patterns - 'MC*Test' finds all Monticello test cases, for instance.
This commit favours implementation clarity over efficiency.
Part of http://bugs.squeak.org/view.php?id=7745.
=============== Diff against ToolBuilder-Morphic-cwp.87 ===============
Item was changed:
----- Method: ListChooser>>updateFilter (in category 'event handling') -----
updateFilter
selectedItems :=
searchText isEmptyOrNil
ifTrue: [ fullList ]
+ ifFalse: [ | pattern patternMatches prefixMatches |
+ pattern := (searchText beginsWith: '*')
+ ifTrue: [searchText]
+ ifFalse: ['*', searchText, '*'].
+ prefixMatches := fullList select: [:s | (s findString: searchText startingAt: 1 caseSensitive: false) = 1].
+ patternMatches := (fullList select: [:s | pattern match: s]) difference: prefixMatches.
+ prefixMatches addAllLast: patternMatches; yourself].
- ifFalse: [
- | prefixMatches otherMatches |
- prefixMatches := OrderedCollection new.
- otherMatches := OrderedCollection new.
- fullList do: [ :each |
- | index |
- index := each findString: searchText startingAt: 1 caseSensitive: false.
- index = 1 ifTrue: [ prefixMatches add: each ].
- index > 1 ifTrue: [ otherMatches add: each ] ].
- prefixMatches
- addAllLast: otherMatches;
- yourself ].
self changed: #list.
self selectedIndex: 1.
self changed: #selectedIndex.!
More information about the Squeak-dev
mailing list
|