Skip to content

Commit

Permalink
Add a hook when selecting a context in the debugger does not change t…
Browse files Browse the repository at this point in the history
…he focus
  • Loading branch information
chisandrei committed Apr 4, 2024
1 parent a28a396 commit d84be35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ GtAbstractExpandableDebuggerElement >> actOnSelectedContextChangedFor: aContext
addChild: detailsTabGroupElement as: #detailsElement
]

{ #category : #callbacks }
GtAbstractExpandableDebuggerElement >> actOnSelectedContextChangedWithoutFocusChangeFor: aContext [
"No action needed at the moment"
]

{ #category : #'building widgets' }
GtAbstractExpandableDebuggerElement >> buildContextVariablesElement [
| contextVariablesElement |
Expand Down
11 changes: 9 additions & 2 deletions src/GToolkit-Debugger/GtAbstractExpandableStackElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ GtAbstractExpandableStackElement >> openFirstNonFilteredContextFrom: aStream [
itemSuchThat: [ :eachCoder | (self shouldJumpOverCoverViewModel: eachCoder) not ]
do: [ :anIndex :isSynchronous |
| anAction |
anAction := [ self stackFramesList itemsProvider: anItemsProvider.
anAction := [
self stackFramesList itemsProvider: anItemsProvider.
self stackFramesList scrollToIndex: anIndex offset: 0.
self selectCoderUIModel: (anItemsProvider itemAt: anIndex) ].

Expand Down Expand Up @@ -188,7 +189,13 @@ GtAbstractExpandableStackElement >> selectCoderUIModel: aContextCoderUIModel [
selectedCoderUIModel := aContextCoderUIModel.

selectedCoderUIModel expanded: true.
selectedCoderUIModel focused: true.
selectedCoderUIModel focused
ifFalse: [ selectedCoderUIModel focused: true ]
ifTrue: [
"We do not give the focus in case the coder view model has the focus.
Instead we notify the debugger that the current coder was selected without changing the focus"
self debuggerElementDo: [ :aDebuggerElement |
aDebuggerElement actOnSelectedContextChangedWithoutFocusChangeFor: selectedCoderUIModel coder context ] ].

"Update the source code as some actions (for example save)
can change the compiled method stored in the context."
Expand Down
3 changes: 2 additions & 1 deletion src/GToolkit-Debugger/GtDebuggerAbstractStackModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ GtDebuggerAbstractStackModel >> cachedCodersDo: aBlock [
{ #category : #accessing }
GtDebuggerAbstractStackModel >> coderViewModelStream [
^ self contextStream
map: [ :eachContext | (self createCoderFor: eachContext in: session) asCoderViewModel]
map: [ :eachContext |
(self createCoderFor: eachContext in: session) asCoderViewModel ]
cache: coderViewModelCache
]

Expand Down

0 comments on commit d84be35

Please sign in to comment.