[squeak-dev] The Trunk: Protocols-ct.85.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 5 17:45:53 UTC 2022


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

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

Name: Protocols-ct.85
Author: ct
Time: 5 May 2022, 7:45:51.726075 pm
UUID: 9aacb7f0-9d20-0c4b-bb52-392f8be54341
Ancestors: Protocols-ct.84, Protocols-ct.79, Protocols-jr.82, Protocols-ct.83

Merge commit.

Protocols-ct.79:
	In the protocol lexicon, fall back to the "all" category if no certain protocol is selected.

Protocols-jr.82:
	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.

Protocols-ct.83:
	Replaces missing icon in lexicon.
	
	Revision: Forego unnecessary #asMorph.

=============== Diff against Protocols-ct.84 ===============

Item was changed:
  ----- Method: Lexicon>>addSpecialButtonsTo:with: (in category 'toolbuilder') -----
  addSpecialButtonsTo: buttonPanelSpec with: builder
  
  	| homeCatBtnSpec menuBtnSpec mostGenericBtnSpec |
  	homeCatBtnSpec := builder pluggableButtonSpec new
  		model: self;
  		action: #showHomeCategory;
+ 		label: MenuIcons smallHomeIcon;
- 		label: (ScriptingSystem formAtKey: #Cat) asMorph;
  		help: 'show this method''s home category';
  		yourself.
  	menuBtnSpec := builder pluggableButtonSpec new
  		model: self;
  		action: #offerMenu;
  		label: (ScriptingSystem formAtKey: #TinyMenu) asMorph;
  		help: 'click here to get a menu with further options';
  		yourself.
  	mostGenericBtnSpec :=builder pluggableButtonSpec new
  		model: self;
  		action: #chooseLimitClass;
  		label: #limitClassString;
  		help: 'Governs which classes'' methods should be shown.  If this is the same as the viewed class, then only methods implemented in that class will be shown.  If it is ProtoObject, then methods of all classes in the vocabulary will be shown.'.
  	buttonPanelSpec children
  		add: homeCatBtnSpec;
  		addFirst: mostGenericBtnSpec;
  		addFirst: menuBtnSpec.!

Item was changed:
  ----- Method: Lexicon>>categoryListIndex: (in category 'category list') -----
  categoryListIndex: anIndex
  	"Set the category list index as indicated"
  
  	| categoryName aList found existingSelector |
  	existingSelector := self selectedMessageName.
  
  	categoryListIndex := anIndex.
+ 	categoryName := anIndex > 0
- 	anIndex > 0
  		ifTrue:
+ 			[categoryList at: anIndex]
- 			[categoryName := categoryList at: anIndex]
  		ifFalse:
+ 			[self class allCategoryName].
- 			[contents := nil].
  	self changed: #categoryListIndex.
  
  	found := false.
  	#(	(viewedCategoryName		selectorsVisited)
  		(queryCategoryName		selectorsRetrieved)) do:
  			[:pair |
  				categoryName = (self class perform: pair first)
  					ifTrue:
  						[aList := self perform: pair second.
  						found := true]].
  	found ifFalse:
  		[aList := currentVocabulary allMethodsInCategory: categoryName forInstance: self targetObject ofClass: targetClass].
  	categoryName = self class queryCategoryName ifFalse: [autoSelectString := nil].
  
  	self initListFrom: aList highlighting: targetClass.
  
  	messageListIndex := 0.
  	self changed: #messageList.
  	contents := nil.
  	self contentsChanged.
  	self selectWithinCurrentCategoryIfPossible: existingSelector.
  	self adjustWindowTitle!

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