Skip to content

Commit

Permalink
Merge pull request #354 from StevenCostiou/Pharo10
Browse files Browse the repository at this point in the history
Improving the debugger extension mechanism to hold a variable to debuggers
  • Loading branch information
estebanlm authored Mar 29, 2022
2 parents 806066a + aa8baff commit d17a1b1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ StDebuggerExtensionMechanismTest >> testInstantiateExtensionToolsPage [
self assert: toolPage class identicalTo: SpNotebookPage.
self assert: toolPage presenterProvider value class identicalTo: StDummyDebuggerPresenter.
self assert: toolPage title equals: StDummyDebuggerPresenter new debuggerExtensionToolName.
self assert: toolPage presenterProvider value debugger identicalTo: dbg.
self assertCollection: dbg extensionTools includesAll: { toolPage presenterProvider value}.

]
Expand Down
2 changes: 2 additions & 0 deletions src/NewTools-Debugger-Tests/StDummyDebuggerPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The debugger interface itself is tested in the debugger test class.
Class {
#name : #StDummyDebuggerPresenter,
#superclass : #SpPresenter,
#traits : 'TStDebuggerExtension',
#classTraits : 'TStDebuggerExtension classTrait',
#instVars : [
'tag'
],
Expand Down
17 changes: 17 additions & 0 deletions src/NewTools-Debugger/TStDebuggerExtension.trait.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"
All Spec presenters using me will be recognised as debugger extensions when opening a debugger.
"
Trait {
#name : #TStDebuggerExtension,
#instVars : [
'debugger'
],
#classInstVars : [
'showDebuggerExtension',
'debuggerExtensionDisplayOrder'
Expand Down Expand Up @@ -35,6 +42,11 @@ TStDebuggerExtension classSide >> showInDebugger: aBoolean [
showDebuggerExtension := aBoolean
]

{ #category : #accessing }
TStDebuggerExtension >> debugger [
^debugger
]

{ #category : #'debugger extension' }
TStDebuggerExtension >> debuggerExtensionToolName [
^self explicitRequirement
Expand All @@ -44,3 +56,8 @@ TStDebuggerExtension >> debuggerExtensionToolName [
TStDebuggerExtension >> displayOrder [
^self class displayOrder
]

{ #category : #initialization }
TStDebuggerExtension >> setModelBeforeInitialization: aDebugger [
debugger := aDebugger
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Class {
'bcContextInspection',
'toolbar',
'sindarinDebugger',
'stDebugger',
'bytecodeList',
'currentPC'
],
Expand All @@ -30,11 +29,6 @@ StSindarinBytecodeDebuggerPresenter class >> defaultLayout [
yourself
]

{ #category : #accessing }
StSindarinBytecodeDebuggerPresenter >> debugger [
^stDebugger
]

{ #category : #'debugger extension' }
StSindarinBytecodeDebuggerPresenter >> debuggerExtensionToolName [
^ 'Bytecode'
Expand All @@ -61,7 +55,7 @@ StSindarinBytecodeDebuggerPresenter >> initializeToolbar [
{ #category : #accessing }
StSindarinBytecodeDebuggerPresenter >> setModelBeforeInitialization: aStDebugger [
"My original model is the debugger presenter that I extend"
stDebugger := aStDebugger.
debugger := aStDebugger.
sindarinDebugger := aStDebugger sindarinDebugger
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Class {
'code',
'resultInspection',
'toolbar',
'sindarinDebugger',
'stDebugger'
'sindarinDebugger'
],
#category : #'NewTools-Sindarin-Tools'
}
Expand All @@ -40,11 +39,6 @@ StSindarinDebuggerScriptingPresenter >> createCommandFromScript [
self flag: 'todo'
]

{ #category : #accessing }
StSindarinDebuggerScriptingPresenter >> debugger [
^stDebugger
]

{ #category : #'debugger extension' }
StSindarinDebuggerScriptingPresenter >> debuggerExtensionToolName [

Expand Down Expand Up @@ -115,7 +109,7 @@ StSindarinDebuggerScriptingPresenter >> saveScript [
{ #category : #accessing }
StSindarinDebuggerScriptingPresenter >> setModelBeforeInitialization: aStDebugger [
"My original model is the debugger presenter that I extend"
stDebugger := aStDebugger.
debugger := aStDebugger.
sindarinDebugger := aStDebugger sindarinDebugger
]

Expand Down

0 comments on commit d17a1b1

Please sign in to comment.