Skip to content

Commit

Permalink
Merge pull request #598 from adri09070/adding-debugger-extension-sett…
Browse files Browse the repository at this point in the history
…ings-shortcut

adding a command to the debugger stack toolbar, which opens a popover to quickly activate/unactivate debugger extensions
  • Loading branch information
StevenCostiou authored Oct 6, 2023
2 parents 44c941f + 23cc87f commit d3aabe2
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 91 deletions.
10 changes: 5 additions & 5 deletions src/NewTools-Core/CmCommand.extension.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : #CmCommand }
Extension { #name : 'CmCommand' }

{ #category : #'*NewTools-Core' }
{ #category : '*NewTools-Core' }
CmCommand >> appliesTo: aTool [

^ true
]

{ #category : #'*NewTools-Core' }
{ #category : '*NewTools-Core' }
CmCommand class >> commandClassesFromPragma: aSymbol [
"Collects command classes matching the pragma aSymbol.
WARNING: The collection will happen takign the caller class and subclasses. If you
Expand All @@ -28,15 +28,15 @@ CmCommand class >> commandClassesFromPragma: aSymbol [
collect: [ :pragma | pragma methodClass soleInstance ]
]

{ #category : #'*NewTools-Core' }
{ #category : '*NewTools-Core' }
CmCommand class >> instantiateCommands: commandClasses for: aTool [

^ commandClasses
collect: [ :commandClass | commandClass forSpecContext: aTool ]
thenSelect: [ :debugCommand | debugCommand decoratedCommand appliesTo: aTool ]
]

{ #category : #'*NewTools-Core' }
{ #category : '*NewTools-Core' }
CmCommand class >> instantiateCommandsFromPragma: pragmaName for: aTool [

^ self
Expand Down
4 changes: 2 additions & 2 deletions src/NewTools-Core/SpPresenter.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #SpPresenter }
Extension { #name : 'SpPresenter' }

{ #category : #'*NewTools-Core' }
{ #category : '*NewTools-Core' }
SpPresenter >> addWindowShortcutsTo: aWindowPresenter [
"override this method to add window shortcuts defined in an inner presenter.
(for example, see *class:StHeaderPanel* who adds a shortcut to access the
Expand Down
16 changes: 9 additions & 7 deletions src/NewTools-Core/StCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ I define common behavior that all commands can have:
- maybe a shortcut
"
Class {
#name : #StCommand,
#superclass : #CmCommand,
#category : #'NewTools-Core-Command'
#name : 'StCommand',
#superclass : 'CmCommand',
#category : 'NewTools-Core-Command',
#package : 'NewTools-Core',
#tag : 'Command'
}

{ #category : #accessing }
{ #category : 'accessing' }
StCommand class >> defaultIconName [

^ nil
]

{ #category : #accessing }
{ #category : 'accessing' }
StCommand class >> defaultShortcut [

^ nil
]

{ #category : #accessing }
{ #category : 'accessing' }
StCommand >> application [

^ context application
]

{ #category : #converting }
{ #category : 'converting' }
StCommand >> asSpecCommand [
| command |

Expand Down
36 changes: 22 additions & 14 deletions src/NewTools-Core/StHeaderBar.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ I am a generic header bar for tool component panels.
I am used to add title, a toolbar and shortcut used to get to the panel.
"
Class {
#name : #StHeaderBar,
#superclass : #SpPresenter,
#name : 'StHeaderBar',
#superclass : 'SpPresenter',
#instVars : [
'titleLabel',
'toolbar',
'closeButton',
'shortcutLabel'
],
#category : #'NewTools-Core-Presenters'
#category : 'NewTools-Core-Presenters',
#package : 'NewTools-Core',
#tag : 'Presenters'
}

{ #category : #layout }
{ #category : 'layout' }
StHeaderBar class >> defaultLayout [

^ SpBoxLayout newLeftToRight
Expand All @@ -28,14 +30,14 @@ StHeaderBar class >> defaultLayout [
yourself
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderBar >> beCloseable [

self isCloseable ifTrue: [ ^ self ].
self enableCloseDoing: [ ]
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderBar >> beNotCloseable [

closeButton ifNil: [ ^ self ].
Expand All @@ -44,7 +46,7 @@ StHeaderBar >> beNotCloseable [
closeButton := nil
]

{ #category : #private }
{ #category : 'private' }
StHeaderBar >> enableCloseDoing: aBlock [

closeButton := self newButton
Expand All @@ -57,7 +59,7 @@ StHeaderBar >> enableCloseDoing: aBlock [
layout addLast: closeButton expand: false
]

{ #category : #initialization }
{ #category : 'initialization' }
StHeaderBar >> initializePresenters [

self layout: (SpBoxLayout newLeftToRight
Expand All @@ -76,37 +78,43 @@ StHeaderBar >> initializePresenters [
toolbar beIcons "is a mini toolbar, items should be... tiny :)"
]

{ #category : #testing }
{ #category : 'testing' }
StHeaderBar >> isCloseable [

^ closeButton notNil
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderBar >> label: aString [

titleLabel label: aString
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderBar >> shortcut: aShortcut [

self shortcutLabel: (KMShortcutPrinter toString: aShortcut)
]

{ #category : #private }
{ #category : 'private' }
StHeaderBar >> shortcutLabel: aString [

shortcutLabel label: aString
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderBar >> toolbar [

^ toolbar
]

{ #category : 'accessing' }
StHeaderBar >> toolbarActions: aCommandGroup [

toolbar fillWith: aCommandGroup
]

{ #category : #events }
{ #category : 'events' }
StHeaderBar >> whenClosedDo: aBlock [

self isCloseable ifFalse: [ self enableCloseDoing: aBlock ].
Expand Down
24 changes: 13 additions & 11 deletions src/NewTools-Core/StHeaderPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ Through its property ==headerBar== (see *class:StHeaderBar*), it provides: a lab
This presenter is used to homogenize the panels in tools.
"
Class {
#name : #StHeaderPanel,
#superclass : #SpPresenter,
#name : 'StHeaderPanel',
#superclass : 'SpPresenter',
#instVars : [
'headerBar',
'presenter',
'shortcut'
],
#category : #'NewTools-Core-Presenters'
#category : 'NewTools-Core-Presenters',
#package : 'NewTools-Core',
#tag : 'Presenters'
}

{ #category : #initialization }
{ #category : 'initialization' }
StHeaderPanel >> addWindowShortcutsTo: aWindowPresenter [

shortcut ifNil: [ ^ self ].
Expand All @@ -27,7 +29,7 @@ StHeaderPanel >> addWindowShortcutsTo: aWindowPresenter [
toAction: [ presenter takeKeyboardFocus ]
]

{ #category : #initialization }
{ #category : 'initialization' }
StHeaderPanel >> initializePresenters [

headerBar := self instantiate: StHeaderBar.
Expand All @@ -37,34 +39,34 @@ StHeaderPanel >> initializePresenters [
yourself
]

{ #category : #'accessing - header' }
{ #category : 'accessing - header' }
StHeaderPanel >> label: aString [

headerBar label: aString
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderPanel >> number: aNumber [

self shortcut: (self shortcutForPanel: aNumber)
]

{ #category : #accessing }
{ #category : 'accessing' }
StHeaderPanel >> presenter: aPresenter [

presenter ifNotNil: [ layout remove: presenter ].
presenter := aPresenter.
layout add: presenter
]

{ #category : #'accessing - header' }
{ #category : 'accessing - header' }
StHeaderPanel >> shortcut: aShortcut [

shortcut := aShortcut.
headerBar shortcut: aShortcut
]

{ #category : #private }
{ #category : 'private' }
StHeaderPanel >> shortcutForPanel: aNumber [
"This is a convenience method to assign shortcuts to panels.
panels will be different areas of a tool: a package panel in a browser, an inspector in
Expand All @@ -77,7 +79,7 @@ StHeaderPanel >> shortcutForPanel: aNumber [
| char control unix
]

{ #category : #'accessing - header' }
{ #category : 'accessing - header' }
StHeaderPanel >> toolbarActions: aCommandGroup [

headerBar toolbarActions: aCommandGroup
Expand Down
Loading

0 comments on commit d3aabe2

Please sign in to comment.