[squeak-dev] The Trunk: Protocols-jr.82.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 5 17:47:58 UTC 2022


Christoph Thiede uploaded a new version of Protocols to project The Trunk:
http://source.squeak.org/trunk/Protocols-jr.82.mcz

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

Name: Protocols-jr.82
Author: jr
Time: 14 May 2021, 3:52:50.855866 pm
UUID: fa44c7c0-1902-5140-be89-51048d272a3c
Ancestors: Protocols-nice.81

Use MethodReferences in "browse protocol". Enables to drag methods out to the World and have CodeHolders opened on them, like it was introduced in Morphic-mt.1733.

=============== Diff against Protocols-nice.81 ===============

Item was changed:
  ----- Method: Lexicon>>displaySelector: (in category 'basic operation') -----
  displaySelector: aSelector
  	"Set aSelector to be the one whose source shows in the browser.  If there is a category list, make it highlight a suitable category"
  
  	| detectedItem messageIndex |
  	self chooseCategory: (self categoryDefiningSelector: aSelector).
  	detectedItem := messageList detect:
+ 		[:anItem | anItem selector == aSelector] ifNone: [^ Beeper beep].
- 		[:anItem | (anItem asString copyUpTo: Character space) asSymbol == aSelector] ifNone: [^ Beeper beep].
  	messageIndex := messageList indexOf: detectedItem.
  	self messageListIndex: messageIndex!

Item was changed:
  ----- Method: Lexicon>>initListFrom:highlighting: (in category 'initialization') -----
  initListFrom: selectorCollection highlighting: aClass 
  	"Make up the messageList with items from aClass in boldface.  Provide a final filtering in that only selectors whose implementations fall within my limitClass will be shown."
  
  	
  	messageList := OrderedCollection new.
  	selectorCollection do: 
+ 		[:selector | | item text defClass |
+ 		defClass := aClass whichClassIncludesSelector: selector.
- 		[:selector | | item defClass |  defClass := aClass whichClassIncludesSelector: selector.
  		(defClass notNil and: [defClass includesBehavior: self limitClass]) ifTrue:
+ 			[item := MethodReference class: defClass selector: selector.
+ 			text := selector, '     (' , defClass name , ')'.
+ 			text := text asText.
+ 			defClass == aClass ifTrue: [text allBold].
+ 			item stringVersion: text.
- 			[item := selector, '     (' , defClass name , ')'.
- 			item := item asText.
- 			defClass == aClass ifTrue: [item allBold].
  			"(self isThereAnOverrideOf: selector) ifTrue: [item addAttribute: TextEmphasis struckOut]."
  			"The above has a germ of a good idea but could be very slow"
  			messageList add: item]]!

Item was changed:
  ----- Method: Lexicon>>selectSelectorItsNaturalCategory: (in category 'selection') -----
  selectSelectorItsNaturalCategory: aSelector
  	"Make aSelector be the current selection of the receiver, with the category being its home category."
  
  	| cat catIndex detectedItem |
  	cat := self categoryOfSelector: aSelector.
  	catIndex := categoryList indexOf: cat ifAbsent:
  		["The method's own category is not seen in this browser; the method probably occurs in some other category not known directly to the class, but for now, we'll just use the all category"
  		1].
  	self categoryListIndex: catIndex.
  	detectedItem := messageList detect:
+ 		[:anItem | anItem selector == aSelector] ifNone: [^ self].
- 		[:anItem | (anItem asString copyUpTo: Character space) asSymbol == aSelector] ifNone: [^ self].
  	self messageListIndex:  (messageList indexOf: detectedItem ifAbsent: [^ self])!

Item was changed:
  ----- Method: Lexicon>>selectWithinCurrentCategory: (in category 'selection') -----
  selectWithinCurrentCategory: aSelector
  	"If aSelector is one of the selectors seen in the current category, select it"
  
  	| detectedItem |
  	detectedItem := self messageList detect:
+ 		[:anItem | anItem selector == aSelector] ifNone: [^ self].
- 		[:anItem | (anItem asString copyUpTo: Character space) asSymbol == aSelector] ifNone: [^ self].
  	self messageListIndex:  (messageList indexOf: detectedItem ifAbsent: [^ self])!

Item was changed:
  ----- Method: Lexicon>>selectWithinCurrentCategoryIfPossible: (in category 'category list') -----
  selectWithinCurrentCategoryIfPossible: aSelector
  	"If the receiver's message list contains aSelector, navigate right to it without changing categories"
   
  	| detectedItem messageIndex |
  	aSelector ifNil: [^ self].
  	detectedItem := messageList detect:
+ 		[:anItem | anItem selector == aSelector] ifNone: [^ self].
- 		[:anItem | (anItem asString copyUpTo: $ ) asSymbol == aSelector] ifNone: [^ self].
  	messageIndex := messageList indexOf: detectedItem.
  	self messageListIndex: messageIndex
  !

Item was changed:
  ----- Method: Lexicon>>setToShowSelector:selectCategory: (in category 'selection') -----
  setToShowSelector: selectorString selectCategory: aBoolean 
  	"Set up the receiver so that it will show the given selector"
  	| catName catIndex messageIndex aList |
  	catName := aBoolean
  		ifTrue:
  			[ (aList := currentVocabulary
  				categoriesContaining: selectorString
  				forClass: targetClass)
  				at: 1
  				ifAbsent: [ self class allCategoryName ] ]
  		ifFalse: [ self class allCategoryName ].
  	catIndex := categoryList
  		indexOf: catName
  		ifAbsent: [ 1 ].
  	self categoryListIndex: catIndex.
  	messageList
  		detect:
+ 			[ : anItem | anItem selector == selectorString ]
- 			[ : anItem | (anItem copyUpTo: Character space) asString asSymbol == selectorString ]
  		ifFound:
  			[ : detectedItem | messageIndex := messageList indexOf: detectedItem.
  			self messageListIndex: messageIndex ]
  		ifNone: [ ^ self ]!



More information about the Squeak-dev mailing list