Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1501.mcz==================== Summary ====================
Name: Morphic-mt.1501
Author: mt
Time: 14 August 2019, 10:11:26.641413 am
UUID: 6b762838-8fae-d147-baac-4ab0e872b6c2
Ancestors: Morphic-mt.1500
Tally It: Use dialog window instead of pop-up menu to inform about the results.
Maybe add buttons to that dialog to: explore the result, debug the code, tally again, time-profile it? :-)
=============== Diff against Morphic-mt.1500 ===============
Item was changed:
----- Method: SmalltalkEditor>>tallySelection (in category 'do-its') -----
tallySelection
"Treat the current selection as an expression; evaluate it and return the time took for this evaluation"
+ | code result rcvr ctxt v |
- | result rcvr ctxt valueAsString v |
self lineSelectAndEmptyCheck: [^ self].
(model respondsTo: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [ | cm |
+ code := self selectionAsStream.
cm := rcvr class evaluatorClass new
+ compiledMethodFor: code
- compiledMethodFor: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
ifFail: [morph flash. ^ self].
Time millisecondsToRun:
[v := cm valueWithReceiver: rcvr arguments: (ctxt ifNil: [#()] ifNotNil: [{ctxt}]) ].
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
+
+ UIManager default
+ inform: ('<b>Expression</b>{1}<br>{2}<br><br><b>Time</b> (compile and execute)<br>{3} ms<br><br><b>Result</b><br>{4}' format: {
+ rcvr ifNil: [''] ifNotNil: [' (', (rcvr printString truncateWithElipsisTo: 20), ')'].
+ (code contents truncateWithElipsisTo: 200) copyReplaceAll: String cr with: '<br>'.
+ result printString.
+ v printString truncateWithElipsisTo: 100}) asTextFromHtml.!
-
- "We do not want to have large result displayed"
- valueAsString := v printString.
- (valueAsString size > 30) ifTrue: [valueAsString := (valueAsString copyFrom: 1 to: 30), '...'].
- PopUpMenu
- inform: 'Time to compile and execute: ', result printString, 'ms res: ', valueAsString.
- !