[squeak-dev] The Trunk: Morphic-eem.1719.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 4 02:38:15 UTC 2021


Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1719.mcz

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

Name: Morphic-eem.1719
Author: eem
Time: 3 February 2021, 6:38:11.11355 pm
UUID: ffb981b1-7c53-4fbe-b6f4-4c8f27c79f5a
Ancestors: Morphic-mt.1718

Make SearchBar>>#smartSearch:in: search existing browsers for a class name being searched for, bringing the first such browser to the front and selecting the class.  This allows one to find classes in browsers either when one has very many, or when one is using multi-window browsers containing many many classes.

=============== Diff against Morphic-mt.1718 ===============

Item was added:
+ ----- Method: Browser>>displayClass: (in category '*Morphic-Menus-DockingBar-accessing') -----
+ displayClass: aClass
+ 	"Assuming the receiver has answered true to isDisplayingClass:, come to the front and select the given class."
+ 	| index |
+ 	index := self multiWindowIndexForClassName: aClass.
+ 	index  ~= 0 ifTrue:
+ 		[multiWindowState selectWindowIndex: index].
+ 	self selectClass: aClass!

Item was added:
+ ----- Method: Browser>>isDisplayingClass: (in category '*Morphic-Menus-DockingBar-accessing') -----
+ isDisplayingClass: aClass
+ 	| className |
+ 	className := aClass name.
+ 	(self multiWindowIndexForClassName: className) ~= 0 ifTrue: [^true].
+ 	^selectedClassName = className!

Item was added:
+ ----- Method: Browser>>multiWindowIndexForClassName: (in category '*Morphic-Menus-DockingBar-accessing') -----
+ multiWindowIndexForClassName: className
+ 	"Answer the index of a browser displaying className in multiWindowState, if any.
+ 	 Otherwise answer zero."
+ 	multiWindowState ifNil: [^0].
+ 	multiWindowState models withIndexDo:
+ 		[:browser :index|
+ 		browser selectedClassName = className ifTrue: [^index]].
+ 	^0!

Item was changed:
  ----- Method: SearchBar>>smartSearch:in: (in category 'searching') -----
  smartSearch: text in: morph
  	"Take the user input and perform an appropriate search"
  	| input newContents |
  	self removeResultsWidget.
  	input := text asString ifEmpty:[^self].
  	self class useSmartSearch ifFalse: [^ ToolSet default browseMessageNames: input].
  
+ 	(Symbol findInterned: input) ifNotNil:
+ 		[:symbol| input := symbol].
  	"If it is a global or a full class name, browse that class."
+ 	(Smalltalk bindingOf: input) ifNotNil:
+ 		[:assoc| | class |
+ 		class := (assoc value isBehavior ifTrue:[assoc value] ifFalse:[assoc value class]) theNonMetaClass.
+ 		Project current world submorphs do:
+ 			[:windowMorph|
+ 			 (windowMorph isSystemWindow
+ 			  and: [(windowMorph model isKindOf: Browser)
+ 			  and: [windowMorph model isDisplayingClass: class]]) ifTrue:
+ 				[windowMorph beKeyWindow.
+ 				 ^windowMorph model displayClass: class]].
+ 		^ToolSet browse: class selector: nil].
- 	(Smalltalk bindingOf: input) ifNotNil:[:assoc| | global |
- 		global := assoc value.
- 		^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil].
  	
  	"If it is a symbol and there are implementors of it, browse those implementors."
  	Symbol hasInterned: input ifTrue: [:selector |
  		(SystemNavigation new allImplementorsOf: selector) ifNotEmpty:[:list|
  			^SystemNavigation new
  				browseMessageList: list
  				name: 'Implementors of ' , input]].
  
  	"If it starts uppercase, browse classes if any. Otherwise, just search for messages."
+ 	input first isUppercase ifTrue:
+ 		[(UIManager default classFromPattern: input withCaption: '')
+ 			ifNotNil:[:aClass| ^ToolSet browse: aClass selector: nil].
+ 		newContents := input, ' -- not found.'.
+ 		self searchTerm: newContents.
+ 		self selection: (input size+1 to: newContents size).
+ 		self currentHand newKeyboardFocus: morph textMorph.
+ 		^ self].
+ 
+ 	"Default to browse message names..."
+ 	ToolSet default browseMessageNames: input!
- 	input first isUppercase
- 		ifTrue: [
- 			(UIManager default classFromPattern: input withCaption: '')
- 				ifNotNil:[:aClass| ^ToolSet browse: aClass selector: nil]
- 				ifNil: [
- 					newContents := input, ' -- not found.'.
- 					self searchTerm: newContents.
- 					self selection: (input size+1 to: newContents size).
- 					self currentHand newKeyboardFocus: morph textMorph.
- 					^ self]]
- 		ifFalse: [
- 			ToolSet default browseMessageNames: input].!



More information about the Squeak-dev mailing list