Sorting by package list #isChanged column

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

Sorting by package list #isChanged column

Bill Dargel
Often I want to look at or work on the changed packages in a long list
(sometimes over the entire image). For awhile I've been sorting the
package list by clicking on the #isChanged flag column header. But, I
finally got tired of having the resulting packages listed in
quasi-random order.

I patched the view resource to do a secondary sort on the package name
after the sort on #isChanged. The patch I use is attached. In order to
get access to the name, I had to change the #getContentsBlock so that
the packages would be passed to the #sortBlock rather than just the
isChanged booleans. As a result, I also had to change #getImageBlock and
#getTextBlock.

I'd certainly encourage making this the standard behavior.

-Bill

-----------------
| resourceID view column |
resourceID := ResourceIdentifier class: PackageSelector name: 'Default
view'.
view := resourceID load.
column := (view viewNamed: 'packages') columnAtIndex: 2.
self assert: [column text = ''].
column getContentsBlock: nil.
column getImageBlock: [:a | (a isChanged ifTrue: [Package changedIcon]
ifFalse: [Icon blank]) imageIndex].
column getTextBlock: [:a | a isChanged ifTrue: ['Changed'] ifFalse:
['']].
column sortBlock: [:a :b |  | x | (x := a isChanged) = b isChanged
ifTrue: [a name < b name] ifFalse: [x]].
resourceID save: view.

-------------------------------------------
Bill Dargel            [hidden email]
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA