Skip to content

Commit

Permalink
Merge branch 'Pharo12' into debugger-class-side-cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenCostiou authored Sep 29, 2023
2 parents 7746e6a + d952aee commit d134267
Show file tree
Hide file tree
Showing 25 changed files with 186 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@
Requests the debugger to copy its stack on the Clipboard
"
Class {
#name : #StCopyStackToClipboardCommand,
#superclass : #StDebuggerCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StCopyStackToClipboardCommand',
#superclass : 'StDebuggerCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #initialization }
{ #category : 'initialization' }
StCopyStackToClipboardCommand class >> defaultDescription [
^ 'Copy the debugging stack to the clipboard.'
]

{ #category : #initialization }
{ #category : 'initialization' }
StCopyStackToClipboardCommand class >> defaultIconName [

^ #debuggerCopyStack
]

{ #category : #initialization }
{ #category : 'initialization' }
StCopyStackToClipboardCommand class >> defaultName [
^ 'Copy Stack to Clipboard'
]

{ #category : #initialization }
{ #category : 'initialization' }
StCopyStackToClipboardCommand class >> defaultShortcut [
^ nil
]

{ #category : #testing }
{ #category : 'testing' }
StCopyStackToClipboardCommand >> appliesTo: aDebugger [
^ true
]

{ #category : #hooks }
{ #category : 'hooks' }
StCopyStackToClipboardCommand >> execute [
self debugger copyStackToClipboard
]
35 changes: 18 additions & 17 deletions src/NewTools-Debugger-Commands/StDebuggerCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@
I command actions that can be requested from a debugger
"
Class {
#name : #StDebuggerCommand,
#superclass : #CmCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StDebuggerCommand',
#superclass : 'CmCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
StDebuggerCommand class >> codeContextMenuCommandsForDebugger: debugger [

^ self
instantiateCommandsFromPragma: #CodeContextMenuDebugCommand
for: debugger
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerCommand class >> defaultIconName [
^ self subclassResponsibility
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerCommand class >> defaultShortcut [
^ self subclassResponsibility
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
StDebuggerCommand class >> forSpecContext: anObject [
^ (self
forSpecWithIconNamed: self defaultIconName
Expand All @@ -34,26 +35,26 @@ StDebuggerCommand class >> forSpecContext: anObject [
yourself
]

{ #category : #testing }
{ #category : 'testing' }
StDebuggerCommand class >> isAbstract [

^ self == StDebuggerCommand
]

{ #category : #default }
{ #category : 'default' }
StDebuggerCommand class >> shortName [
^self defaultName
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
StDebuggerCommand class >> toolbarCommandsForDebugger: debugger [

^ self
instantiateCommandsFromPragma: #toolbarDebugCommand:
for: debugger
]

{ #category : #comparing }
{ #category : 'comparing' }
StDebuggerCommand >> = anObject [
"Answer whether the receiver and anObject represent the same object."

Expand All @@ -65,35 +66,35 @@ StDebuggerCommand >> = anObject [
and: [ basicName = anObject name ]
]

{ #category : #testing }
{ #category : 'testing' }
StDebuggerCommand >> appliesTo: aDebugger [
^ aDebugger canExecuteDebugCommand
]

{ #category : #accessing }
{ #category : 'accessing' }
StDebuggerCommand >> canBeExecuted [
^ self appliesTo: self debugger
]

{ #category : #accessing }
{ #category : 'accessing' }
StDebuggerCommand >> context: anObject [

super context: anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
StDebuggerCommand >> debugger [
^self context
]

{ #category : #comparing }
{ #category : 'comparing' }
StDebuggerCommand >> hash [
"Answer an integer value that is related to the identity of the receiver."

^ context hash bitXor: basicName hash
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerCommand >> initialize [

super initialize.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@
I open a settings browser focused on the debugger and debugging systems settings.
"
Class {
#name : #StDebuggerSettingsCommand,
#superclass : #StDebuggerCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StDebuggerSettingsCommand',
#superclass : 'StDebuggerCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #default }
{ #category : 'default' }
StDebuggerSettingsCommand class >> defaultDescription [
^'I open a settings browser focused on the debugger and debugging systems settings.'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerSettingsCommand class >> defaultIconName [
^ #configuration
]

{ #category : #default }
{ #category : 'default' }
StDebuggerSettingsCommand class >> defaultName [
^'Settings'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerSettingsCommand class >> defaultShortcut [
^$f meta, $s meta
]

{ #category : #executing }
{ #category : 'executing' }
StDebuggerSettingsCommand >> execute [

SettingBrowser new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@
I toggle the stack filtering in the debugger on and off, and I trigger a debugger update.
"
Class {
#name : #StDebuggerToggleFilterStackCommand,
#superclass : #StDebuggerCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StDebuggerToggleFilterStackCommand',
#superclass : 'StDebuggerCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #default }
{ #category : 'default' }
StDebuggerToggleFilterStackCommand class >> defaultDescription [
^'Toggle stack filtering on and off'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerToggleFilterStackCommand class >> defaultIconName [
^ #changeSorter
]

{ #category : #default }
{ #category : 'default' }
StDebuggerToggleFilterStackCommand class >> defaultName [
^'Toggle stack filtering'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDebuggerToggleFilterStackCommand class >> defaultShortcut [
^$c meta, $f meta
]

{ #category : #executing }
{ #category : 'executing' }
StDebuggerToggleFilterStackCommand >> execute [
StDebuggerActionModel shouldFilterStack: StDebuggerActionModel shouldFilterStack not.
self context updateStep
Expand Down
13 changes: 7 additions & 6 deletions src/NewTools-Debugger-Commands/StDefineClassCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
I request the debugger to define a missing class in case the current context is interrupted on a DNU exception and a receiver that is an unknown symbol
"
Class {
#name : #StDefineClassCommand,
#superclass : #StDefineMissingEntityCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StDefineClassCommand',
#superclass : 'StDefineMissingEntityCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #accessing }
{ #category : 'accessing' }
StDefineClassCommand class >> defaultName [
^ 'Create missing class'
]

{ #category : #testing }
{ #category : 'testing' }
StDefineClassCommand >> appliesTo: aDebugger [
^ aDebugger canExecuteCreateMissingClassCommand
]

{ #category : #executing }
{ #category : 'executing' }
StDefineClassCommand >> execute [
self debugger createMissingClass
]
13 changes: 7 additions & 6 deletions src/NewTools-Debugger-Commands/StDefineMethodCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
I request the debugger to define a missing method in case the current context is interrupted on a DNU exception
"
Class {
#name : #StDefineMethodCommand,
#superclass : #StDefineMissingEntityCommand,
#category : #'NewTools-Debugger-Commands'
#name : 'StDefineMethodCommand',
#superclass : 'StDefineMissingEntityCommand',
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #accessing }
{ #category : 'accessing' }
StDefineMethodCommand class >> defaultName [
^ 'Create missing command'
]

{ #category : #testing }
{ #category : 'testing' }
StDefineMethodCommand >> appliesTo: aDebugger [
^ aDebugger canExecuteCreateMissingMethodCommand
]

{ #category : #hooks }
{ #category : 'hooks' }
StDefineMethodCommand >> execute [
self debugger createMissingMethod
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,68 @@ For a given debugging context (i.e., the context of the debugger's debug session
For instance, if we are in the context of a DNU, it makes only sense to propose to create the missing method (StCreateMissingMethodDebugCommand) and all other subcommands are inapplicable.
"
Class {
#name : #StDefineMissingEntityCommand,
#superclass : #StDebuggerCommand,
#name : 'StDefineMissingEntityCommand',
#superclass : 'StDebuggerCommand',
#instVars : [
'subCommands'
],
#category : #'NewTools-Debugger-Commands'
#category : 'NewTools-Debugger-Commands',
#package : 'NewTools-Debugger-Commands'
}

{ #category : #accessing }
{ #category : 'accessing' }
StDefineMissingEntityCommand class >> defaultDescription [
^ 'Create the missing class or method in the user prompted class, and restart the debugger at the location where it can be edited.'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDefineMissingEntityCommand class >> defaultIconName [

^ #debuggerDefineEntity
]

{ #category : #accessing }
{ #category : 'accessing' }
StDefineMissingEntityCommand class >> defaultName [
^ 'Create'
]

{ #category : #initialization }
{ #category : 'initialization' }
StDefineMissingEntityCommand class >> defaultShortcut [
^ nil
]

{ #category : #private }
{ #category : 'private' }
StDefineMissingEntityCommand >> applicableCommand [
^ subCommands
detect: [ :subCommand | subCommand canBeExecuted ]
ifNone: [ nil ]
]

{ #category : #testing }
{ #category : 'testing' }
StDefineMissingEntityCommand >> appliesTo: aDebugger [
^ subCommands
anySatisfy: [ :subCommand | subCommand appliesTo: aDebugger ]
]

{ #category : #accessing }
{ #category : 'accessing' }
StDefineMissingEntityCommand >> context: aDebugger [
super context: aDebugger.
subCommands := self class allSubclasses
collect: [ :subCommand | subCommand forContext: aDebugger ]
]

{ #category : #executing }
{ #category : 'executing' }
StDefineMissingEntityCommand >> execute [
self applicableCommand ifNotNil: [ :cmd | cmd execute ]
]

{ #category : #initialization }
{ #category : 'initialization' }
StDefineMissingEntityCommand >> initialize [
super initialize.
subCommands := OrderedCollection new
]

{ #category : #accessing }
{ #category : 'accessing' }
StDefineMissingEntityCommand >> subCommands [
^subCommands
]
Loading

0 comments on commit d134267

Please sign in to comment.