Skip to content

Commit

Permalink
Merge pull request #915 from DurieuxPol/fix/pharo17419
Browse files Browse the repository at this point in the history
Sorting items in bag inspector by default
  • Loading branch information
Ducasse authored Dec 17, 2024
2 parents be458db + 3283deb commit 284f42a
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/NewTools-Inspector-Extensions/Bag.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ Extension { #name : 'Bag' }

{ #category : '*NewTools-Inspector-Extensions' }
Bag >> inspectionItems: aBuilder [
<inspectorPresentationOrder: 0 title: 'Items'>

^ aBuilder newTable
addColumn: (SpStringTableColumn new
title: 'Items';
evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: each key ];
beNotExpandable;
beSortable;
yourself);
addColumn: (SpStringTableColumn new
title: 'Occurences';
evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: (self occurrencesOf: each key) ];
beSortable;
yourself);
items: contents associations;
yourself
<inspectorPresentationOrder: 0 title: 'Items'>
| sortFuction |
sortFuction := [ :c1 :c2 | c1 value > c2 value ].

^ aBuilder newTable
addColumn: (SpStringTableColumn new
title: 'Items';
evaluated: [ :each |
StObjectPrinter asTruncatedTextFrom: each key ];
beNotExpandable;
beSortable;
yourself);
addColumn: (SpStringTableColumn new
title: 'Occurences';
evaluated: [ :each |
StObjectPrinter asTruncatedTextFrom:
(self occurrencesOf: each key) ];
beSortable;
yourself);
items: (contents associations sort: sortFuction);
yourself
]

0 comments on commit 284f42a

Please sign in to comment.