The Inbox: Protocols-jr.65.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.65.mcz

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

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

Name: Protocols-jr.65
Author: jr
Time: 10 August 2019, 10:04:53.967208 pm
UUID: 798a2618-0a3b-3442-b7a9-ce5014fa1527
Ancestors: Protocols-jr.64

Make ProtocolBrowser and subclasses compatible with recent formatted message list changes

parse:toClassAndSelector: is sent by MessageSet formattedLabel:

ProtocolBrowser produces message items with different texts than those in MessageSet. Overriding the parse method in ProtocolBrowser class makes the setClassAndSelectorOf:in: method introduced in my previous versions obsolete.

setClassAndSelectorIn: can be removed because its new implementation in MessageSet is suitable for ProtocolBrowser and subclasses as well.

=============== Diff against Protocols-jr.64 ===============

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 class parse: (self messageList at: anIndex) toClassAndSelector:
- self setClassAndSelectorOf: (self messageList at: anIndex) in:
  [:class :selector |
  ^ self messageHelpForMethod: class >> selector].
 
  ^ nil!

Item was changed:
  ----- Method: Lexicon>>messageIconAt: (in category 'message list') -----
  messageIconAt: anIndex
  Browser showMessageIcons
  ifFalse: [^ nil].
+ self class parse: (self messageList at: anIndex) toClassAndSelector:
- self setClassAndSelectorOf: (self messageList at: anIndex) in:
  [:class :selector |
  ^ ToolIcons iconNamed: (ToolIcons
  iconForClass: class
  selector: selector)].
 
  ^ nil!

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

Item was removed:
- ----- Method: ProtocolBrowser>>setClassAndSelectorIn: (in category 'private') -----
- setClassAndSelectorIn: csBlock
- "Decode strings of the form    <selectorName> (<className> [class])"
-
- | sel |
-
- sel := self selection ifNil: [^ csBlock value: nil value: nil].
- (sel isKindOf: MethodReference) ifTrue: [
- sel setClassAndSelectorIn: csBlock
- ] ifFalse: [
- self setClassAndSelectorOf: sel in: csBlock.
- ].
- !

Item was removed:
- ----- 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.
- !