The Inbox: Tools-ct.1016.mcz

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

The Inbox: Tools-ct.1016.mcz

commits-2
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.1016.mcz

==================== Summary ====================

Name: Tools-ct.1016
Author: ct
Time: 1 November 2020, 6:29:01.297544 pm
UUID: 6d13e111-bc02-d342-9591-6dc4cdbd41f3
Ancestors: Tools-tpr.1014

Fine-tune message adding in a MessageTrace. When the user is asked for one of many selectors and cancels the menu, don't add any message. Reuse the selector search known from browsing implementors for browsing senders as well. Improve multilingual support.

=============== Diff against Tools-tpr.1014 ===============

Item was changed:
  ----- Method: MessageTrace>>addChildMethodsNamed: (in category 'building') -----
  addChildMethodsNamed: selectorSymbol
 
  | methodsReferences |
 
  messageListIndex = 0
  ifTrue:
+ [ ^(PopUpMenu labels: 'OK' translated)
+ startUpWithCaption: 'Please reselect a method.' translated ].
- [ ^(PopUpMenu labels: ' OK ')
- startUpWithCaption: 'Please reselect a method.' ].
  (methodsReferences := self filteredSelectorsNamed: selectorSymbol) isEmpty
  ifTrue:
+ [ ^(PopUpMenu labels: 'OK' translated)
+ startUpWithCaption: ('There are no methods named {1}' translated format: {selectorSymbol}) ]
- [ ^(PopUpMenu labels: ' OK ')
- startUpWithCaption: 'There are no methods named ', selectorSymbol ]
  ifFalse:
  [ self
  addChildMessages: methodsReferences
+ autoSelectString: selectorSymbol ]!
- autoSelectString: selectorSymbol ]
- !

Item was changed:
  ----- Method: MessageTrace>>addParentMethodsSending: (in category 'building') -----
  addParentMethodsSending: selectorSymbol
 
  | methodsList |
  (methodsList := self systemNavigation allCallsOn: selectorSymbol) isEmpty
  ifTrue:
+ [ ^ (PopUpMenu labels: 'OK' translated)
+ startUpWithCaption: ('There are no methods that send {1}' translated format: {selectorSymbol}) ]
- [ ^(PopUpMenu labels: ' OK ')
- startUpWithCaption: 'There are no methods that send ', selectorSymbol ]
  ifFalse:
  [ self
  addParentMessages: methodsList
+ autoSelectString: selectorSymbol ]!
- autoSelectString: selectorSymbol ]
- !

Item was changed:
  ----- Method: MessageTrace>>browseAllCallsOn: (in category 'actions') -----
  browseAllCallsOn: selectorSymbol
+ | selectorToBrowse |
+ selectorToBrowse := self selection
+ ifNil: [ selectorSymbol ]
+ ifNotNil: [ self
+ getSelectorNamed: selectorSymbol
+ toBrowseAs: 'senders' translated ].
+ selectorToBrowse ifNil: [^ self].
  (self hasUnacceptedEdits or: [ Preferences traceMessages not ])
+ ifTrue: [ super browseAllCallsOn: selectorToBrowse ]
+ ifFalse: [ self addParentMethodsSending: selectorToBrowse ]!
- ifTrue: [ super browseAllCallsOn: selectorSymbol ]
- ifFalse: [ self addParentMethodsSending: selectorSymbol ]!

Item was changed:
  ----- Method: MessageTrace>>browseAllImplementorsOf: (in category 'actions') -----
  browseAllImplementorsOf: selectorSymbol
  | selectorToBrowse |
  selectorToBrowse := self selection
  ifNil: [ selectorSymbol ]
+ ifNotNil: [ self
+ getSelectorNamed: selectorSymbol
+ toBrowseAs: 'implementors' translated ].
+ selectorToBrowse ifNil: [^ self].
- ifNotNil: [ self getImplementorNamed: selectorSymbol asSymbol "since we can get passed literals"].
  (self hasUnacceptedEdits or: [ Preferences traceMessages not ])
  ifTrue: [ super browseAllImplementorsOf: selectorToBrowse ]
  ifFalse: [ self addChildMethodsNamed: selectorToBrowse ]
  !

Item was removed:
- ----- Method: MessageTrace>>getImplementorNamed: (in category 'private accessing') -----
- getImplementorNamed: selectorSymbol
- | allPossibilities |
- allPossibilities := (((self selection compiledMethod messages
- select: [ :eachSelector | eachSelector beginsWith: selectorSymbol ])
- copyWith: selectorSymbol)
- select: [ :each | (Symbol lookup: each) notNil ])
- asSet asOrderedCollection sort.
- (allPossibilities includes: selectorSymbol) ifTrue:
- [ allPossibilities addFirst: (allPossibilities remove: selectorSymbol) ].
- ^allPossibilities size > 1
- ifTrue:
- [ | selectionIndex |
- selectionIndex := (PopUpMenu labelArray: allPossibilities lines: #(1))
- startUpWithCaption:
- 'Browse implementors of
- which message?'.
- selectionIndex = 0 ifTrue: [ selectorSymbol ] ifFalse: [ allPossibilities at: selectionIndex ] ]
- ifFalse: [ allPossibilities isEmpty
- ifTrue: [ selectorSymbol ]
- ifFalse: [ allPossibilities first ] ]
- !

Item was added:
+ ----- Method: MessageTrace>>getSelectorNamed:toBrowseAs: (in category 'private accessing') -----
+ getSelectorNamed: selectorSymbol toBrowseAs: selectorRole
+ | allPossibilities |
+ allPossibilities := (((self selection compiledMethod messages
+ select: [ :eachSelector | eachSelector beginsWith: selectorSymbol asString ])
+ copyWith: selectorSymbol)
+ select: [ :each | (Symbol lookup: each) notNil ])
+ asSet asOrderedCollection sort.
+ (allPossibilities includes: selectorSymbol) ifTrue:
+ [ allPossibilities addFirst: (allPossibilities remove: selectorSymbol) ].
+ ^allPossibilities size > 1
+ ifTrue:
+ [ | selectionIndex |
+ selectionIndex := (PopUpMenu labelArray: allPossibilities lines: #(1))
+ startUpWithCaption: ('Browse {1} of which message?' translated format: {selectorRole}).
+ selectionIndex = 0 ifTrue: [ nil ] ifFalse: [ allPossibilities at: selectionIndex ] ]
+ ifFalse: [ allPossibilities isEmpty
+ ifTrue: [ selectorSymbol ]
+ ifFalse: [ allPossibilities first ] ]!