Skip to content

Commit

Permalink
Merge pull request #1849 from pharo-vcs/p13-actions
Browse files Browse the repository at this point in the history
merge P13 spec actions
  • Loading branch information
estebanlm authored Oct 21, 2024
2 parents 275dd6c + a71d27b commit 4e71a37
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ IceGitHubPullRequestDetailModel >> newChecksTable [
evaluated: [ :aStatus | aStatus at: 'description' ];
yourself);
beResizable;
contextMenu: [ (self rootCommandsGroup / 'checks commands') beRoot asMenuPresenter ]
actions: (self rootCommandsGroup / 'checks commands')
]

{ #category : 'accessing' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ IceGitHubTipPullRequestBrowser >> commits [
IceGitHubTipPullRequestBrowser >> connectPresenters [

super connectPresenters.

self commits whenSelectionChangedDo: [ :selection |
self diff selectedModel: selection selectedItem ].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ IceTipGitHubPullRequestListBrowser class >> taskbarIconName [
IceTipGitHubPullRequestListBrowser >> connectPresenters [

super connectPresenters.

self pullRequests
activateOnDoubleClick;
whenActivatedDo: [ :selection | self strongSelection: selection ];
Expand Down
17 changes: 9 additions & 8 deletions Iceberg-Plugin-Metacello/IceTipRepositoriesBrowser.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ Extension { #name : 'IceTipRepositoriesBrowser' }

{ #category : '*Iceberg-Plugin-Metacello' }
IceTipRepositoriesBrowser class >> metacelloCommandsWith: presenter forRootGroup: aCommandGroup [

<extensionCommands>
| newGroup |
newGroup := CmCommandGroup forSpec

newGroup := SpDynamicActionGroup new
name: 'Metacello';
description: 'Metacello install operations';
with: [ :aGroup |
presenter selectedItem ifNotNil: [
IceTipMetacelloInstallCommandBuilder new
addCommandsFor: presenter selectedItem
intoGroup: aGroup
context: presenter ] ];
yourself.

(aCommandGroup commandOrGroupNamed: 'Selection') register: newGroup.

presenter selectedItem ifNotNil: [
IceTipMetacelloInstallCommandBuilder new
addCommandsFor: presenter selectedItem intoGroup: newGroup context: presenter ]

(aCommandGroup commandOrGroupNamed: 'Selection') register: newGroup
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Extension { #name : 'IceTipWorkingCopyBrowser' }
IceTipWorkingCopyBrowser class >> metacelloCommandsWith: presenter forRootGroup: aCommandGroup [
<extensionCommands>
| newGroup |

newGroup := CmCommandGroup forSpec
name: 'Metacello';
description: 'Metacello install operations';
Expand Down
4 changes: 2 additions & 2 deletions Iceberg-TipUI/IceTipAddNewPackagesDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ IceTipAddNewPackagesDialogPresenter >> initializePackagesList [
beNotExpandable;
yourself);
addColumn: (SpStringTableColumn new
evaluated: [:e | e name];
evaluated: [ :each | each name ];
yourself));
contextMenu: [ (self rootCommandsGroup / 'package list commands') beRoot asMenuPresenter ]
actions: self rootCommandsGroup / 'package list commands'
]

{ #category : 'initialization' }
Expand Down
54 changes: 42 additions & 12 deletions Iceberg-TipUI/IceTipBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ IceTipBrowser class >> buildSelectionExtraCommandGroupWith: presenter for: aComm
{ #category : 'commands' }
IceTipBrowser class >> generalCommandGroupName [

^ 'General'
^ 'Actions'
]

{ #category : 'commands' }
Expand All @@ -81,10 +81,25 @@ IceTipBrowser class >> selectionExtraCommandGroupName [
^ 'Extra'
]

{ #category : 'initialization' }
IceTipBrowser >> cleanRootsCommandGroup [
| rootGroup |

rootGroup := self rootCommandsGroup.
IceTipCleanCommandGroupVisitor new visit: rootGroup.
^ rootGroup

]

{ #category : 'initialization' }
IceTipBrowser >> connectPresenters [
| rootGroup |

self mainList whenSelectionChangedDo: [ self refreshCommands ]
"rootGroup := self cleanRootsCommandGroup."
rootGroup := self rootCommandsGroup.
self
refreshShortcutsWith: rootGroup;
refreshMainListContextMenuWith: rootGroup
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -134,6 +149,21 @@ IceTipBrowser >> mainList [
^ self subclassResponsibility
]

{ #category : 'accessing - ui' }
IceTipBrowser >> mainListActions: anActionGroup [

self mainListDefaultActions
ifNotNil: [ :defaultActionsGroup | anActionGroup add: defaultActionsGroup ].

self mainList actions: anActionGroup
]

{ #category : 'private' }
IceTipBrowser >> mainListDefaultActions [

^ nil
]

{ #category : 'accessing' }
IceTipBrowser >> model [

Expand All @@ -153,26 +183,26 @@ IceTipBrowser >> refresh [

{ #category : 'commands' }
IceTipBrowser >> refreshCommands [
| rootGroup |

rootGroup := self rootCommandsGroup.
IceTipCleanCommandGroupVisitor new visit: rootGroup.

self
refreshShortcutsWith: rootGroup;
refreshMainListContextMenuWith: rootGroup;
refreshToolbarWith: rootGroup.

self refreshToolbarWith: self cleanRootsCommandGroup
]

{ #category : 'commands' }
IceTipBrowser >> refreshMainListContextMenuWith: rootGroup [
"Update context menu (for mainList)."
| actionGroup |

actionGroup := SpActionGroup new.
rootGroup
commandOrGroupNamed: self class selectionCommandGroupName
ifFound: [ :subgroup |
self mainList contextMenuFromCommandsGroup: subgroup ].
actionGroup add: subgroup beDisplayedAsGroup beRoot ].
rootGroup
commandOrGroupNamed: self class generalCommandGroupName
ifFound: [ :subgroup |
actionGroup add: subgroup beDisplayedAsSubMenu ].

self mainListActions: actionGroup
]

{ #category : 'commands' }
Expand Down
10 changes: 8 additions & 2 deletions Iceberg-TipUI/IceTipCherrypickPreviewBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ IceTipCherrypickPreviewBrowser >> initialExtentForWindow [
{ #category : 'initialization' }
IceTipCherrypickPreviewBrowser >> initializePresenters [

diffPanel := self
instantiate: (IceTipMergeSelectingPanel onDiff: self model diff).
diffPanel := self instantiate: (IceTipMergeSelectingPanel onDiff: self model diff).
buttonBar := self newButtonBar.
buttonBar add: self newActionButton.

Expand All @@ -85,6 +84,13 @@ IceTipCherrypickPreviewBrowser >> mainList [
^ diffPanel iceNodesTree
]

{ #category : 'accessing - ui' }
IceTipCherrypickPreviewBrowser >> mainListActions: anActionGroup [
"Answer the presenter that is the main list of items of this browser."

^ diffPanel mainListActions: anActionGroup
]

{ #category : 'accessing' }
IceTipCherrypickPreviewBrowser >> mergeType: anObject [

Expand Down
25 changes: 18 additions & 7 deletions Iceberg-TipUI/IceTipCommitBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,14 @@ IceTipCommitBrowser >> initialize [
IceTipCommitBrowser >> initializeAcceptShortcut [

self
bindKeyCombination: $s meta
toAction: [ self accept ].
addShortcutWith: [ :action | action
shortcutKey: $s actionModifier;
action: [ self accept ] ].

commentPanel commentText
bindKeyCombination: $s meta
toAction: [ self accept ].

addShortcutWith: [ :action | action
shortcutKey: $s actionModifier;
action: [ self accept ] ]
]

{ #category : 'initialization' }
Expand All @@ -185,8 +186,11 @@ IceTipCommitBrowser >> initializePresenters [
{ #category : 'initialization' }
IceTipCommitBrowser >> initializeWindow: aWindow [

super initializeWindow: aWindow.
aWindow bindKeyCombination: $s meta toAction: [ self accept ]
super initializeWindow: aWindow.
aWindow addShortcutWith: [ :action | action
shortcutKey: $s actionModifier;
action: [ self accept ] ].

]

{ #category : 'accessing - ui' }
Expand All @@ -196,6 +200,13 @@ IceTipCommitBrowser >> mainList [
^ diffPanel iceNodesTree
]

{ #category : 'accessing - ui' }
IceTipCommitBrowser >> mainListActions: anActionGroup [
"Answer the presenter that is the main list of items of this browser."

^ diffPanel treeActions: anActionGroup
]

{ #category : 'accessing' }
IceTipCommitBrowser >> refresh [

Expand Down
5 changes: 3 additions & 2 deletions Iceberg-TipUI/IceTipCritiquesBeforeCommitBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ IceTipCritiquesBeforeCommitBrowser >> initializeDialogWindow: aWindow [
aWindow buttons third label: 'Commit'.

aWindow
bindKeyCombination: Character cr asShortcut toAction: [ self accept].

addShortcutWith: [ :action | action
shortcutKey: KeyboardKey enter asKeyCombination;
action: [ self accept ] ]
]

{ #category : 'initialization' }
Expand Down
4 changes: 3 additions & 1 deletion Iceberg-TipUI/IceTipDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ IceTipDialogPresenter >> initializeDialogWindow: aWindow [
aWindow
okAction: [ self accept ];
cancelAction: [ self cancel ];
bindKeyCombination: Character escape asShortcut toAction: [ self cancel ]
addShortcutWith: [ :action | action
shortcutKey: KeyboardKey escape asKeyCombination;
action: [ self cancel ] ]
]
27 changes: 23 additions & 4 deletions Iceberg-TipUI/IceTipDiffPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ IceTipDiffPanel class >> onDiff: aDiff [
^ self on: (IceTipCommitDiffModel on: aDiff)
]

{ #category : 'initialization' }
IceTipDiffPanel >> baseTreeActions [

^ SpActionGroup new
addShortcutWith: [ :action | action
shortcutKey: KeyboardKey left asKeyCombination;
action: [ self handleArrowLeft ] ];
addShortcutWith: [ :action | action
shortcutKey: KeyboardKey right asKeyCombination;
action: [ self handleArrowRight ] ];
yourself
]

{ #category : 'accessing' }
IceTipDiffPanel >> basicRefresh [

Expand Down Expand Up @@ -182,10 +195,7 @@ IceTipDiffPanel >> initializeTree [
addColumn: self changeListColumn;
children: [ :each | each children ];
whenSelectionChangedDo: [ self selectionChanged ];
bindKeyCombination: Character arrowLeft asKeyCombination
toAction: [ self handleArrowLeft ];
bindKeyCombination: Character arrowRight asKeyCombination
toAction: [ self handleArrowRight ].
actions: self baseTreeActions
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -258,6 +268,15 @@ IceTipDiffPanel >> titleForWindow [
^ 'Diff'
]

{ #category : 'accessing - ui' }
IceTipDiffPanel >> treeActions: anActionGroup [

iceNodesTree actions: (SpActionGroup new
add: anActionGroup beRoot;
add: self baseTreeActions beRoot;
yourself)
]

{ #category : 'initialization' }
IceTipDiffPanel >> updatePresenter [

Expand Down
19 changes: 10 additions & 9 deletions Iceberg-TipUI/IceTipDiffSelectingPanel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ IceTipDiffSelectingPanel >> activateItem: iceNode [

]

{ #category : 'initialization' }
IceTipDiffSelectingPanel >> baseTreeActions [

^ super baseTreeActions
addShortcutWith: [ :action | action
shortcutKey: Character space asKeyCombination;
action: [ self toggleActivationItem: iceNodesTree selectedItem ] ];
yourself
]

{ #category : 'initialization' }
IceTipDiffSelectingPanel >> changeListColumn [

Expand Down Expand Up @@ -74,15 +84,6 @@ IceTipDiffSelectingPanel >> initialize [

]

{ #category : 'initialization' }
IceTipDiffSelectingPanel >> initializeTree [

super initializeTree.
iceNodesTree
bindKeyCombination: Character space asKeyCombination
toAction: [ self toggleActivationItem: iceNodesTree selectedItem ]
]

{ #category : 'accessing' }
IceTipDiffSelectingPanel >> refresh [

Expand Down
11 changes: 4 additions & 7 deletions Iceberg-TipUI/IceTipHiedraAltComponentHistoryBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ Class {

{ #category : 'commands' }
IceTipHiedraAltComponentHistoryBrowser >> availableCommands [
| rootGroup |

rootGroup := self rootCommandsGroup.
IceTipCleanCommandGroupVisitor new visit: rootGroup.
^ rootGroup

^ self cleanRootsCommandGroup
]

{ #category : 'commands' }
Expand All @@ -24,7 +21,7 @@ IceTipHiedraAltComponentHistoryBrowser >> contextMenuCommands [
self availableCommands
commandOrGroupNamed: self class selectionCommandGroupName
ifFound: [ :subgroup |
^ subgroup beRoot asMenuPresenter ].
^ subgroup beRoot ].

self error: 'Should not arrive here'
]
Expand Down Expand Up @@ -68,7 +65,7 @@ IceTipHiedraAltComponentHistoryBrowser >> initializeHiedraColumn [
IceTipHiedraAltComponentHistoryBrowser >> initializePresenters [

commitList := self newComponentList.
commitList contextMenu: [ self contextMenuCommands ].
commitList actions: self contextMenuCommands.

commitInfoTabs := self instantiate: IceTipCommitInfoPresenter.

Expand Down
Loading

0 comments on commit 4e71a37

Please sign in to comment.