Nicolas Cellier uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-nice.304.mcz
==================== Summary ====================
Name: Tools-nice.304
Author: nice
Time: 31 March 2011, 10:13:14.329 pm
UUID: 6046b00a-2861-4da3-9dc2-ab9ce2f41496
Ancestors: Tools-nice.303
remove some FakeClassPool and #failedDoit references parce qu'elles le valent bien.
=============== Diff against Tools-nice.303 ===============
Item was changed:
----- Method: Browser>>doItReceiver (in category 'accessing') -----
doItReceiver
"This class's classPool has been jimmied to be the classPool of the class
being browsed. A doIt in the code pane will let the user see the value of
the class variables."
+ ^ self selectedClass!
- ^ self selectedClass ifNil: [FakeClassPool new]!
Item was changed:
----- Method: Inspector>>accept: (in category 'selecting') -----
accept: aString
| result |
result := self doItReceiver class evaluatorClass new
evaluate: (ReadStream on: aString)
in: self doItContext
to: self doItReceiver
notifying: nil "fix this"
ifFail: [self changed: #flash.
^ false].
- result == #failedDoit ifTrue: [^ false].
self replaceSelectionValue: result.
self changed: #contents.
^ true!
Item was changed:
----- Method: MethodHolder>>doItReceiver (in category 'menu') -----
doItReceiver
"If there is an instance associated with me, answer it, for true mapping of self. If not, then do what other code-bearing tools do, viz. give access to the class vars."
+ ^ self selectedClass!
- ^ self selectedClass ifNil: [FakeClassPool new]!
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.127.mcz
==================== Summary ====================
Name: ST80-nice.127
Author: nice
Time: 31 March 2011, 10:05:15.793 pm
UUID: 04b556c6-fdea-46d0-b21a-9160ebd94302
Ancestors: ST80-nice.126
Get rid of FakeClassPool and #failedDoIt references.
This is implemented by the mean of #evaluateSelectionAndDo:
This method will pass the result to aBlock argument in case of success, and avoid testing for arbitrary return value (FakeClassPool new or #failedDoit)
=============== Diff against ST80-nice.126 ===============
Item was changed:
----- Method: ParagraphEditor>>evaluateSelection (in category 'do-its') -----
evaluateSelection
"Treat the current selection as an expression; evaluate it and return the result"
+
+ ^self evaluateSelectionAndDo: [:result | result]!
- | result rcvr ctxt |
- self lineSelectAndEmptyCheck: [^ ''].
-
- (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: [^ #failedDoit]
- logged: true.
- ]
- on: OutOfScopeNotification
- do: [ :ex | ex resume: true].
- ^ result!
Item was added:
+ ----- Method: ParagraphEditor>>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: [self flash. ^nil]
+ logged: true.
+ ]
+ on: OutOfScopeNotification
+ do: [ :ex | ex resume: true].
+ ^aBlock value: result!
Item was changed:
----- Method: ParagraphEditor>>exploreIt (in category 'do-its') -----
exploreIt
+ self evaluateSelectionAndDo: [:result | result explore]
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result explore].
!
Item was changed:
----- Method: ParagraphEditor>>inspectIt (in category 'do-its') -----
inspectIt
+ self evaluateSelectionAndDo: [:result | result inspect].
- "1/13/96 sw: minor fixup"
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result inspect].
!
Item was changed:
----- Method: ParagraphEditor>>objectsReferencingIt (in category 'do-its') -----
objectsReferencingIt
"Open a list inspector on all objects that reference the object that results when the current selection is evaluated. "
+ self terminateAndInitializeAround:
+ [self evaluateSelectionAndDo: [:result |
+ self systemNavigation
- self terminateAndInitializeAround: [ | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self systemNavigation
browseAllObjectReferencesTo: result
except: #()
+ ifNone: [:obj | view topView flash]]]!
- ifNone: [:obj | view topView flash]].
- ]!
Item was changed:
----- Method: ParagraphEditor>>printIt (in category 'do-its') -----
printIt
"Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection."
+ self evaluateSelectionAndDo: [:result |
+ self afterSelectionInsertAndSelect: result printString]!
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self afterSelectionInsertAndSelect: result printString]!
Item was changed:
----- Method: ParagraphEditor>>tallySelection (in category 'do-its') -----
tallySelection
"Treat the current selection as an expression; evaluate it and return the time took for this evaluation"
| result rcvr ctxt valueAsString v |
+ self lineSelectAndEmptyCheck: [^self].
- self lineSelectAndEmptyCheck: [^ -1].
(model respondsTo: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [ | cm |
cm := rcvr class evaluatorClass new
compiledMethodFor: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
+ ifFail: [self flash. ^self]
- ifFail: [^ #failedDoit]
logged: false.
Time millisecondsToRun:
[v := cm valueWithReceiver: rcvr arguments: #() ].
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
"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.
!
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.127.mcz
==================== Summary ====================
Name: ST80-nice.127
Author: nice
Time: 31 March 2011, 10:05:15.793 pm
UUID: 04b556c6-fdea-46d0-b21a-9160ebd94302
Ancestors: ST80-nice.126
Get rid of FakeClassPool and #failedDoIt references.
This is implemented by the mean of #evaluateSelectionAndDo:
This method will pass the result to aBlock argument in case of success, and avoid testing for arbitrary return value (FakeClassPool new or #failedDoit)
=============== Diff against ST80-nice.126 ===============
Item was changed:
----- Method: ParagraphEditor>>evaluateSelection (in category 'do-its') -----
evaluateSelection
"Treat the current selection as an expression; evaluate it and return the result"
+
+ ^self evaluateSelectionAndDo: [:result | result]!
- | result rcvr ctxt |
- self lineSelectAndEmptyCheck: [^ ''].
-
- (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: [^ #failedDoit]
- logged: true.
- ]
- on: OutOfScopeNotification
- do: [ :ex | ex resume: true].
- ^ result!
Item was added:
+ ----- Method: ParagraphEditor>>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: [self flash. ^nil]
+ logged: true.
+ ]
+ on: OutOfScopeNotification
+ do: [ :ex | ex resume: true].
+ ^aBlock value: result!
Item was changed:
----- Method: ParagraphEditor>>exploreIt (in category 'do-its') -----
exploreIt
+ self evaluateSelectionAndDo: [:result | result explore]
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result explore].
!
Item was changed:
----- Method: ParagraphEditor>>inspectIt (in category 'do-its') -----
inspectIt
+ self evaluateSelectionAndDo: [:result | result inspect].
- "1/13/96 sw: minor fixup"
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result inspect].
!
Item was changed:
----- Method: ParagraphEditor>>objectsReferencingIt (in category 'do-its') -----
objectsReferencingIt
"Open a list inspector on all objects that reference the object that results when the current selection is evaluated. "
+ self terminateAndInitializeAround:
+ [self evaluateSelectionAndDo: [:result |
+ self systemNavigation
- self terminateAndInitializeAround: [ | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self systemNavigation
browseAllObjectReferencesTo: result
except: #()
+ ifNone: [:obj | view topView flash]]]!
- ifNone: [:obj | view topView flash]].
- ]!
Item was changed:
----- Method: ParagraphEditor>>printIt (in category 'do-its') -----
printIt
"Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection."
+ self evaluateSelectionAndDo: [:result |
+ self afterSelectionInsertAndSelect: result printString]!
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self afterSelectionInsertAndSelect: result printString]!
Item was changed:
----- Method: ParagraphEditor>>tallySelection (in category 'do-its') -----
tallySelection
"Treat the current selection as an expression; evaluate it and return the time took for this evaluation"
| result rcvr ctxt valueAsString v |
+ self lineSelectAndEmptyCheck: [^self].
- self lineSelectAndEmptyCheck: [^ -1].
(model respondsTo: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [ | cm |
cm := rcvr class evaluatorClass new
compiledMethodFor: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
+ ifFail: [self flash. ^self]
- ifFail: [^ #failedDoit]
logged: false.
Time millisecondsToRun:
[v := cm valueWithReceiver: rcvr arguments: #() ].
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
"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.
!
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.127.mcz
==================== Summary ====================
Name: ST80-nice.127
Author: nice
Time: 31 March 2011, 10:05:15.793 pm
UUID: 04b556c6-fdea-46d0-b21a-9160ebd94302
Ancestors: ST80-nice.126
Get rid of FakeClassPool and #failedDoIt references.
This is implemented by the mean of #evaluateSelectionAndDo:
This method will pass the result to aBlock argument in case of success, and avoid testing for arbitrary return value (FakeClassPool new or #failedDoit)
=============== Diff against ST80-nice.126 ===============
Item was changed:
----- Method: ParagraphEditor>>evaluateSelection (in category 'do-its') -----
evaluateSelection
"Treat the current selection as an expression; evaluate it and return the result"
+
+ ^self evaluateSelectionAndDo: [:result | result]!
- | result rcvr ctxt |
- self lineSelectAndEmptyCheck: [^ ''].
-
- (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: [^ #failedDoit]
- logged: true.
- ]
- on: OutOfScopeNotification
- do: [ :ex | ex resume: true].
- ^ result!
Item was added:
+ ----- Method: ParagraphEditor>>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: [self flash. ^nil]
+ logged: true.
+ ]
+ on: OutOfScopeNotification
+ do: [ :ex | ex resume: true].
+ ^aBlock value: result!
Item was changed:
----- Method: ParagraphEditor>>exploreIt (in category 'do-its') -----
exploreIt
+ self evaluateSelectionAndDo: [:result | result explore]
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result explore].
!
Item was changed:
----- Method: ParagraphEditor>>inspectIt (in category 'do-its') -----
inspectIt
+ self evaluateSelectionAndDo: [:result | result inspect].
- "1/13/96 sw: minor fixup"
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [result inspect].
!
Item was changed:
----- Method: ParagraphEditor>>objectsReferencingIt (in category 'do-its') -----
objectsReferencingIt
"Open a list inspector on all objects that reference the object that results when the current selection is evaluated. "
+ self terminateAndInitializeAround:
+ [self evaluateSelectionAndDo: [:result |
+ self systemNavigation
- self terminateAndInitializeAround: [ | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self systemNavigation
browseAllObjectReferencesTo: result
except: #()
+ ifNone: [:obj | view topView flash]]]!
- ifNone: [:obj | view topView flash]].
- ]!
Item was changed:
----- Method: ParagraphEditor>>printIt (in category 'do-its') -----
printIt
"Treat the current text selection as an expression; evaluate it. Insert the
description of the result of evaluation after the selection and then make
this description the new text selection."
+ self evaluateSelectionAndDo: [:result |
+ self afterSelectionInsertAndSelect: result printString]!
- | result |
- result := self evaluateSelection.
- ((result isKindOf: FakeClassPool) or: [result == #failedDoit])
- ifTrue: [view flash]
- ifFalse: [self afterSelectionInsertAndSelect: result printString]!
Item was changed:
----- Method: ParagraphEditor>>tallySelection (in category 'do-its') -----
tallySelection
"Treat the current selection as an expression; evaluate it and return the time took for this evaluation"
| result rcvr ctxt valueAsString v |
+ self lineSelectAndEmptyCheck: [^self].
- self lineSelectAndEmptyCheck: [^ -1].
(model respondsTo: #doItReceiver)
ifTrue: [ rcvr := model doItReceiver.
ctxt := model doItContext]
ifFalse: [rcvr := ctxt := nil].
result := [ | cm |
cm := rcvr class evaluatorClass new
compiledMethodFor: self selectionAsStream
in: ctxt
to: rcvr
notifying: self
+ ifFail: [self flash. ^self]
- ifFail: [^ #failedDoit]
logged: false.
Time millisecondsToRun:
[v := cm valueWithReceiver: rcvr arguments: #() ].
]
on: OutOfScopeNotification
do: [ :ex | ex resume: true].
"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.
!