Skip to content

Commit

Permalink
Merge pull request #867 from pharo-spec/p13-actions
Browse files Browse the repository at this point in the history
merge P13 spec actions
  • Loading branch information
estebanlm authored Oct 18, 2024
2 parents cdf6246 + efbd4c7 commit 5ee7f72
Show file tree
Hide file tree
Showing 51 changed files with 548 additions and 353 deletions.
1 change: 1 addition & 0 deletions .smalltalk.all.ston
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SmalltalkCISpec {
'Monticello.*',
'Metacello.*',
'System-Settings-Tests.*',
'System-Dependencies-Tests',
'ReleaseTests.*' ],
#classes : [
#OutOfMemoryTest,
Expand Down
1 change: 1 addition & 0 deletions .smalltalk.release.ston
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SmalltalkCISpec {
#testing : {
#packages : [
'System-Settings-Tests.*',
'System-Dependencies-Tests',
'ReleaseTests.*' ]
}
}
8 changes: 5 additions & 3 deletions src/BaselineOfNewTools/BaselineOfNewTools.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ BaselineOfNewTools >> baseline: spec [
package: 'NewTools-Spotter-Processors-Tests' with: [ spec requires: #( 'NewTools-Spotter-Processors' ) ];
package: 'NewTools-Spotter-Tests' with: [ spec requires: #( 'NewTools-Spotter' ) ];
package: 'NewTools-Morphic-Spotter' with: [ spec requires: #( 'NewTools-Morphic' ) ];
"file browser"
package: 'NewTools-FileBrowser' with: [ spec requires: #( 'NewTools-Core' ) ];
package: 'NewTools-FileBrowser-Morphic' with: [ spec requires: #( 'NewTools-FileBrowser' ) ];
package: 'NewTools-FileBrowser-Tests' with: [ spec requires: #( 'NewTools-FileBrowser' ) ];
"extras"
package: 'HelpCenter' with: [ spec requires: #( 'NewTools-Core' ) ];
package: 'NewTools-FlagBrowser' with: [ spec requires: #( 'NewTools-Core' ) ];
package: 'NewTools-FlagBrowser-Tests' with: [ spec requires: #( 'NewTools-FlagBrowser' ) ];
package: 'NewTools-FileBrowser' with: [ spec requires: #( 'NewTools-Core' ) ];
package: 'NewTools-FileBrowser-Tests' with: [ spec requires: #( 'NewTools-FileBrowser' ) ];
package: 'NewTools-FlagBrowser-Tests' with: [ spec requires: #( 'NewTools-FlagBrowser' ) ];
package: 'NewTools-FontChooser' with: [ spec requires: #( 'NewTools-Core' ) ];
package: 'NewTools-FontChooser-Tests' with: [ spec requires: #( 'NewTools-FontChooser' ) ];
package: 'NewTools-SpTextPresenterDecorators';
Expand Down
30 changes: 14 additions & 16 deletions src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,16 @@ StCritiqueBrowserPresenter >> browseRule [
]

{ #category : 'private' }
StCritiqueBrowserPresenter >> buildRuleMenu [

^ SpMenuPresenter new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Browse rule' translated;
action: [ self browseRule ] ].
group addItem: [ :item |
item
name: 'Reapply this rule' translated;
action: [ self reapplyThisRule ] ] ];
yourself
StCritiqueBrowserPresenter >> buildRuleMenuActions [

^ SpActionGroup new
addActionWith: [ :item | item
name: 'Browse rule' translated;
action: [ self browseRule ] ];
addActionWith: [ :item | item
name: 'Reapply this rule' translated;
action: [ self reapplyThisRule ] ];
yourself
]

{ #category : 'system annoucements' }
Expand Down Expand Up @@ -579,14 +576,15 @@ StCritiqueBrowserPresenter >> setResetButton [

{ #category : 'system annoucements' }
StCritiqueBrowserPresenter >> setRulesModel [
rulesModel children: [ :rule |

rulesModel children: [ :rule |
rule isComposite
ifTrue: [ rule rules asArray ]
ifFalse: [ #( ) ] ].
ifFalse: [ #() ] ].

rulesModel addColumn: ((SpStringTableColumn evaluated: [ :rule |
self stringMorphForRule: rule ]) title: 'Rules Group').
rulesModel contextMenu: self buildRuleMenu.
rulesModel actions: self buildRuleMenuActions
]

{ #category : 'api' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,47 +156,38 @@ StSingleCritiqueResultListPresenter >> browseCritique [
{ #category : 'accessing' }
StSingleCritiqueResultListPresenter >> buildMenuCritique [

^ SpMenuPresenter new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Browse' translated;
action: [ self browseCritique ] ] ];
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Mark as wrong' translated;
visibleIf: [ self isCritiqueFalsePositive not ];
action: [ self addCritiqueToFalsePositive ] ].
group addItem: [ :item |
item
name: 'Unmark as wrong' translated;
visibleIf: [ self isCritiqueFalsePositive ];
action: [ self removeCritiqueToFalsePositive ] ].
group addItem: [ :item |
item
name: 'Unmark as To Do' translated;
visibleIf: [ self isCritiqueToDo ];
action: [ self removeCritiqueToDo ] ].
group addItem: [ :item |
item
name: 'Mark as To Do' translated;
visibleIf: [ self isCritiqueToDo not ];
action: [ self addCritiqueToDo ] ] ];
addGroup: [ :group |
group addItem: [ :item |
item
name: 'View rationale behind the rule' translated;
action: [ self rationaleOfRule ] ].
group addItem: [ :item |
item
name: 'Automatically resolve the issue' translated;
visibleIf: [ critiquesModel selectedItem providesChange ];
action: [ self applyTransformation ] ].
group addItem: [ :item |
item
name: 'Ban this rule' translated;
action: [ self banRule ] ] ];
^ SpActionGroup new
addActionWith: [ :item | item
name: 'Browse' translated;
action: [ self browseCritique ] ];
addGroupWith: [ :group | group
addActionWith: [ :item | item
name: 'Mark as wrong' translated;
actionEnabled: [ self isCritiqueFalsePositive not ];
action: [ self addCritiqueToFalsePositive ] ];
addActionWith: [ :item | item
name: 'Unmark as wrong' translated;
actionEnabled: [ self isCritiqueFalsePositive ];
action: [ self removeCritiqueToFalsePositive ] ];
addActionWith: [ :item | item
name: 'Unmark as To Do' translated;
actionEnabled: [ self isCritiqueToDo ];
action: [ self removeCritiqueToDo ] ];
addActionWith: [ :item | item
name: 'Mark as To Do' translated;
actionEnabled: [ self isCritiqueToDo not ];
action: [ self addCritiqueToDo ] ] ];
addGroupWith: [ :group | group
addActionWith: [ :item | item
name: 'View rationale behind the rule' translated;
action: [ self rationaleOfRule ] ];
addActionWith: [ :item | item
name: 'Automatically resolve the issue' translated;
actionEnabled: [ critiquesModel selectedItem providesChange ];
action: [ self applyTransformation ] ];
addActionWith: [ :item | item
name: 'Ban this rule' translated;
action: [ self banRule ] ] ];
yourself
]

Expand Down Expand Up @@ -308,7 +299,7 @@ StSingleCritiqueResultListPresenter >> initializePresenters [
critiquesModel beMultipleSelection.
critiquesModel display: [ :selec |
self initializeDisplayCritique: selec forRule: rule ].
critiquesModel contextMenu: self buildMenuCritique.
critiquesModel actions: self buildMenuCritique.
critiquesModel displayIcon: [ :item | self iconFor: item ].
self focusOrder
add: critiquesModel;
Expand All @@ -320,8 +311,9 @@ StSingleCritiqueResultListPresenter >> initializePresenters [
StSingleCritiqueResultListPresenter >> initializeShortcuts [

critiquesModel
bindKeyCombination: PharoShortcuts current browseShortcut
toAction: [ self browseCritique ]
addShortcutWith: [ :action | action
shortcutKey: PharoShortcuts current browseShortcut;
action: [ self browseCritique ] ]
]

{ #category : 'private' }
Expand Down
5 changes: 3 additions & 2 deletions src/NewTools-Core/StHeaderPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ StHeaderPanel >> addWindowShortcutsTo: aWindowPresenter [

shortcut ifNil: [ ^ self ].
aWindowPresenter
bindKeyCombination: shortcut
toAction: [ presenter takeKeyboardFocus ]
addShortcutWith: [ :action | action
shortcutKey: shortcut;
action: [ presenter takeKeyboardFocus ] ]
]

{ #category : 'initialization' }
Expand Down
2 changes: 1 addition & 1 deletion src/NewTools-Core/StPharoApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ StPharoApplication >> shutDown: quitting [
{ #category : 'private - running' }
StPharoApplication >> start [


"do nothing"
]

{ #category : 'system startup' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ DebugPointBrowserPresenter >> initializePresenters [
{ #category : 'presenter building' }
DebugPointBrowserPresenter >> initializeTable [

dpTable := DebugPointTablePresenter new.
dpTable := self instantiate: DebugPointTablePresenter.

dpTable whenSelectionChangedDo: [ :sel |
dpEditor debugPoint: dpTable selectedItem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ DebugPointSelectDialogPresenter >> initializePresenters [

label := self newLabel.

list := DebugPointTablePresenter new.
list := self instantiate: DebugPointTablePresenter.
code := DebugPointCodePresenter new
beForScripting;
editable: false.
beForScripting;
editable: false.

self initializeVariableTargetPresenter.

Expand Down
93 changes: 41 additions & 52 deletions src/NewTools-DebugPointsBrowser/DebugPointTablePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,44 @@ Class {
}

{ #category : 'context menu' }
DebugPointTablePresenter >> debugPointContextMenu [
DebugPointTablePresenter >> debugPointActions [

^ self newMenu
addGroup: [ :aGroup |
aGroup
addItem: [ :anItem |
anItem
name: 'Inspect';
description: 'inspect this debug point';
enabled: [ self selectedItem isNotNil ];
action: [ self selectedItem inspect ] ];
addItem: [ :anItem |
anItem
name: 'Browse Target';
description: 'browse target of the selected debug point';
enabled: [ self selectedItem isNotNil ];
action: [ self selectedItem browse ] ];
addItem: [ :anItem |
anItem
name: 'Inspect Current Scope';
description:
'inspect the current scope of the selected debug point';
enabled: [ self selectedItem isNotNil ];
action: [ self selectedItem scope inspect ] ];
addItem: [ :anItem |
anItem
name: 'Reset Current Scope';
description:
'resetting the current scope of the selected debug point';
enabled: [ self selectedItem isNotNil ];
action: [ self selectedItem resetObjectScope ] ];
addItem: [ :anItem |
anItem
name: 'Remove';
description: 'removes the selected debug point';
enabled: [ self selectedItem isNotNil ];
action: [
self selectedItem remove.
self refresh ] ] ];
addGroup: [ :aGroup |
aGroup addItem: [ :anItem |
anItem
name: 'Refresh';
description: 'refresh this window';
action: [ self refresh ] ] ]
^ SpActionGroup new
addActionWith: [ :anItem | anItem
name: 'Inspect';
description: 'inspect this debug point';
actionEnabled: [ self selectedItem isNotNil ];
action: [ self selectedItem inspect ] ];
addActionWith: [ :anItem | anItem
name: 'Browse Target';
description: 'browse target of the selected debug point';
actionEnabled: [ self selectedItem isNotNil ];
action: [ self selectedItem browse ] ];
addActionWith: [ :anItem | anItem
name: 'Inspect Current Scope';
description: 'inspect the current scope of the selected debug point';
actionEnabled: [ self selectedItem isNotNil ];
action: [ self selectedItem scope inspect ] ];
addActionWith: [ :anItem | anItem
name: 'Reset Current Scope';
description: 'resetting the current scope of the selected debug point';
actionEnabled: [ self selectedItem isNotNil ];
action: [ self selectedItem resetObjectScope ] ];
addActionWith: [ :anItem | anItem
name: 'Remove';
description: 'removes the selected debug point';
actionEnabled: [ self selectedItem isNotNil ];
action: [
self selectedItem remove.
self refresh ] ];
addGroupWith: [ :aGroup | aGroup
addActionWith: [ :anItem | anItem
name: 'Refresh';
description: 'refresh this window';
action: [ self refresh ] ] ]
]

{ #category : 'initialization' }
DebugPointTablePresenter >> initialize [
super initialize.
self initializeDebugPointTable
]

{ #category : 'presenter building' }
DebugPointTablePresenter >> initializeDebugPointTable [

self beResizable.
Expand Down Expand Up @@ -95,10 +79,9 @@ DebugPointTablePresenter >> initializeDebugPointTable [
addColumn: (SpStringTableColumn
title: 'Scope'
evaluated: [ :item | item scopeString ]);
contextMenu: self debugPointContextMenu.
actions: self debugPointActions.
self items: DebugPoint all asOrderedCollection.


self dropEnabled: true.
self dragEnabled: true.
self wantsDrop: [ :item |
Expand All @@ -109,3 +92,9 @@ DebugPointTablePresenter >> initializeDebugPointTable [
((self itemAt: item row) getBehavior: ChainBehavior) putChild:
item passenger first ]
]

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

self initializeDebugPointTable
]
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ StObjectBreakpointInspection >> buildHaltAndBreakpointTable [
addColumn:
((SpStringTableColumn
title: 'Scope'
evaluated: [ :item | item printScope])
evaluated: [ :item | item printScope ])
width: 120;
yourself);
addColumn:
(SpStringTableColumn
title: 'Target'
evaluated: [ :item | item printEntity]).
evaluated: [ :item | item printEntity ]).
methodsWithBreakpoints
contextMenu: self rootCommandsGroup asMenuPresenter
actions: self rootCommandsGroup
]

{ #category : 'private' }
Expand Down
1 change: 0 additions & 1 deletion src/NewTools-Debugger-Tests/StDebuggerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ StDebuggerTest >> testClose [
debugger := self debuggerOn: session.
actionModel := debugger debuggerActionModel.
windowPresenter presenter: debugger.
debugger initializeWindow: windowPresenter.

"We trigger the closing from the presenter instead of the debugger itself,
because the window is not really open so the debugger will not close through debugger close."
Expand Down
1 change: 1 addition & 0 deletions src/NewTools-Debugger/SpCodePresenter.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ Extension { #name : 'SpCodePresenter' }

{ #category : '*NewTools-Debugger' }
SpCodePresenter >> beForContext: aContext [

self interactionModel: (StDebuggerContextInteractionModel on: aContext)
]
Loading

0 comments on commit 5ee7f72

Please sign in to comment.