[squeak-dev] The Trunk: Morphic-jr.1325.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Mar 5 16:17:33 UTC 2017


David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-jr.1325.mcz

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

Name: Morphic-jr.1325
Author: jr
Time: 3 March 2017, 3:28:29.825687 am
UUID: ec6312f8-a496-fe46-8c4e-e1ca155b499d
Ancestors: Morphic-tpr.1324

regard the model's environment in TextEditor

=============== Diff against Morphic-tpr.1324 ===============

Item was changed:
  ----- Method: TextEditor>>browseClassFromIt (in category 'menu messages') -----
  browseClassFromIt
  	"Launch a hierarchy browser for the class indicated by the current selection.  If multiple classes matching the selection exist, let the user choose among them."
  	| aClass |
  	self lineSelectAndEmptyCheck: [ ^ self ].
  	aClass := UIManager default
  		classFromPattern: self selection string withBlanksTrimmed
+ 		withCaption: 'choose a class to browse...'
+ 		in: model environment.
- 		withCaption: 'choose a class to browse...'.
  	aClass ifNil: [ ^ morph flash ].
+ 	self systemNavigation
- 	SystemNavigation default
  		spawnHierarchyForClass: aClass
  		selector: nil!

Item was changed:
  ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
  browseIt
  	"Launch a browser for the current selection, if appropriate"
  
  	| aSymbol anEntry brow |
  
  	Preferences alternativeBrowseIt ifTrue: [^ self browseClassFromIt].
  
  	self lineSelectAndEmptyCheck: [^ self].
  	(aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
  
  	aSymbol first isUppercase
  		ifTrue:
+ 			[anEntry := (model environment
+ 				valueOf: aSymbol
- 			[anEntry := (Smalltalk
- 				at: aSymbol
  				ifAbsent:
  					[ self systemNavigation browseAllImplementorsOf: aSymbol.
  					^ nil]).
  			anEntry ifNil: [^ morph flash].
  			(anEntry isKindOf: Class)
  				ifFalse:	[anEntry := anEntry class].
  			brow := SystemBrowser default new.
  			brow setClass: anEntry selector: nil.
  			brow class
  				openBrowserView: (brow openEditString: nil)
  				label: 'System Browser']
  		ifFalse:
  			[self systemNavigation browseAllImplementorsOf: aSymbol]!

Item was changed:
  ----- Method: TextEditor>>compileSelectionFor:in: (in category 'do-its') -----
  compileSelectionFor: anObject in: evalContext
  
  	| methodNode |
  	methodNode := [Compiler new
  		compileNoPattern: self selectionAsStream
  		in: anObject class
  		context: evalContext
+ 		environment: model environment
  		notifying: self
  		ifFail: [^nil]]
  			on: OutOfScopeNotification
  			do: [:ex | ex resume: true].
  	^ methodNode generateWithTempNames!

Item was changed:
  ----- Method: TextEditor>>evaluateSelectionAndDo: (in category 'do-its') -----
  evaluateSelectionAndDo: aBlock
  	"Treat the current selection as an expression; evaluate it and invoke aBlock with the result."
  	| result rcvr ctxt |
  	self lineSelectAndEmptyCheck: [^ nil].
  
  	(model respondsTo: #evaluateExpression:) ifTrue: [
  		^ aBlock value: (model perform: #evaluateExpression: with: self selection)].
  
  	(model respondsTo: #doItReceiver) 
  		ifTrue: [ rcvr := model doItReceiver.
  				ctxt := model doItContext]
  		ifFalse: [rcvr := ctxt := nil].
  	result := [
  		rcvr class evaluatorClass new 
  			evaluate: self selectionAsStream
  			in: ctxt
  			to: rcvr
+ 			environment: (model environment ifNil: [Smalltalk globals])
  			notifying: self
  			ifFail: [morph flash. ^ nil]
  			logged: true.
  	] 
  		on: OutOfScopeNotification 
  		do: [ :ex | ex resume: true].
  		
  	(model respondsTo: #expressionEvaluated:result:) ifTrue: [
  		model perform: #expressionEvaluated:result: with: self selection with: result].
  		
  	^aBlock value: result!

Item was changed:
  ----- Method: TextEditor>>referencesToIt (in category 'menu messages') -----
  referencesToIt
  	"Open a MessageSet with the references to the selected global or variable name."
  	| selection environment binding |
  	self selection isEmpty ifTrue: [ self selectWord ].
  	environment := (model respondsTo: #selectedClassOrMetaClass)
+ 		ifTrue: [ model selectedClassOrMetaClass ifNil: [ model environment ] ]
+ 		ifFalse: [ model environment ].
- 		ifTrue: [ model selectedClassOrMetaClass ifNil: [ Smalltalk globals ] ]
- 		ifFalse: [ Smalltalk globals ].
  	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 browseAllCallsOn: binding!

Item was added:
+ ----- Method: TextEditor>>systemNavigation (in category 'as yet unclassified') -----
+ systemNavigation
+ 	^ SystemNavigation for: model environment!



More information about the Squeak-dev mailing list