Skip to content

Commit

Permalink
Merge pull request #4 from adri09070/actionModelClear-event-introduction
Browse files Browse the repository at this point in the history
Action model clear event introduction
  • Loading branch information
adri09070 authored Sep 15, 2023
2 parents 0450348 + d0c4d9f commit c53a1f4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 8 deletions.
29 changes: 29 additions & 0 deletions src/NewTools-Debugger-Tests/StDebuggerActionModelTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,35 @@ StDebuggerActionModelTest >> testDynamicShouldFilterStackUpdate [



]

{ #category : #'tests - actions' }
StDebuggerActionModelTest >> testEventAfterClear [

| dummyActionModel dummyDebugger |
dummyDebugger := StDummyDebuggerPresenter new.

dummyActionModel := StTestDebuggerProvider new debuggerWithDNUContext
debuggerActionModel.
self changeSession: dummyActionModel session.
dummyActionModel clear.

debugActionModel
when: StDebuggerActionModelClearAnnouncement
send: #tag:
to: dummyDebugger.

self assert: dummyDebugger tag isNil.

debugActionModel clear.

self deny: dummyDebugger tag isNil.
self
assert: dummyDebugger tag class
identicalTo: StDebuggerActionModelClearAnnouncement.
self
assert: dummyDebugger tag debuggerActionModel
identicalTo: debugActionModel
]

{ #category : #'tests - actions' }
Expand Down
19 changes: 14 additions & 5 deletions src/NewTools-Debugger/StDebugger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ StDebugger >> clear [

"When we programmatically close the window, we do not need to terminate the session as it was already cleared"
programmaticallyClosed ifTrue: [ ^ self ].
self clearDebugSession.
debuggerActionModel := nil
self clearDebugSession
]

{ #category : #'updating - widgets' }
Expand Down Expand Up @@ -384,9 +383,9 @@ StDebugger >> clearUnsavedCodeChanges [
StDebugger >> close [

programmaticallyClosed := true.
[ self withWindowDo: #close ] ensure: [
debuggerActionModel ifNotNil: [ :actionModel |
actionModel clear ] ]
[ self withWindowDo: #close ] ensure: [
debuggerActionModel ifNotNil: [ :actionModel |
actionModel clearDebugSession ] ]
]

{ #category : #'accessing - widgets' }
Expand Down Expand Up @@ -500,6 +499,13 @@ StDebugger >> debuggerActionModel [
^ debuggerActionModel
]

{ #category : #subscription }
StDebugger >> debuggerActionModelCleared [

self unsubscribeFromActionModel.
self unsubscribeFromSystemAnnouncer
]

{ #category : #accessing }
StDebugger >> debuggerInspectorClass [
^ StDebuggerInspector
Expand Down Expand Up @@ -1289,6 +1295,9 @@ StDebugger >> subscribeToActionModel [
to: self;
when: StDebuggerActionModelMethodAddedAnnouncement
send: #updateAfterMethodAdded
to: self;
when: StDebuggerActionModelClearAnnouncement
send: #debuggerActionModelCleared
to: self
]

Expand Down
12 changes: 9 additions & 3 deletions src/NewTools-Debugger/StDebuggerActionModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,23 @@ StDebuggerActionModel >> autoClassifyMessage: aMessage inClass: aClass [
method isClassified ifFalse: [ MethodClassifier classify: method ]
]

{ #category : #accessing }
{ #category : #actions }
StDebuggerActionModel >> clear [

self unsubscribeFromSystemAnnouncer.
self removeActionsForSession: self session.
self raiseUpdateEvents:
(StDebuggerActionModelClearAnnouncement debuggerActionModel: self).
announcer := nil
]

{ #category : #'debug - execution' }
StDebuggerActionModel >> clearDebugSession [

contextPredicate := nil.
self session terminate; clear
self session
terminate;
clear
]

{ #category : #context }
Expand Down Expand Up @@ -364,7 +369,8 @@ StDebuggerActionModel >> registerActionsForSession: aSession [
when: #stepInto send: #updateStep to: self;
when: #stepOver send: #updateStep to: self;
when: #stepThrough send: #updateStep to: self;
when: #contextChanged send: #updateContextChanged to: self ]
when: #contextChanged send: #updateContextChanged to: self;
when: #clear send: #clear to: self ]
]

{ #category : #'events - removing' }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Class {
#name : #StDebuggerActionModelClearAnnouncement,
#superclass : #StDebuggerActionModelAnnouncement,
#category : #'NewTools-Debugger-Model'
}

0 comments on commit c53a1f4

Please sign in to comment.