From f90c0707b71223b62726d9f3841060b0a8f5667a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Chi=C8=99?= Date: Mon, 25 Sep 2023 17:08:04 +0200 Subject: [PATCH] Update the embedded search from the timezone ids and cached timezones views to spawn a timezone object --- .../ZTimestamp-GT/ZTimezone.extension.st | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/repository/ZTimestamp-GT/ZTimezone.extension.st b/repository/ZTimestamp-GT/ZTimezone.extension.st index e61513a..cd66fca 100644 --- a/repository/ZTimestamp-GT/ZTimezone.extension.st +++ b/repository/ZTimestamp-GT/ZTimezone.extension.st @@ -54,17 +54,21 @@ ZTimezone class >> gtViewCachedTimezonesFor: aView [ tooltip: 'Search cached timezones by id'; id: GtPharoSearchCodeButtonId; objectActOn: [ :anActOnEvent :anItem :theButton | - (anItem isKindOf: ZTimezone) ifTrue: [ - | columnedList | + | targetTimezone | + targetTimezone := anActOnEvent objectToSend. + (targetTimezone isKindOf: ZTimezone) + ifTrue: [ + | columnedList | - columnedList := theButton phlow viewContent - allChildrenBreadthFirstDetect: [ :child | - child isKindOf: BrColumnedList ] - ifFound: [ :child | child ]. - columnedList scrollToItem: anItem. - columnedList selectOne: (columnedList items indexOf: anItem). - - anActOnEvent beActed ] ]; + columnedList := theButton phlow viewContent + allChildrenBreadthFirstDetect: [ :child | + child isKindOf: BrColumnedList ] + ifFound: [ :child | child ]. + columnedList scrollToItem: targetTimezone. + columnedList selectOne: (columnedList items + indexOf: targetTimezone). + + anActOnEvent beActed ] ]; asElement ] tooltip: 'Search cached timezones by id' ] @@ -98,17 +102,20 @@ ZTimezone class >> gtViewTimezoneIdentifiersFor: aView [ tooltip: 'Search timezone identifiers'; id: GtPharoSearchCodeButtonId; objectActOn: [ :anActOnEvent :anItem :theButton | - (anItem isKindOf: Symbol) ifTrue: [ - | columnedList | - - columnedList := theButton phlow viewContent - allChildrenBreadthFirstDetect: [ :child | - child isKindOf: BrColumnedList ] - ifFound: [ :child | child ]. - columnedList scrollToItem: anItem. - columnedList selectOne: (columnedList items indexOf: anItem). + | targetTimezone | + targetTimezone := anActOnEvent objectToSend. + (targetTimezone isKindOf: ZTimezone) + ifTrue: [ + | columnedList | - anActOnEvent beActed ] ]; + columnedList := theButton phlow viewContent + allChildrenBreadthFirstDetect: [ :child | + child isKindOf: BrColumnedList ] + ifFound: [ :child | child ]. + columnedList scrollToItem: targetTimezone id. + columnedList selectOne: (columnedList items + indexOf: targetTimezone id) ]. + anActOnEvent beActed ]; asElement ] tooltip: 'Search timezone identifiers' ]