[squeak-dev] The Trunk: Morphic-mt.1599.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Dec 4 09:31:15 UTC 2019


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1599.mcz

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

Name: Morphic-mt.1599
Author: mt
Time: 4 December 2019, 10:30:59.590613 am
UUID: e0afb7cd-2598-4ec8-b31c-d011525ddee9
Ancestors: Morphic-mt.1598

Makes #referencesToIt as readable as #sendersOfIt. Removes some code duplication -- yeah, Editor is still kind of abstract and fails to document its interface property, i.e., #selectLine, ... so much to do! :-)

=============== Diff against Morphic-mt.1598 ===============

Item was changed:
  ----- Method: Editor>>lineSelectAndEmptyCheck: (in category 'menu messages') -----
  lineSelectAndEmptyCheck: returnBlock
  	"If the current selection is an insertion point, expand it to be the entire current line; if after that's done the selection is still empty, then evaluate the returnBlock, which will typically consist of '[^ self]' in the caller -- check senders of this method to understand this."
  
+ 	self hasSelection ifFalse: [
+ 		self selectLine.
+ 		self hasSelection ifFalse: [
+ 			morph flash. 
+ 			^ returnBlock value]].!
- 	self selectLine.  "if current selection is an insertion point, then first select the entire line in which occurs before proceeding"
- 	self hasSelection ifFalse: [morph flash.  ^ returnBlock value]!

Item was changed:
  ----- Method: Editor>>wordSelectAndEmptyCheck: (in category 'menu messages') -----
  wordSelectAndEmptyCheck: returnBlock
  	"Ensure selecting the entire current word; if after that's done the selection is still empty, then evaluate the returnBlock, which will typically consist of '[^ self]' in the caller -- check senders of this method to understand this."
  
+ 	self hasSelection ifFalse: [
+ 		self selectWord.
+ 		self hasSelection ifFalse: [
+ 			morph flash. 
+ 			^ returnBlock value]].!
- 	self selectWord.  "Select exactly a whole word"
- 	self hasSelection ifFalse: [morph flash.  ^ returnBlock value]!

Item was removed:
- ----- Method: TextEditor>>lineSelectAndEmptyCheck: (in category 'new selection') -----
- lineSelectAndEmptyCheck: returnBlock
- 	"If the current selection is an insertion point, expand it to be the entire current line; if after that's done the selection is still empty, then evaluate the returnBlock, which will typically consist of '[^ self]' in the caller -- check senders of this method to understand this."
- 
- 	self selectLine.  "if current selection is an insertion point, then first select the entire line in which occurs before proceeding"
- 	self hasSelection ifFalse: [morph flash.  ^ returnBlock value]!

Item was changed:
  ----- Method: TextEditor>>referencesToIt (in category 'menu messages') -----
  referencesToIt
  	"Open a MessageSet with the references to the selected global or variable name."
+ 
+ 	self wordSelectAndEmptyCheck: [^ self].
+ 	self selectedInstanceVariable ifNotNil:
+ 		[:nameToClass | ^ self systemNavigation
+ 			browseAllAccessesTo: nameToClass key
+ 			from: nameToClass value].
+ 	self selectedBinding ifNotNil:
+ 		[:binding | ^ self systemNavigation browseAllCallsOnClass: binding].
+ 	morph flash.!
- 	| selection environment binding |
- 	self selection isEmpty ifTrue: [ self selectWord ].
- 	environment := (model respondsTo: #selectedClassOrMetaClass)
- 		ifTrue: [ model selectedClassOrMetaClass ifNil: [ model environment ] ]
- 		ifFalse: [ model environment ].
- 	selection := self selectedSymbol ifNil: [ self selection asString ].
- 	(environment isBehavior and:
- 		[ (environment
- 			instVarIndexFor: selection
- 			ifAbsent: [ 0 ]) ~= 0 ]) ifTrue: [ ^ self systemNavigation
- 			browseAllAccessesTo: selection
- 			from: environment ].
- 	selection isSymbol ifFalse: [ ^ morph flash ].
- 	binding := (environment bindingOf: selection) ifNil: [ ^ morph flash ].
- 	
- 	self systemNavigation browseAllCallsOnClass: binding.!

Item was changed:
  ----- Method: TextEditor>>selectLine (in category 'new selection') -----
  selectLine
  	"Make the receiver's selection, if it currently consists of an insertion point only, encompass the current line."
+ 
- 	self hasSelection ifTrue:[^self].
  	self selectInterval: (self encompassLine: self selectionInterval)!

Item was added:
+ ----- Method: TextEditor>>selectedBinding (in category 'menu messages') -----
+ selectedBinding
+ 	"Try to make a binding out of the current text selection. That binding can be a global or class."
+ 
+ 	^ self selectedSymbol ifNotNil:
+ 		[ :symbol |
+ 			((model respondsTo: #selectedClassOrMetaClass)
+ 				ifTrue: [ model selectedClassOrMetaClass ifNil: [ model environment ] ]
+ 				ifFalse: [ model environment ]) ifNotNil:
+ 					[ :environment | environment bindingOf: symbol ] ]!

Item was added:
+ ----- Method: TextEditor>>selectedInstanceVariable (in category 'menu messages') -----
+ selectedInstanceVariable
+ 	"Try to make an association from an instance-variable name to the class where this variable is defined. Make the implementation robust for models that do not know about classes."
+ 
+ 	(model respondsTo: #selectedClassOrMetaClass) ifFalse: [ ^ nil ].
+ 		
+ 	^ self selection string ifNotNil:
+ 		[ :token | model selectedClassOrMetaClass ifNotNil:
+ 			[ :behavior |
+ 				(behavior instVarIndexFor: token ifAbsent: [ 0 ]) ~= 0
+ 					ifTrue: [ token -> behavior ]
+ 					ifFalse: [ nil ] ] ]!



More information about the Squeak-dev mailing list