Skip to content

Commit

Permalink
adapted to new action system
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Sep 20, 2024
1 parent 19b878b commit b44c477
Show file tree
Hide file tree
Showing 19 changed files with 136 additions and 82 deletions.
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
10 changes: 5 additions & 5 deletions Iceberg-TipUI/IceCheckoutStrategy.extension.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Extension { #name : 'IceCheckoutStrategy' }

{ #category : '*Iceberg-TipUI' }
IceCheckoutStrategy >> description [

^ self class description
IceCheckoutStrategy class >> description [
^ self subclassResponsibility
]

{ #category : '*Iceberg-TipUI' }
IceCheckoutStrategy class >> description [
^ self subclassResponsibility
IceCheckoutStrategy >> description [

^ self class description
]
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
53 changes: 41 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,24 @@ 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.
self
refreshShortcutsWith: rootGroup;
refreshMainListContextMenuWith: rootGroup
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -134,6 +148,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 +182,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 ].
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 ] ]
]
29 changes: 24 additions & 5 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 @@ -97,7 +110,7 @@ IceTipDiffPanel >> diffEntryRemoved: announcement [
no parent, but it's fine to just leave it there empty--though perhaps we should
close the browser instead in that case?"
[
parent parent notNil and: [
parent parent isNotNil and: [
parent isEmpty and: [
parent value isNoModification or: [
parent value definition isExtensionDefinition ] ] ] ] whileTrue: [
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 beDisplayedAsGroup 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
7 changes: 2 additions & 5 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 Down
7 changes: 2 additions & 5 deletions Iceberg-TipUI/IceTipHiedraAltHistoryBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ Class {

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

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

^ self cleanRootsCommandGroup
]

{ #category : 'commands' }
Expand Down
5 changes: 4 additions & 1 deletion Iceberg-TipUI/IceTipRemoteActionBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ IceTipRemoteActionBrowser >> initializeWindow: aWindow [

super initializeWindow: aWindow.

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

{ #category : 'initialization' }
Expand Down
7 changes: 3 additions & 4 deletions Iceberg-TipUI/IceTipRepairRepositoryDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ IceTipRepairRepositoryDialogPresenter >> initializeDialogWindow: aWindow [
self refreshDialogButtons.

aWindow
bindKeyCombination: Character cr asShortcut toAction: [
selectedOption ifNotNil: [self accept] ]


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

{ #category : 'initialization' }
Expand Down
Loading

0 comments on commit b44c477

Please sign in to comment.