Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/Pyramid-Bloc/PyramidBreakpoint.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ Class {
#category : #'Pyramid-Bloc-plugin-edit-on-running'
}

{ #category : #accessing }
PyramidBreakpoint class >> removeBreakpoint: aBreakpoint [
{ #category : #removing }
PyramidBreakpoint class >> removeAllPyramidBreakpoint [

<script: 'self removeAllPyramidBreakpoint'>
| pyramidBreakpoints |
pyramidBreakpoints := self all select: [ :each | each class = self ].
pyramidBreakpoints ifEmpty: [ ^ self ].
pyramidBreakpoints do: [ :each | each remove ]
]

{ #category : #removing }
PyramidBreakpoint class >> removeAllPyramidBreakpointExceptOne [

"Do nothing"
<script: 'self removeAllPyramidBreakpointExceptOne'>
| pyramidBreakpoints |
pyramidBreakpoints := self all select: [ :each | each class = self ].
pyramidBreakpoints ifEmpty: [ ^ self ].
pyramidBreakpoints allButFirstDo: [ :each | each remove ]
]

{ #category : #api }
Expand Down
13 changes: 8 additions & 5 deletions src/Pyramid-Bloc/PyramidPluginEditOnRunning.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PyramidPluginEditOnRunning class >> breakpoint [
^ breakpoint
]

{ #category : #testing }
{ #category : #'as yet unclassified' }
PyramidPluginEditOnRunning class >> canEditSpace: aSpace [

aSpace ifNil:[ ^ false ].
Expand Down Expand Up @@ -67,13 +67,13 @@ PyramidPluginEditOnRunning class >> doShortcutAction: anEvent [
named: 'Pyramid edit-on-running plugin shortcut'
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
PyramidPluginEditOnRunning class >> editOnRunning [

^ editOnRunning ifNil: [ editOnRunning := true ]
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
PyramidPluginEditOnRunning class >> editOnRunning: aBoolean [

editOnRunning := aBoolean
Expand All @@ -90,11 +90,13 @@ PyramidPluginEditOnRunning class >> install [
PyramidPluginEditOnRunning class >> installBreakpoint [

| node |
PyramidBreakpoint removeAllPyramidBreakpoint.
node := (BlParallelUniverse methodNamed: #openSpace:) ast.

breakpoint := PyramidBreakpoint new.
breakpoint node: node.
breakpoint whenHitDo: [ :context | self addShortcutInSpace: context arguments first ].
breakpoint whenHitDo: [ :context |
self addShortcutInSpace: context arguments first ].
breakpoint install
]

Expand Down Expand Up @@ -133,5 +135,6 @@ PyramidPluginEditOnRunning class >> shortcut [
PyramidPluginEditOnRunning class >> uninstall [
"Undo some stuff here when the plugin used class oriented behavior"

self breakpoint ifNotNil: [ :b | b remove ]
PyramidBreakpoint removeAllPyramidBreakpoint.
breakpoint := nil.
]
12 changes: 12 additions & 0 deletions src/Pyramid-Tests/PyramidPluginEditOnRunningTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ PyramidPluginEditOnRunningTest >> testKeyCombination [

]

{ #category : #tests }
PyramidPluginEditOnRunningTest >> testOnlyOnePyramidBreakpoint [

PyramidPluginEditOnRunning install.
PyramidPluginEditOnRunning install.
PyramidPluginEditOnRunning install.
Smalltalk image garbageCollect.
Smalltalk image garbageCollect.
Smalltalk image garbageCollect.
self assert: (PyramidBreakpoint allInstances select: #isInstalled) size equals: 1
]

{ #category : #tests }
PyramidPluginEditOnRunningTest >> testShortcut [

Expand Down
Loading