Skip to content

Commit

Permalink
Merge 5c0cc85
Browse files Browse the repository at this point in the history
  • Loading branch information
adri09070 committed Aug 2, 2023
2 parents 94b3564 + 5c0cc85 commit 72c6654
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 68 deletions.
3 changes: 2 additions & 1 deletion src/Chest-Commands-Tests/ChestCommandTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ ChestCommandTest >> tearDown [
"Removing chests that currently exist but did not exist before the test execution"
nowChests do: [ :aChest |
(initialChests includes: aChest) ifFalse: [
Chest removeChest: aChest ] ]
Chest removeChest: aChest ] ].
super tearDown
]
6 changes: 0 additions & 6 deletions src/Chest-Commands/ChestCopyObjectCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ ChestCopyObjectCommand class >> defaultName [
^ 'Copy object in a clipboard chest'
]

{ #category : #defaults }
ChestCopyObjectCommand class >> defaultShortcutKey [

^ $c meta shift
]

{ #category : #executing }
ChestCopyObjectCommand >> execute [

Expand Down
6 changes: 0 additions & 6 deletions src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ ChestLoadObjectIntoCodeCommand class >> defaultName [
^ 'Load object from chest'
]

{ #category : #default }
ChestLoadObjectIntoCodeCommand class >> defaultShortcutKey [

^ $c meta , $l meta
]

{ #category : #testing }
ChestLoadObjectIntoCodeCommand class >> isVisibleForContext: aCodePresenter [

Expand Down
6 changes: 0 additions & 6 deletions src/Chest-Commands/ChestRemoveAllChestsCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ ChestRemoveAllChestsCommand class >> defaultName [
^ 'Remove all chests'
]

{ #category : #default }
ChestRemoveAllChestsCommand class >> defaultShortcutKey [

^ $c meta , $r meta , $m meta shift
]

{ #category : #executing }
ChestRemoveAllChestsCommand >> execute [

Expand Down
6 changes: 0 additions & 6 deletions src/Chest-Commands/ChestRemoveChestCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ ChestRemoveChestCommand class >> defaultName [
^ 'Remove chest'
]

{ #category : #default }
ChestRemoveChestCommand class >> defaultShortcutKey [

^ $c meta , $r meta , $m meta
]

{ #category : #testing }
ChestRemoveChestCommand >> canBeExecuted [

Expand Down
40 changes: 24 additions & 16 deletions src/Chest-Commands/ChestStoreObjectCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,35 @@ ChestStoreObjectCommand class >> defaultName [
^ 'Store object in a chest'
]

{ #category : #'accessing - defaults' }
ChestStoreObjectCommand class >> defaultShortcutKey [

^ $c meta , $s meta
]

{ #category : #initialization }
ChestStoreObjectCommand >> buildChoicePresenter [

| choicePresenter |
choicePresenter := ChestTableWithContentPresenter new.
choicePresenter confirmButton action: [
| chest objectName |
choicePresenter confirmButton action: [
| chest objectName selectorToSendToSelection |
chest := choicePresenter chestsTable selectedItem.
objectName := choicePresenter inputField text.
[
selectorToSendToSelection := #yourself.
choicePresenter buttonShallowCopy state ifTrue: [
selectorToSendToSelection := #shallowCopy ].
choicePresenter buttonDeepCopy state ifTrue: [
selectorToSendToSelection := #copy ].
[
self
storeSelectionInChest: chest
withName: objectName
withSelector: selectorToSendToSelection
replacing: false ]
on: ChestKeyAlreadyInUseError
do: [
do: [
((choicePresenter confirm:
(choicePresenter warningNamingObjectInChest: objectName))
onAccept: [
(choicePresenter warningNamingObjectInChest: objectName))
onAccept: [
self
storeSelectionInChest: chest
withName: objectName
withSelector: selectorToSendToSelection
replacing: true ]) openDialogWithParent:
choicePresenter chestContentTable ].
choicePresenter window close ].
Expand Down Expand Up @@ -92,9 +93,16 @@ ChestStoreObjectCommand >> storeResult: result intoChest: chest withName: object
]

{ #category : #execution }
ChestStoreObjectCommand >> storeSelectionInChest: aChest withName: objectName replacing: replacingBoolean [
ChestStoreObjectCommand >> storeSelectionInChest: aChest withName: objectName withSelector: selectorSentToSelectionBeforeStoring replacing: replacingBoolean [

self evaluateSelectionAndDo: [ :result |
self storeResult: result intoChest: aChest withName: objectName replacing: replacingBoolean
]
self evaluateSelectionAndDo: [ :result |
| storedResult |
storedResult := result
perform: selectorSentToSelectionBeforeStoring
withArguments: #( ).
self
storeResult: storedResult
intoChest: aChest
withName: objectName
replacing: replacingBoolean ]
]
52 changes: 47 additions & 5 deletions src/Chest/ChestTableWithContentPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ Class {
'activePresenter',
'chestWithContentTreeTableToolbar',
'chestTableToolbarCommandGroup',
'chestContentsTableToolbarCommandGroup'
'chestContentsTableToolbarCommandGroup',
'buttonNoCopy',
'buttonShallowCopy',
'buttonDeepCopy'
],
#category : #Chest
}
Expand Down Expand Up @@ -190,6 +193,24 @@ ChestTableWithContentPresenter >> activePresenter [
^ activePresenter
]

{ #category : #accessing }
ChestTableWithContentPresenter >> buttonDeepCopy [

^ buttonDeepCopy
]

{ #category : #accessing }
ChestTableWithContentPresenter >> buttonNoCopy [

^ buttonNoCopy
]

{ #category : #accessing }
ChestTableWithContentPresenter >> buttonShallowCopy [

^ buttonShallowCopy
]

{ #category : #accessing }
ChestTableWithContentPresenter >> cancelButton [

Expand Down Expand Up @@ -310,11 +331,9 @@ ChestTableWithContentPresenter >> debuggerLayout [
yourself
]

{ #category : #updating }
{ #category : #layout }
ChestTableWithContentPresenter >> defaultLayout [

self makeChestContentsTable.

chestTableContainer
removeAll;
add: (self
Expand Down Expand Up @@ -399,7 +418,7 @@ ChestTableWithContentPresenter >> initializePresenters [
chestContentTableContainer := SpBoxLayout newVertical
add: self chestContentTable;
yourself.
chestsTable selectIndex: 1.
chestTableWithContentContainer := SpPanedLayout newHorizontal
add: chestTableContainer;
add: chestContentTableContainer;
Expand All @@ -414,6 +433,8 @@ ChestTableWithContentPresenter >> initializePresenters [
chestContentsTableToolbar := self makeChestContentsTableToolbar.

chestWithContentTreeTableToolbar := self makeChestTreeTableToolbar.

self makeCopyRadioButtons.

self layout: self defaultLayout
]
Expand Down Expand Up @@ -641,6 +662,22 @@ ChestTableWithContentPresenter >> makeConfirmActionBar [
yourself
]

{ #category : #'presenter building' }
ChestTableWithContentPresenter >> makeCopyRadioButtons [

buttonNoCopy := self newRadioButton.
buttonShallowCopy := self newRadioButton.
buttonDeepCopy := self newRadioButton.

buttonNoCopy associatedRadioButtons: {
buttonShallowCopy.
buttonDeepCopy }.

buttonNoCopy label: 'No copy'.
buttonShallowCopy label: 'Shallow copy'.
buttonDeepCopy label: 'Deep copy'
]

{ #category : #'presenter building' }
ChestTableWithContentPresenter >> makeInputField [

Expand Down Expand Up @@ -918,6 +955,11 @@ ChestTableWithContentPresenter >> storeCommandLayout [
add: chestsTableToolbar;
add: chestContentsTableToolbar;
yourself) expand: false;
add: (SpBoxLayout newHorizontal
add: buttonNoCopy;
add: buttonShallowCopy;
add: buttonDeepCopy;
yourself);
add: confirmActionBar expand: false;
yourself
]
Expand Down
19 changes: 0 additions & 19 deletions src/Chest/TChestAssociation.extension.st

This file was deleted.

6 changes: 3 additions & 3 deletions src/Chest/TChestAssociation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ TChestAssociation classSide >> key: key value: value variableName: variableName
variableName: variableName
]

{ #category : #'*Chest' }
{ #category : #accessing }
TChestAssociation >> chestChildren [

^ { } asOrderedCollection
]

{ #category : #'*Chest' }
{ #category : #accessing }
TChestAssociation >> chestEvaluation [

^ self value
]

{ #category : #'*Chest' }
{ #category : #accessing }
TChestAssociation >> chestName [

^ self key
Expand Down

0 comments on commit 72c6654

Please sign in to comment.