Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3c2646f
Refactor script repository system to support project-specific reposit…
FlavienVolant Jun 13, 2025
6dfbf74
Refactor repository selection into dedicated chooser presenter
FlavienVolant Jun 13, 2025
a70ac09
Improves clarity by distinguishing between repository selection and s…
FlavienVolant Jun 13, 2025
6b90381
move acces to save / load script from the scriptChooser to the script…
FlavienVolant Jun 13, 2025
6af3761
rename initializeScriptRepository to initializeScriptChooser
FlavienVolant Jun 14, 2025
2e9b4f0
Add StSindarinDebuggerCreateCommandPresenter for command creation UI
FlavienVolant Jun 16, 2025
a141b00
- createCommand create the class without any methods (todo)
FlavienVolant Jun 18, 2025
2519c19
temporary remove sindarin :=
FlavienVolant Jun 18, 2025
705b92b
- SindarinCommand remove Override of context:
FlavienVolant Jun 20, 2025
fda3b19
- createCommand method calls createMenu to automatically create the d…
FlavienVolant Jun 20, 2025
902ce24
- fix command name
FlavienVolant Jun 20, 2025
8204465
Update src/NewTools-Sindarin-Tools/StSindarinDebuggerCreateCommandPre…
FlavienVolant Jun 23, 2025
eff3507
- Added `deleteCommand` and `deleteMenu` methods to `StSindarinDebugg…
FlavienVolant Jul 3, 2025
a3e5343
Include project name in generated command class names
FlavienVolant Jul 3, 2025
a708748
format methods using cmd/ctrl + shift + f
FlavienVolant Jul 3, 2025
340a709
Add documentation to script repository and dynamically generated comm…
FlavienVolant Jul 3, 2025
83ff81a
- expand toolbar layout
FlavienVolant Jul 8, 2025
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
1 change: 1 addition & 0 deletions src/BaselineOfNewTools/BaselineOfNewTools.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ BaselineOfNewTools >> baseline: spec [
package: 'NewTools-Sindarin-Commands';
package: 'NewTools-Sindarin-Commands-Tests' with: [ spec requires: #( 'NewTools-Sindarin-Commands' 'Sindarin' ) ];
package: 'NewTools-Sindarin-Tools' with: [ spec requires: #( 'NewTools-Sindarin-Commands' 'Sindarin' ) ];
package: 'NewTools-Sindarin-Scripts' with: [ spec requires: #( 'NewTools-Sindarin-Commands' 'Sindarin' ) ];

"package: 'NewTools-Sindarin-ProcessInspector' with: [ spec requires: #('NewTools-Sindarin-Commands' 'Sindarin') ];""Debugger Selector"
package: 'NewTools-DebuggerSelector' with: [ spec requires: #( 'NewTools-SpTextPresenterDecorators' ) ];
Expand Down
2 changes: 1 addition & 1 deletion src/NewTools-Debugger/StDebugger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ StDebugger >> buildToolbar [
hAlignStart;
vAlignCenter;
yourself)
expand: false;
expand: true;
yourself)
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Class {
#name : 'SindarinDefaultScriptRepository',
#superclass : 'StSindarinDebuggerScriptRepository',
#category : 'NewTools-Sindarin-Scripts',
#package : 'NewTools-Sindarin-Scripts'
}

{ #category : 'accessing' }
SindarinDefaultScriptRepository class >> repositoryName [
"Return the name of the repository."
^ 'Scripts'
]
1 change: 1 addition & 0 deletions src/NewTools-Sindarin-Scripts/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : 'NewTools-Sindarin-Scripts' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
Class {
#name : 'StSindarinDebuggerCommandPresenter',
#superclass : 'SpPresenterWithModel',
#instVars : [
'descriptionInput',
'cancelButton',
'createButton',
'package',
'iconList',
'iconNameSelected',
'commandName',
'code',
'projectName'
],
#category : 'NewTools-Sindarin-Tools-Presenters',
#package : 'NewTools-Sindarin-Tools',
#tag : 'Presenters'
}

{ #category : 'accessing' }
StSindarinDebuggerCommandPresenter >> code: aCode [

code := aCode
]

{ #category : 'accessing' }
StSindarinDebuggerCommandPresenter >> commandName: aName [

commandName := aName asCamelCase
]

{ #category : 'initialization' }
StSindarinDebuggerCommandPresenter >> connectPresenters [

iconList transmitTo: self
]

{ #category : 'layout' }
StSindarinDebuggerCommandPresenter >> defaultLayout [

| buttonRow |
buttonRow := SpBoxLayout newLeftToRight
spacing: 6;
add: createButton;
add: cancelButton;
yourself.

^ SpBoxLayout newTopToBottom
spacing: 5;
add: descriptionInput expand: false;
add: iconList;
add: buttonRow expand: false;
yourself
]

{ #category : 'actions' }
StSindarinDebuggerCommandPresenter >> deleteCommand [

| name className commandsLeft |
name := commandName ifNil: [ 'NoName' ].
className := 'Sindarin{1}{2}Command' format: {
projectName asCamelCase.
name asCamelCase }.

(Smalltalk globals includesKey: className asSymbol) ifTrue: [
(Smalltalk globals at: className asSymbol) removeFromSystem ].

commandsLeft := SindarinCommand subclasses select: [ :sub |
sub packageName = package ].
commandsLeft isEmpty ifTrue: [ self deleteMenu ]
]

{ #category : 'actions' }
StSindarinDebuggerCommandPresenter >> deleteMenu [

| buildGroupMethodName |
buildGroupMethodName := 'buildSindarin{1}ExtentionCommandsGroupWith:forRoot:'
format: { projectName asCamelCase }.

(StDebugger class includesSelector: buildGroupMethodName asSymbol)
ifTrue: [
StDebugger class removeSelector: buildGroupMethodName asSymbol ]
]

{ #category : 'actions' }
StSindarinDebuggerCommandPresenter >> generateCommand [

| name className description class |
name := commandName ifNil: [ 'NoName' ].
className := 'Sindarin{1}{2}Command' format: {
projectName asCamelCase.
name asCamelCase }.
description := descriptionInput text ifNil: [ '' ].

class := (SindarinCommand << className)
package: package;
build;
install.

class
compile: ('execute
|sindarin|
sindarin := self context sindarinDebugger.
self context debuggerActionModel preventUpdatesDuring: [
{1}
]' format: { code })
classified: 'executing'.

class class
compile: ('defaultIconName
^#{1}' format: { iconNameSelected })
classified: 'initialization'.

class class
compile: ('defaultDescription
^ ''{1}''' format: { description })
classified: 'initialization'.

class class
compile: ('defaultName
^ ''{1}''' format: { name })
classified: 'initialization'.

class comment:
('This command was generated dynamically on {1} at {2}.
Project: {3}
Name: {4}
Description: {5}' format: {
Date today yyyymmdd.
Time now print24.
projectName.
name.
description }).

self generateMenu
]

{ #category : 'actions' }
StSindarinDebuggerCommandPresenter >> generateMenu [

StDebugger class
compile:
('buildSindarin{2}ExtentionCommandsGroupWith: stDebuggerInstance forRoot: rootCommandGroup
<extensionCommands>
| commands toolbarCommandGroup |
commands := (SindarinCommand subclasses select: [ :sub | sub packageName = ''{3}'']) collect: [ :each | each forSpecContext: stDebuggerInstance ].

toolbarCommandGroup := CmCommandGroup forSpec
beToolbarPopoverButton;
name: ''{1}'';
icon: (stDebuggerInstance application iconNamed: #changeUpdate);
yourself.

(self debuggerToolbarCommandGroupFor: rootCommandGroup) register: toolbarCommandGroup.

commands do: [ :command | toolbarCommandGroup register: command ].'
format: {
projectName.
projectName asCamelCase.
package })
classified: '*' , package
]

{ #category : 'initialization' }
StSindarinDebuggerCommandPresenter >> initializeIconList [

| icons |
icons := ThemeIcons loadDefault.
iconList
items: icons allIconNames;
display: [ :elm | ThemeIcons iconNamed: elm ]
]

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

descriptionInput := self newTextInput.
descriptionInput placeholder: 'Command description'.

iconList := self newList.
self initializeIconList.

createButton := self newButton.
createButton label: 'Create'.

cancelButton := self newButton.
cancelButton label: 'Cancel'
]

{ #category : 'accessing' }
StSindarinDebuggerCommandPresenter >> package: aPackageName [

package := aPackageName
]

{ #category : 'accessing' }
StSindarinDebuggerCommandPresenter >> projectName: aName [

projectName := aName
]

{ #category : 'transmission' }
StSindarinDebuggerCommandPresenter >> setModel: aIconName [

iconNameSelected := aIconName
]

{ #category : 'enumerating' }
StSindarinDebuggerCommandPresenter >> whenCancelDo: aBlock [

cancelButton action: aBlock
]

{ #category : 'enumerating' }
StSindarinDebuggerCommandPresenter >> whenCreateDo: aBlock [

createButton action: aBlock
]
59 changes: 33 additions & 26 deletions src/NewTools-Sindarin-Tools/StSindarinDebuggerPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,41 @@ StSindarinDebuggerPresenter class >> defaultLayout [

{ #category : 'initialization' }
StSindarinDebuggerPresenter >> buildToolbar [

| group |
group := CmCommandGroup forSpec.
(SindarinCommand allSubclasses reject:#isAbstract )
do: [ :cmd | group register: (cmd forSpecContext: self) ].
^ self newToolbar
displayMode: self application toolbarDisplayMode;
addStyle: 'stToolbar';
fillWith: group
(SindarinCommand allSubclasses reject: #isAbstract) do: [ :cmd |
group register: (cmd forSpecContext: self) ].
^ self newToolbar
displayMode: self application toolbarDisplayMode;
addStyle: 'stToolbar';
fillWith: group
]

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

stack := self newList.
stack
whenSelectionChangedDo: [ :selection |
stack whenSelectionChangedDo: [ :selection |
selection selectedItem
ifNil: [ inspector model: nil.
currentNodeSource text: '' ]
ifNotNil: [ | node |
node := selection selectedItem sourceNodeExecuted.
inspector model: node.
inspector setAttributeTable.
currentNodeSource text: node source.
currentNodeSource beForBehavior: node methodNode methodClass.
currentNodeSource selectionInterval: (node start to: node stop).
currentNodeSource
doItReceiver: selection selectedItem home receiver;
doItContext: selection selectedItem ]].
ifNil: [
inspector model: nil.
currentNodeSource text: '' ]
ifNotNil: [
| node |
node := selection selectedItem sourceNodeExecuted.
inspector model: node.
inspector setAttributeTable.
currentNodeSource text: node source.
currentNodeSource beForBehavior: node methodNode methodClass.
currentNodeSource selectionInterval: (node start to: node stop).
currentNodeSource
doItReceiver: selection selectedItem home receiver;
doItContext: selection selectedItem ] ].
inspector := StRawInspectionPresenter on: self model stack first.
currentNodeSource := self newCode.
currentNodeSource
whenBuiltDo: [ :ann | ann widget font: StandardFonts codeFont ].
currentNodeSource whenBuiltDo: [ :ann |
ann widget font: StandardFonts codeFont ].
currentNodeSource withSyntaxHighlight.
currentNodeSource text: self model node source.
currentNodeSource beForBehavior: self model method methodClass.
Expand All @@ -72,24 +75,28 @@ StSindarinDebuggerPresenter >> initializePresenters [
]

{ #category : 'stepping' }
StSindarinDebuggerPresenter >> refresh [
StSindarinDebuggerPresenter >> refresh [

stack items: self model stack.
stack selectIndex: 1
]

{ #category : 'stepping' }
StSindarinDebuggerPresenter >> stepIn [
StSindarinDebuggerPresenter >> stepIn [

self model step.
self refresh
]

{ #category : 'stepping' }
StSindarinDebuggerPresenter >> stepOver [
StSindarinDebuggerPresenter >> stepOver [

self model stepOver.
self refresh
]

{ #category : 'stepping' }
StSindarinDebuggerPresenter >> windowTitle [
^'Sindarin Debugger'

^ 'Sindarin Debugger'
]
Loading
Loading