Skip to content

Commit

Permalink
Merge pull request #1641 from pharo-spec/fix-issue-879
Browse files Browse the repository at this point in the history
re-add code presenter missing actions.
  • Loading branch information
estebanlm authored Nov 7, 2024
2 parents 1b290cb + 17c7287 commit f42afad
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
9 changes: 8 additions & 1 deletion src/Spec2-Adapters-Morphic/SpMorphicTextAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ SpMorphicTextAdapter >> accept: aString notifying: aNotifyier [
notifying: aNotifyier
]

{ #category : 'widget API' }
SpMorphicTextAdapter >> addExtraActionsTo: actionGroup [

"override to add extra actions between user defined and edition"
]

{ #category : 'initialization' }
SpMorphicTextAdapter >> addFocusRotationKeyBindings [
"Text areas needs to be able to process tab. Cancel the binding."
Expand Down Expand Up @@ -91,9 +97,10 @@ SpMorphicTextAdapter >> codePaneMenu: aMenu shifted: shifted [

self presenter internalActions ifNotNil: [ :group |
actionGroup add: group beRoot ].
self addExtraActionsTo: actionGroup.
self presenter actions ifNotNil: [ :group |
actionGroup add: group beRoot ].
self presenter hasEditionContextMenu ifTrue: [
self presenter hasEditionContextMenu ifTrue: [
actionGroup add: self presenter editionCommandsGroup beRoot ].

menuPresenter := self presenter newMenu.
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeDebugItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeDebugItCommand class >> defaultName [
{ #category : 'default' }
SpCodeDebugItCommand class >> defaultShortcutKey [

^ $d shift command mac
| $d shift control win
| $d shift control unix
^ $d shift actionModifier
]

{ #category : 'private' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeDoItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeDoItCommand class >> defaultName [
{ #category : 'default' }
SpCodeDoItCommand class >> defaultShortcutKey [

^ $d command mac
| $d control win
| $d control unix
^ $d actionModifier
]

{ #category : 'accessing' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodeInspectItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodeInspectItCommand class >> defaultName [
{ #category : 'default' }
SpCodeInspectItCommand class >> defaultShortcutKey [

^ $i command mac
| $i control win
| $i control unix
^ $i actionModifier
]

{ #category : 'documentation' }
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Code-Commands/SpCodePrintItCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ SpCodePrintItCommand class >> defaultName [
{ #category : 'default' }
SpCodePrintItCommand class >> defaultShortcutKey [

^ $p command mac
| $p control win
| $p control unix
^ $p actionModifier
]

{ #category : 'execution' }
Expand Down
8 changes: 8 additions & 0 deletions src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Class {
#package : 'Spec2-Code-Morphic'
}

{ #category : 'widget API' }
SpMorphicCodeAdapter >> addExtraActionsTo: group [

self presenter isOverrideContextMenu ifTrue: [ ^ self ].

group add: self presenter rootCommandsGroup beRoot
]

{ #category : 'widget API' }
SpMorphicCodeAdapter >> behavior [

Expand Down
8 changes: 7 additions & 1 deletion src/Spec2-Code/SpCodePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ SpCodePresenter >> hasEditionContextMenu [
"Answer if edition context menu is active.
Edition context menu is available by default, but it can be disabled by calling `SpTextPresenter>>#withoutEditionContextMenu` or `SpCodePresenter>>#overridingContextMenu`"

^ super hasEditionContextMenu and: [ overrideContextMenu not ]
^ super hasEditionContextMenu and: [ self isOverrideContextMenu not ]
]

{ #category : 'testing' }
Expand Down Expand Up @@ -539,6 +539,12 @@ SpCodePresenter >> interactionModel: anInteractionModel [
self basicInteractionModel: anInteractionModel
]

{ #category : 'private - testing' }
SpCodePresenter >> isOverrideContextMenu [

^ overrideContextMenu
]

{ #category : 'private - bindings' }
SpCodePresenter >> isScripting [

Expand Down

0 comments on commit f42afad

Please sign in to comment.