Skip to content

Commit

Permalink
Add groups instead of list for the variable list
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBlondeau committed Oct 23, 2024
1 parent 2e08116 commit c7cf326
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 150 deletions.
46 changes: 23 additions & 23 deletions src/GToolkit-Debugger/DebugAction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ DebugAction >> defaultIcon [
^ self class defaultIcon
]

{ #category : #accessing }
DebugAction >> defaultKeymap [

^ nil
]

{ #category : #accessing }
DebugAction >> defaultKeyText [
"I return a string based on which a default shortcut is created for this action.
Expand All @@ -182,12 +188,6 @@ DebugAction >> defaultKeyText [
^ nil
]

{ #category : #accessing }
DebugAction >> defaultKeymap [

^ nil
]

{ #category : #accessing }
DebugAction >> defaultLabel [

Expand Down Expand Up @@ -255,23 +255,6 @@ DebugAction >> interruptedContext [
^ self debugger interruptedContext
]

{ #category : #accessing }
DebugAction >> keyText [
"I return the character associated with this shortcut.
I return an uppercase character if the keymap has shift as a modifier."

^ self keymap
ifNil: [
"Backwards compatibility."
self defaultKeyText ]
ifNotNil: [ |currentCharacter|
"Needed as current menus display 'Shift' only if the charater is in uppercase."
currentCharacter := self keymap currentCharacter.
(self keymap printString includesSubstring: 'Shift')
ifTrue: [ currentCharacter asString asUppercase ]
ifFalse: [ currentCharacter asString ] ]
]

{ #category : #accessing }
DebugAction >> keymap [

Expand All @@ -291,6 +274,23 @@ DebugAction >> keymap: aKeymap [
keymap := aKeymap
]

{ #category : #accessing }
DebugAction >> keyText [
"I return the character associated with this shortcut.
I return an uppercase character if the keymap has shift as a modifier."

^ self keymap
ifNil: [
"Backwards compatibility."
self defaultKeyText ]
ifNotNil: [ |currentCharacter|
"Needed as current menus display 'Shift' only if the charater is in uppercase."
currentCharacter := self keymap currentCharacter.
(self keymap printString includesSubstring: 'Shift')
ifTrue: [ currentCharacter asString asUppercase ]
ifFalse: [ currentCharacter asString ] ]
]

{ #category : #accessing }
DebugAction >> label [
^ label ifNil: [ self defaultLabel ]
Expand Down
146 changes: 72 additions & 74 deletions src/GToolkit-Debugger/GtAbstractExpandableDebuggerElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ GtAbstractExpandableDebuggerElement >> addDefaultTabsToGroup: aTabGroup [
GtAbstractExpandableDebuggerElement >> buildContextVariablesElement [
| contextVariablesElement |
contextVariablesElement := self buildVariablesListElement.
contextVariablesElement items: self contextVariables.
contextVariablesElement stream: self contextVariables.
contextVariablesElement containerName: #contextVariablesElement.
^ contextVariablesElement
]
Expand Down Expand Up @@ -214,76 +214,25 @@ GtAbstractExpandableDebuggerElement >> buildStackToolbarActionsForDebuggingActio
{ #category : #'building widgets' }
GtAbstractExpandableDebuggerElement >> buildVariablesListElement [
| list |
list := BrColumnedList new.
list margin: (BlInsets top: 10).
list := BrGroupedList new.
list
addEventHandler: (GtPhlowListToSelectHandler new
transformation: [ :variableNode | variableNode value ]).
list rowStencil: BrGlamorousColumnedListSelectableRowElementStencilBuilder new.
list column
title: 'Icon';
width: 26;
cellStencil: [ BlElement new
size: 26 @ 22;
layout: BlLinearLayout horizontal alignCenterLeft;
labeled: 'Icon Container';
padding: (BlInsets
top: 3
left: 10
bottom: 3
right: 0) ];
dataBinder: [ :aCellElement :aVariableNode |
| anIconForm aVariableValue |
anIconForm := [ aVariableValue := aVariableNode rawValue.
aVariableValue gtInspectorIcon
ifNil: [ aVariableValue class iconNamed: aVariableValue class systemIconName ] ]
on: Error , Halt
do: [ :error | self iconNamed: #smallWarningIcon ].
aCellElement
removeChildren;
addChild: anIconForm asElement ].
list column
title: 'Variable';
cellStencil: [ BrLabel new
aptitude: (BrGlamorousLabelAptitude new foreground: Color black);
hMatchParent;
vFitContent;
margin: (BlInsets
top: 3
left: 10
bottom: 3
right: 0) ];
dataBinder: [ :aCellElement :aVariableNode | aCellElement text: aVariableNode key asRopedText ].
list column
title: 'Value';
cellStencil: [ BrLabel new
aptitude: BrGlamorousLabelAptitude new;
hMatchParent;
vFitContent;
margin: (BlInsets
top: 3
left: 10
bottom: 3
right: 0) ];
dataBinder: [ :aCellElement :aVariableNode |
| aRawValue anErrorText |
[ aRawValue := aVariableNode rawValue ]
on: Error
do: [ :error | anErrorText := aVariableNode errorMessage asRopedText foreground: Color red ].

aCellElement
text: ([ anErrorText ifNil: [ aRawValue gtDisplayText asRopedText ] ]
on: Error , Halt
do: [ :error | error messageText asRopedText foreground: Color red ]) ].
^ list
]

{ #category : #'building widgets' }
GtAbstractExpandableDebuggerElement >> buildWatchVariablesElement [
| watchVariablesElement |
watchVariablesElement := self buildVariablesListElement.
watchVariablesElement items: {}. "self watchVariables"
^ watchVariablesElement
margin: (BlInsets all: 10);
headerElementStencil:
[(BrLabel new)
margin: (BlInsets top: 5);
aptitude: (BrGlamorousLabelAptitude new foreground: Color gray)
+ (BrStyleCommonAptitude new default:
[:aStyle |
aStyle
geometry: (BlRoundedRectangleGeometry cornerRadius: 4);
border: BlBorder empty])];
headerDataBinder:
[:aLabel :eachItem |
aLabel viewModel model: eachItem domainObject.
aLabel text: eachItem domainObject new variableTag].
list addEventHandler: (GtPhlowListToSelectHandler new
transformation: [:variableNode | variableNode value]).
^list
]

{ #category : #'building actions' }
Expand Down Expand Up @@ -357,13 +306,61 @@ GtAbstractExpandableDebuggerElement >> collectTargetDebuggingActions [
collectTargetDebuggingActionsForDebugger: self ]
]

{ #category : #'building widgets' }
GtAbstractExpandableDebuggerElement >> contextVariableGroupsFor: aListOfVariables [
| groups |
groups := (aListOfVariables groupedBy: #class) associations asAsyncStream
collect:
[:each |
(BrGroup new)
stream: each value asAsyncStream;
domainObject: each key;
itemStencil:
[| varLabel valueLabel |
varLabel := GtPhlowLabelWithIcon new id: #varLabelId.
valueLabel := (BrLabel new)
aptitude: BrGlamorousLabelAptitude;
hMatchParent;
id: #valueLabelId.
(BrHorizontalPane new)
addAptitude: BrGlamorousListItemAptitude;
hMatchParent;
vFitContent;
alignCenter;
margin: (BlInsets left: 5);
addChildren:
{varLabel.
valueLabel}];
itemDataBinder:
[:aPane :eachItem |
| aRawValue anErrorText anIconForm |
anIconForm :=
[| aVariableValue |
aVariableValue := eachItem rawValue.
aVariableValue gtInspectorIcon
ifNil: [aVariableValue class iconNamed: aVariableValue class systemIconName]]
on: Error , Halt
do: [:error | self iconNamed: #smallWarningIcon].
(aPane childWithId: #varLabelId) initializeWithIcon: anIconForm
label: eachItem key asString.
[aRawValue := eachItem rawValue] on: Error
do: [:error | anErrorText := eachItem errorMessage asRopedText foreground: Color red].
(aPane childWithId: #valueLabelId)
text: ([anErrorText ifNil: [aRawValue gtDisplayText asRopedText]]
on: Error , Halt
do: [:error | error messageText asRopedText foreground: Color red])];
shouldShowWithoutItems: false].
^groups
]

{ #category : #'building widgets' }
GtAbstractExpandableDebuggerElement >> contextVariables [
| activeCoder |
activeCoder := self selectedCoder.
(activeCoder isNil or: [ activeCoder isDead ])
ifTrue: [ ^ #() ].
^ activeCoder debuggerVariableNodes
ifTrue: [ ^ #() asAsyncStream ].

^self contextVariableGroupsFor: activeCoder debuggerVariableNodes

]

Expand Down Expand Up @@ -613,6 +610,7 @@ GtAbstractExpandableDebuggerElement >> updateVariablesList [
ifNotNil: [ :elem |
| newContextVariables |
newContextVariables := self contextVariables.
(elem items gtHasIdenticalElements: newContextVariables)
ifFalse: [ elem items: self contextVariables ] ]
elem stream: self contextVariables
"(elem items gtHasIdenticalElements: newContextVariables)
ifFalse: [ elem items: self contextVariables ]" ]
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ GtCoderEmbeddedDebuggerDetailsElement >> debug [
self fireEvent: BrDropdownHideWish new ]
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerDetailsElement >> debugSessionDo: aBlock [
^ self debuggerViewModelDo: [ :aViewModel | aViewModel debugSessionDo: aBlock ]
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerDetailsElement >> debuggerViewModel [
<return: #GtCoderEmbeddedDebuggerViewModel>
Expand All @@ -46,6 +41,11 @@ GtCoderEmbeddedDebuggerDetailsElement >> debuggerViewModelDo: aBlock [
^ self debuggerViewModel ifNotNil: aBlock
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerDetailsElement >> debugSessionDo: aBlock [
^ self debuggerViewModelDo: [ :aViewModel | aViewModel debugSessionDo: aBlock ]
]

{ #category : #initialization }
GtCoderEmbeddedDebuggerDetailsElement >> defaultLayout [
^ BlLinearLayout vertical
Expand Down Expand Up @@ -119,6 +119,12 @@ GtCoderEmbeddedDebuggerDetailsElement >> onContentExtentChanged: anEvent [
contentExtentForContainerExtent: stackListElement extent)
]

{ #category : #'private - hooks' }
GtCoderEmbeddedDebuggerDetailsElement >> onDebuggerViewModelChanged [
debuggingConfiguration := self debuggerViewModel gtExceptionEmbeddedDebuggerSpecification.
self updateElement
]

{ #category : #'private - subscriptions' }
GtCoderEmbeddedDebuggerDetailsElement >> onDebugSessionDebuggedAnnouncement: anAnnouncement [
BlTaskAction
Expand All @@ -133,12 +139,6 @@ GtCoderEmbeddedDebuggerDetailsElement >> onDebugSessionTerminatedAnnouncement: a
action: [ self fireEvent: BrDropdownHideWish new ]
]

{ #category : #'private - hooks' }
GtCoderEmbeddedDebuggerDetailsElement >> onDebuggerViewModelChanged [
debuggingConfiguration := self debuggerViewModel gtExceptionEmbeddedDebuggerSpecification.
self updateElement
]

{ #category : #'private - subscriptions' }
GtCoderEmbeddedDebuggerDetailsElement >> subscribeToDebuggerViewModel [
self debuggerViewModel weak
Expand Down
10 changes: 5 additions & 5 deletions src/GToolkit-Debugger/GtCoderEmbeddedDebuggerElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ GtCoderEmbeddedDebuggerElement >> onButtonAction: anEvent [
self debug
]

{ #category : #'private - hooks' }
GtCoderEmbeddedDebuggerElement >> onDebuggerViewModelChanged [
self updateButtonElement
]

{ #category : #'private - announcement handling' }
GtCoderEmbeddedDebuggerElement >> onDebugSessionDebuggedAnnouncement: anAnnouncement [
BlTaskAction
Expand All @@ -225,11 +230,6 @@ GtCoderEmbeddedDebuggerElement >> onDebugSessionTerminatedAnnouncement: anAnnoun
action: [ self visibility: BlVisibility hidden ]
]

{ #category : #'private - hooks' }
GtCoderEmbeddedDebuggerElement >> onDebuggerViewModelChanged [
self updateButtonElement
]

{ #category : #'event handling' }
GtCoderEmbeddedDebuggerElement >> onDropdownIsHidden: anEvent [
self debuggerViewModelDo: [ :aViewModel | aViewModel isDropdownDisplayed: false ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ GtCoderEmbeddedDebuggerInSpaceElement >> createWeakDebuggerSpace [
^ weakDebuggerSpace := aSpace asWeakReference
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerInSpaceElement >> debugSession [
^ evaluationStatus debugSession
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerInSpaceElement >> debuggerSpace [
<return: #BlSpace or: nil>
weakDebuggerSpace ifNil: [ self createWeakDebuggerSpace ].
^ weakDebuggerSpace ifNotNil: [ :aWeak | aWeak at: 1 ]
]

{ #category : #accessing }
GtCoderEmbeddedDebuggerInSpaceElement >> debugSession [
^ evaluationStatus debugSession
]

{ #category : #initialization }
GtCoderEmbeddedDebuggerInSpaceElement >> defaultLayout [
^ BlLinearLayout horizontal
Expand Down
22 changes: 11 additions & 11 deletions src/GToolkit-Debugger/GtDebuggerBreakpointMenu.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ GtDebuggerBreakpointMenu class >> on: aBreakpoint coderModel: aCoderModel [
^self new setBreakpoint: aBreakpoint coderModel: aCoderModel
]

{ #category : #aptitudes }
GtDebuggerBreakpointMenu >> actionButtonLook [
^BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude
+ ((BrStyleCommonAptitude new)
default: [:aStyle | aStyle geometry: BlCircleGeometry new];
hovered: [:aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker];
pressed:
[:aStyle |
aStyle background: BrGlamorousColors neutralBackgroundColor darker darker])
]

{ #category : #callbacks }
GtDebuggerBreakpointMenu >> actOnBreakpointHitFor: anAnnouncement [
anAnnouncement breakpoint == breakpoint
Expand All @@ -25,17 +36,6 @@ GtDebuggerBreakpointMenu >> actOnBreakpointRemovedFor: anAnnouncement [
ifTrue: [ coderModel requestStyleSourceText ]
]

{ #category : #aptitudes }
GtDebuggerBreakpointMenu >> actionButtonLook [
^BrGlamorousButtonIconAptitude + BrGlamorousButtonLayoutAptitude
+ ((BrStyleCommonAptitude new)
default: [:aStyle | aStyle geometry: BlCircleGeometry new];
hovered: [:aStyle | aStyle background: BrGlamorousColors neutralBackgroundColor darker];
pressed:
[:aStyle |
aStyle background: BrGlamorousColors neutralBackgroundColor darker darker])
]

{ #category : #accessing }
GtDebuggerBreakpointMenu >> color [
^breakpoint isEnabled
Expand Down
Loading

0 comments on commit c7cf326

Please sign in to comment.