[squeak-dev] The Inbox: Tools-jr.1171.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Aug 21 19:21:01 UTC 2022
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-jr.1171.mcz
==================== Summary ====================
Name: Tools-jr.1171
Author: jr
Time: 21 August 2022, 7:19:58.278081 pm
UUID: ea63bd38-4b4b-0a4b-b113-b7a5817a463e
Ancestors: Tools-mt.1170
Add MessageNavigation class to keep track of browser navigation.
This allows to extract the responsibility of managing the list(s) correctly from the tools.
=============== Diff against Tools-mt.1170 ===============
Item was added:
+ Object subclass: #MessageNavigation
+ instanceVariableNames: 'backwardHistory current forwardHistory suspendLevel'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tools-Browser'!
+
+ !MessageNavigation commentStamp: 'jr 8/21/2022 12:04' prior: 0!
+ I keep track of the history of visited messages displayed in a Browser or a similar tool.!
Item was added:
+ ----- Method: MessageNavigation>>current: (in category 'navigating') -----
+ current: aMethodReferenceOrClassReference
+ "Note the given object as the one currently viewed. Update the history accordingly."
+ suspendLevel > 0 ifTrue: [^ self].
+ current = aMethodReferenceOrClassReference ifTrue: [^ self].
+ (backwardHistory notEmpty and: [aMethodReferenceOrClassReference = backwardHistory last]) ifTrue: [^ self goBack].
+ (forwardHistory notEmpty and: [aMethodReferenceOrClassReference = forwardHistory last]) ifTrue: [^ self goForward].
+ current ifNotNil: [backwardHistory addLast: current].
+ current := aMethodReferenceOrClassReference.
+ forwardHistory removeAll.!
Item was added:
+ ----- Method: MessageNavigation>>goBack (in category 'navigating') -----
+ goBack
+ "Answer the previous message from the history. Update the history to be able to go forward again."
+ backwardHistory ifEmpty: [^ current].
+ forwardHistory addLast: current.
+ current := backwardHistory removeLast.
+ ^ current!
Item was added:
+ ----- Method: MessageNavigation>>goForward (in category 'navigating') -----
+ goForward
+ "Answer the previous message from which we have gone back to the current one in history. Update the history to be able to go back again."
+ forwardHistory ifEmpty: [^ current].
+ backwardHistory addLast: current.
+ current := forwardHistory removeLast.
+ ^ current!
Item was added:
+ ----- Method: MessageNavigation>>initialize (in category 'initialize-release') -----
+ initialize
+ backwardHistory := OrderedCollection new.
+ forwardHistory := OrderedCollection new.
+ suspendLevel := 0.!
Item was added:
+ ----- Method: MessageNavigation>>suspendNavigationLogDuring: (in category 'navigating') -----
+ suspendNavigationLogDuring: aBlock
+ suspendLevel := suspendLevel + 1.
+ ^ aBlock ensure:
+ [suspendLevel := suspendLevel - 1]!
More information about the Squeak-dev
mailing list
|