Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.837.mcz==================== Summary ====================
Name: Morphic-mt.837
Author: mt
Time: 7 April 2015, 1:54:28.194 pm
UUID: 643d7c4c-9cee-8840-bf11-96d16932b68b
Ancestors: Morphic-mt.836
Hooks added to text editors to send evaluation results to the model instead of invoking some default/hard-coded action.
=============== Diff against Morphic-mt.836 ===============
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: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [
rcvr class evaluatorClass new
evaluate: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
ifFail: [morph flash. ^ nil]
logged: true.
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
+
+ (model respondsTo: #evaluated:result:) ifTrue: [
+ model perform: #evaluated:result: with: self selection with: result].
+
^aBlock value: result!
Item was changed:
----- Method: TextEditor>>printIt (in category 'do-its') -----
printIt
+
+ self evaluateSelectionAndDo: [:result |
+ (model respondsTo: #printIt:result:)
+ ifTrue: [model
+ perform: #printIt:result:
+ with: self selection
+ with: result]
+ ifFalse: [self afterSelectionInsertAndSelect: result printString]]!
- self evaluateSelectionAndDo:
- [:result | self afterSelectionInsertAndSelect: result printString]!