From 4484a9b34a360206327ef5e1476f3cd82b634e22 Mon Sep 17 00:00:00 2001 From: Eric Winger Date: Wed, 22 Aug 2018 14:46:09 -0700 Subject: [PATCH] source pane uses context object I *think* that it is reasonable to ask the parentPresenter for it's context object when doing ad-hoc source code executions Partial fix for #77 --- sources/CodeSourcePresenter.cls | 12 ------------ sources/JadeDebugger.cls | 4 +--- sources/JadeServer64bit3x.cls | 1 - sources/JadeiteMethodListPresenter.cls | 4 ++++ sources/Rowan UI Base.pax | 15 ++++++++++++++- sources/RowanMethodSourcePresenter.cls | 6 ------ 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/sources/CodeSourcePresenter.cls b/sources/CodeSourcePresenter.cls index 8b8e6db0..99bbcedb 100644 --- a/sources/CodeSourcePresenter.cls +++ b/sources/CodeSourcePresenter.cls @@ -151,17 +151,6 @@ environment: anInteger environment := anInteger. ! -executeSelectionOrLine - - [ - ^true -> (gciSession executeString: self currentSelectionOrLine fromContext: model environment: environment). - ] on: GsCompileError do: [:ex | - ^false -> ex list. - ]. - self error: 'How did we get here?'. - ^false -> #(nil). -! - fileSave "Private - Answer whether the save succeeded (false means to stay on the window and cancel any attempt to leave)" @@ -474,7 +463,6 @@ updateCodeFont !CodeSourcePresenter categoriesFor: #editReplace!edit!private! ! !CodeSourcePresenter categoriesFor: #editSelectAll!edit!private! ! !CodeSourcePresenter categoriesFor: #environment:!public! ! -!CodeSourcePresenter categoriesFor: #executeSelectionOrLine!Jade!private! ! !CodeSourcePresenter categoriesFor: #fileSave!private! ! !CodeSourcePresenter categoriesFor: #findClassList!public! ! !CodeSourcePresenter categoriesFor: #handleInvalidSession!public! ! diff --git a/sources/JadeDebugger.cls b/sources/JadeDebugger.cls index 65494433..55474c8a 100644 --- a/sources/JadeDebugger.cls +++ b/sources/JadeDebugger.cls @@ -57,9 +57,7 @@ codeSourcePresenterClass ! contextObject - - ^gciSession oopTypeWithOop: frame vars first key key asNumber. -! + ^gciSession oopTypeWithOop: frame vars first key key asNumber! copyStack | copyStream | diff --git a/sources/JadeServer64bit3x.cls b/sources/JadeServer64bit3x.cls index 63a22a49..f25b6a4a 100644 --- a/sources/JadeServer64bit3x.cls +++ b/sources/JadeServer64bit3x.cls @@ -52,7 +52,6 @@ describeMethod: aMethod ^super describeMethod: aMethod! executeString: aString fromContext: anObject environment: anInteger - [ ^super executeString: aString fromContext: anObject environment: anInteger. ] on: CompileWarning do: [:ex | diff --git a/sources/JadeiteMethodListPresenter.cls b/sources/JadeiteMethodListPresenter.cls index bf37bf1e..16410b08 100644 --- a/sources/JadeiteMethodListPresenter.cls +++ b/sources/JadeiteMethodListPresenter.cls @@ -16,6 +16,9 @@ comparisonTab [comparisonTab := self textTabs detect: [:each | (each class canUnderstand: #text) ifTrue: [each text = 'Comparison'] ifFalse: [each = 'Comparison']]]! +contextObject + ^nil! + createComponents methodListPresenter := self add: JadeiteBasicMethodListPresenter new name: 'methodList'. methodSourcePresenter := (self add: JadeiteMethodSourcePresenter new name: 'methodSource') @@ -75,6 +78,7 @@ updateSource methodSourcePresenter methodService: selection. methodSourcePresenter update. ! ! !JadeiteMethodListPresenter categoriesFor: #comparisonTab!private!selection!text tabs! ! +!JadeiteMethodListPresenter categoriesFor: #contextObject!public! ! !JadeiteMethodListPresenter categoriesFor: #createComponents!public! ! !JadeiteMethodListPresenter categoriesFor: #createSchematicWiring!public! ! !JadeiteMethodListPresenter categoriesFor: #getViews!public! ! diff --git a/sources/Rowan UI Base.pax b/sources/Rowan UI Base.pax index 19722125..e9ae5ebe 100644 --- a/sources/Rowan UI Base.pax +++ b/sources/Rowan UI Base.pax @@ -65,6 +65,7 @@ package classNames package methodNames add: #CodeSourcePresenter -> #browseSelectedClass; + add: #CodeSourcePresenter -> #executeSelectionOrLine; add: #Collection -> #prepareForReplication; add: #GciSession -> #computeGemHost; add: #GciSession -> #computeStoneHost; @@ -572,8 +573,20 @@ browseSelectedClass ifTrue: [shell := RowanSystemBrowser showOnSession: gciSession. shell selectClass: string selector: String new] - ifFalse: [parent addSystemBrowserForClass: assoc value]! ! + ifFalse: [parent addSystemBrowserForClass: assoc value]! + +executeSelectionOrLine + + [ + ^true -> (gciSession executeString: self currentSelectionOrLine fromContext: self parentPresenter contextObject environment: environment). + ] on: GsCompileError do: [:ex | + ^false -> ex list. + ]. + self error: 'How did we get here?'. + ^false -> #(nil). +! ! !CodeSourcePresenter categoriesFor: #browseSelectedClass!public! ! +!CodeSourcePresenter categoriesFor: #executeSelectionOrLine!Jade!private! ! !Collection methodsFor! diff --git a/sources/RowanMethodSourcePresenter.cls b/sources/RowanMethodSourcePresenter.cls index b57c9d7d..e30fcab2 100644 --- a/sources/RowanMethodSourcePresenter.cls +++ b/sources/RowanMethodSourcePresenter.cls @@ -18,16 +18,10 @@ browseSelectedClass shell selectClass:string selector: String new. ! -updateMethodBreakPoints - - self rowanFixMe. - ! - updateMethodStepPoints self rowanFixMe. ! ! !RowanMethodSourcePresenter categoriesFor: #browseSelectedClass!public! ! -!RowanMethodSourcePresenter categoriesFor: #updateMethodBreakPoints!public! ! !RowanMethodSourcePresenter categoriesFor: #updateMethodStepPoints!public! !