Permalink
Please
sign in to comment.
Browse files
Rewrite Pre debugger.
- Split the pre debugger into two. One for notification and one for stacks. - Migrate to Spec 2 Fixes #3841
- Loading branch information
Showing
with
253 additions
and 311 deletions.
- +2 −3 src/GT-Debugger/DebugAction.extension.st
- +1 −1 src/GT-Debugger/GTDebugActionButton.class.st
- +9 −8 src/GT-Debugger/GTGenericStackDebugger.class.st
- +53 −0 src/GT-Debugger/GTSpecPreDebugActionsPresenter.class.st
- +43 −0 src/GT-Debugger/GTSpecPreDebugNotificationPresenter.class.st
- +75 −0 src/GT-Debugger/GTSpecPreDebugPresenter.class.st
- +70 −0 src/GT-Debugger/GTSpecPreDebugStackPresenter.class.st
- +0 −299 src/GT-Debugger/GTSpecPreDebugWindow.class.st
@@ -0,0 +1,53 @@ | ||
" | ||
I am a presenter that will hold the action buttons of a pre debugger. | ||
I'll collect the actions via pragmas and create button presenters for them. | ||
" | ||
Class { | ||
#name : #GTSpecPreDebugActionsPresenter, | ||
#superclass : #SpPresenter, | ||
#traits : 'TSpDynamicPresenter', | ||
#classTraits : 'TSpDynamicPresenter classTrait', | ||
#category : #'GT-Debugger-UI' | ||
} | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugActionsPresenter >> buttonFor: anAction [ | ||
^ (self instantiate: anAction specPresenter) | ||
debugAction: anAction; | ||
yourself | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugActionsPresenter >> debugger [ | ||
^ self owner debugger | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugActionsPresenter >> initializeWidgets [ | ||
self preDebuggingActions do: [ :action | self presenterAt: action specId put: (self buttonFor: action) ]. | ||
|
||
self presentersDo: [ :button | self focusOrder add: button ] | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugActionsPresenter >> layout [ | ||
| row | | ||
row := SpBoxLayout newHorizontal. | ||
self basicPresenters keysDo: [ :id | row add: id ]. | ||
^ row | ||
] | ||
|
||
{ #category : #'actions lookup' } | ||
GTSpecPreDebugActionsPresenter >> preDebuggingActions [ | ||
"Return a collection of debug actions constructed based on the pragmas 'self preDebuggingActionsPragmas'. | ||
These actions should understand the message #preDebugWindow:" | ||
|
||
^ (self session class debuggingActionsForPragmas: {#preDebuggingAction} for: self debugger) | ||
do: [ :each | each preDebugWindow: self owner ] | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugActionsPresenter >> session [ | ||
^ self owner session | ||
] |
@@ -0,0 +1,43 @@ | ||
" | ||
I am a pre debugger showing to the user textual informations. | ||
I'll typically display notifications. | ||
Internal Representation and Key Implementation Points. | ||
-------------------- | ||
Instance Variables | ||
textPresenter: <aTextPresenter> A presenter to display the notification. | ||
" | ||
Class { | ||
#name : #GTSpecPreDebugNotificationPresenter, | ||
#superclass : #GTSpecPreDebugPresenter, | ||
#instVars : [ | ||
'textPresenter' | ||
], | ||
#category : #'GT-Debugger-UI' | ||
} | ||
|
||
{ #category : #specs } | ||
GTSpecPreDebugNotificationPresenter class >> defaultSpec [ | ||
^ SpBoxLayout newVertical | ||
add: #actions withConstraints: [ :constraints | constraints height: self toolbarHeight ]; | ||
add: #textPresenter; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugNotificationPresenter >> initializeWidgets [ | ||
super initializeWidgets. | ||
textPresenter := self newText. | ||
|
||
textPresenter disable. | ||
|
||
self focusOrder add: textPresenter | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugNotificationPresenter >> message: aString [ | ||
textPresenter text: aString | ||
] |
@@ -0,0 +1,75 @@ | ||
" | ||
I am an abstract class for pre debug windows. | ||
Depending on the error raised I'll open one of my subclass to display the pre informations to the user. | ||
Internal Representation and Key Implementation Points. | ||
-------------------- | ||
Instance Variables | ||
actions: <aGTSpecPreDebugActionPresenter> A presenter holding the actions to execute in the pre debugger. | ||
debugger: <aDebugger> The debuggeur opening me. | ||
" | ||
Class { | ||
#name : #GTSpecPreDebugPresenter, | ||
#superclass : #SpPresenter, | ||
#instVars : [ | ||
'debugger', | ||
'actions' | ||
], | ||
#category : #'GT-Debugger-UI' | ||
} | ||
|
||
{ #category : #testing } | ||
GTSpecPreDebugPresenter class >> isAbstract [ | ||
^ self = GTSpecPreDebugPresenter | ||
] | ||
|
||
{ #category : #actions } | ||
GTSpecPreDebugPresenter >> close [ | ||
self withWindowDo: #close | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugPresenter >> debugger [ | ||
^ debugger | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugPresenter >> initializeWidgets [ | ||
actions := self instantiate: GTSpecPreDebugActionsPresenter. | ||
|
||
self focusOrder add: actions | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugPresenter >> initializeWindow: aWindowPresenter [ | ||
aWindowPresenter | ||
whenClosedDo: [ debugger ifNotNil: #windowIsClosing ]; | ||
initialExtent: 700 @ 180 | ||
] | ||
|
||
{ #category : #actions } | ||
GTSpecPreDebugPresenter >> openFullDebugger [ | ||
| currentDebugger | | ||
currentDebugger := self debugger. | ||
debugger := nil. | ||
self close. | ||
currentDebugger openWithFullView | ||
] | ||
|
||
{ #category : #accessing } | ||
GTSpecPreDebugPresenter >> session [ | ||
^ self debugger session | ||
] | ||
|
||
{ #category : #'accessing model' } | ||
GTSpecPreDebugPresenter >> setModelBeforeInitialization: aDebugger [ | ||
debugger := aDebugger | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugPresenter >> setTitle: aString [ | ||
self withWindowDo: [ :w | w title: aString ] | ||
] |
@@ -0,0 +1,70 @@ | ||
" | ||
I am a pre debugger showing to the user the beginning of a stack trace. | ||
I'll typically display errors (vs notifications). | ||
Internal Representation and Key Implementation Points. | ||
-------------------- | ||
Instance Variables | ||
stackPresenter: <aTablePresenter> A table to display informations on a stack. | ||
" | ||
Class { | ||
#name : #GTSpecPreDebugStackPresenter, | ||
#superclass : #GTSpecPreDebugPresenter, | ||
#instVars : [ | ||
'stackPresenter' | ||
], | ||
#category : #'GT-Debugger-UI' | ||
} | ||
|
||
{ #category : #specs } | ||
GTSpecPreDebugStackPresenter class >> defaultSpec [ | ||
^ SpBoxLayout newVertical | ||
add: #actions withConstraints: [ :constraints | constraints height: self toolbarHeight ]; | ||
add: #stackPresenter; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugStackPresenter >> initializePresenter [ | ||
stackPresenter | ||
items: self debugger filteredStack; | ||
whenSelectionChangedDo: [ :selection | | ||
"Set the selection before, as debugAction removes the link with the debugger. " | ||
self debugger stackPresentation selection: selection selectedItem. | ||
self openFullDebugger ] | ||
] | ||
|
||
{ #category : #initialization } | ||
GTSpecPreDebugStackPresenter >> initializeWidgets [ | ||
super initializeWidgets. | ||
stackPresenter := self newTable. | ||
|
||
self flag: #todo. "We should remove the #asTextMorph but for now there is no way in Spec to use Text as table cell content." | ||
stackPresenter | ||
addColumn: | ||
(SpStringTableColumn | ||
title: 'Class' | ||
evaluated: [ :context | | ||
(self debugger formatStackClassColumnForContext: context) asTextMorph | ||
lock; | ||
yourself ]); | ||
addColumn: | ||
(SpStringTableColumn | ||
title: 'Method' | ||
evaluated: [ :context | | ||
(self debugger formatStackMethodColumnForContext: context) asTextMorph | ||
lock; | ||
yourself ]); | ||
addColumn: | ||
(SpStringTableColumn | ||
title: 'Extra' | ||
evaluated: [ :context | | ||
(self debugger formatStackExtraColumnForContext: context) asTextMorph | ||
lock; | ||
yourself ]); | ||
beResizable. | ||
|
||
self focusOrder add: stackPresenter | ||
] |

Oops, something went wrong.
0 comments on commit
ccc5777