The Inbox: Protocols-jr.64.mcz

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

The Inbox: Protocols-jr.64.mcz

commits-2
A new version of Protocols was added to project The Inbox:
http://source.squeak.org/inbox/Protocols-jr.64.mcz

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

Name: Protocols-jr.64
Author: jr
Time: 10 August 2019, 8:37:33.025208 pm
UUID: 88301d72-00b5-ef41-af99-d6650534d0fd
Ancestors: Protocols-jr.63

Implement icons and help for messages in Lexicon

Extract text rearranging from setClassAndSelectorIn: for reuse when other messages than the selected one need to be parsed.

Depends on changes in Tools-jr.860

=============== Diff against Protocols-jr.63 ===============

Item was changed:
  ----- Method: Lexicon>>messageHelpAt: (in category 'message list') -----
  messageHelpAt: anIndex
+ "Show the first n lines of the source code of the selected message."
+ Preferences balloonHelpInMessageLists ifFalse: [^ nil].
+ self messageList size < anIndex ifTrue: [^ nil].
+
+ self setClassAndSelectorOf: (self messageList at: anIndex) in:
+ [:class :selector |
+ ^ self messageHelpForMethod: class >> selector].
+
- "Not working due to text representation of message list."
  ^ nil!

Item was changed:
  ----- Method: Lexicon>>messageIconAt: (in category 'message list') -----
  messageIconAt: anIndex
+ Browser showMessageIcons
+ ifFalse: [^ nil].
+ self setClassAndSelectorOf: (self messageList at: anIndex) in:
+ [:class :selector |
+ ^ ToolIcons iconNamed: (ToolIcons
+ iconForClass: class
+ selector: selector)].
+
- "Not working due to text representation of message list."
  ^ nil!

Item was changed:
  ----- Method: ProtocolBrowser>>setClassAndSelectorIn: (in category 'private') -----
  setClassAndSelectorIn: csBlock
  "Decode strings of the form    <selectorName> (<className> [class])"
 
+ | sel |
- | i classAndSelString selString sel |
 
  sel := self selection ifNil: [^ csBlock value: nil value: nil].
  (sel isKindOf: MethodReference) ifTrue: [
  sel setClassAndSelectorIn: csBlock
  ] ifFalse: [
+ self setClassAndSelectorOf: sel in: csBlock.
- selString := sel asString.
- i := selString indexOf: $(.
- "Rearrange to  <className> [class] <selectorName> , and use MessageSet"
- classAndSelString := (selString copyFrom: i + 1 to: selString size - 1) , ' ' ,
- (selString copyFrom: 1 to: i - 1) withoutTrailingBlanks.
- MessageSet parse: classAndSelString toClassAndSelector: csBlock.
  ].
  !

Item was added:
+ ----- Method: ProtocolBrowser>>setClassAndSelectorOf:in: (in category 'private') -----
+ setClassAndSelectorOf: aText in: csBlock
+ "Decode strings of the form    <selectorName> (<className> [class])"
+ | selString i classAndSelString|
+ selString := aText asString.
+ i := selString indexOf: $(.
+ "Rearrange to  <className> [class] <selectorName> , and use MessageSet"
+ classAndSelString := (selString copyFrom: i + 1 to: selString size - 1) , ' ' ,
+ (selString copyFrom: 1 to: i - 1) withoutTrailingBlanks.
+ MessageSet parse: classAndSelString toClassAndSelector: csBlock.
+ !