From bdf102189f63a0d6d3bf0b75b60ba8c6623a71cb Mon Sep 17 00:00:00 2001 From: "adrien.vanegue.etu" Date: Wed, 24 Apr 2024 16:11:15 +0200 Subject: [PATCH 1/4] implementing a clipboard chest with a maximum size --- .../ChestAddNewChestCommand.class.st | 15 +- .../ChestAddNewItemCommand.class.st | 17 +- src/Chest-Commands/ChestCommand.class.st | 31 +-- .../ChestCommandTreeBuilder.class.st | 35 ++-- .../ChestCopyObjectCommand.class.st | 23 +-- .../ChestInspectChestCommand.class.st | 19 +- .../ChestInspectItemCommand.class.st | 19 +- ...sFromAllChestsInPlaygroundCommand.class.st | 15 +- ...stLoadBindingsInPlaygroundCommand.class.st | 17 +- .../ChestLoadObjectIntoCodeCommand.class.st | 33 ++-- ...dSingleBindingInPlaygroundCommand.class.st | 17 +- ...estPasteLastObjectLoadCodeCommand.class.st | 34 +++- .../ChestPasteLoadCodeCommand.class.st | 33 ++-- .../ChestRemoveAllChestsCommand.class.st | 15 +- ...ChestRemoveAllItemsInChestCommand.class.st | 19 +- .../ChestRemoveChestCommand.class.st | 17 +- .../ChestRemoveItemCommand.class.st | 19 +- .../ChestRenameChestCommand.class.st | 17 +- .../ChestRenameItemCommand.class.st | 17 +- .../ChestStoreObjectCommand.class.st | 25 +-- .../SpCodeInteractionModel.extension.st | 4 +- .../SpCodePresenter.extension.st | 6 +- ...CodeScriptingInteractionModel.extension.st | 4 +- ...buggerContextInteractionModel.extension.st | 4 +- src/Chest-Commands/Variable.extension.st | 4 +- src/Chest-Commands/package.st | 2 +- src/Chest/Chest.class.st | 118 +++++------ src/Chest/ChestAnnouncer.class.st | 18 +- src/Chest/ChestAssociation.class.st | 8 +- ...hestCodeScriptingInteractionModel.class.st | 24 +-- src/Chest/ChestContentDictionary.class.st | 14 +- src/Chest/ChestCreated.class.st | 14 +- src/Chest/ChestInvalidNameError.class.st | 8 +- src/Chest/ChestKeyAlreadyInUseError.class.st | 8 +- src/Chest/ChestPresenter.class.st | 120 +++++------ src/Chest/ChestRemoved.class.st | 14 +- .../ChestRequestDialogPresenter.class.st | 32 +-- .../ChestTableWithContentPresenter.class.st | 186 +++++++++--------- src/Chest/ChestUpdated.class.st | 18 +- src/Chest/ClipboardChest.class.st | 109 +++++++++- src/Chest/Object.extension.st | 4 +- src/Chest/ObjectNotInChestError.class.st | 8 +- src/Chest/StDebugger.extension.st | 6 +- ...onInspectorNodeBuilderVisitor.extension.st | 4 +- .../StDebuggerExtensionVisitor.extension.st | 4 +- src/Chest/TChestAssociation.trait.st | 20 +- src/Chest/WeakChest.class.st | 22 ++- src/Chest/WeakChestAssociation.class.st | 10 +- src/Chest/WeakChestContentDictionary.class.st | 10 +- src/Chest/package.st | 2 +- 50 files changed, 700 insertions(+), 542 deletions(-) diff --git a/src/Chest-Commands/ChestAddNewChestCommand.class.st b/src/Chest-Commands/ChestAddNewChestCommand.class.st index 09ddb5b..3c1d44f 100644 --- a/src/Chest-Commands/ChestAddNewChestCommand.class.st +++ b/src/Chest-Commands/ChestAddNewChestCommand.class.st @@ -1,28 +1,29 @@ Class { - #name : #ChestAddNewChestCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestAddNewChestCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestAddNewChestCommand class >> defaultDescription [ ^ 'Request the naming of a new chest and create it' ] -{ #category : #default } +{ #category : 'default' } ChestAddNewChestCommand class >> defaultIconName [ ^ #add ] -{ #category : #default } +{ #category : 'default' } ChestAddNewChestCommand class >> defaultName [ ^ 'Add chest' ] -{ #category : #executing } +{ #category : 'executing' } ChestAddNewChestCommand >> execute [ ^ context requestNameNewChest diff --git a/src/Chest-Commands/ChestAddNewItemCommand.class.st b/src/Chest-Commands/ChestAddNewItemCommand.class.st index 9461235..21704e3 100644 --- a/src/Chest-Commands/ChestAddNewItemCommand.class.st +++ b/src/Chest-Commands/ChestAddNewItemCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestAddNewItemCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestAddNewItemCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestAddNewItemCommand class >> defaultDescription [ ^ 'Request an expression whose result will be stored inside the selected chest' ] -{ #category : #default } +{ #category : 'default' } ChestAddNewItemCommand class >> defaultIconName [ ^ #add ] -{ #category : #default } +{ #category : 'default' } ChestAddNewItemCommand class >> defaultName [ ^ 'Add item' ] -{ #category : #testing } +{ #category : 'testing' } ChestAddNewItemCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestAddNewItemCommand >> execute [ ^ context requestExpressionToStoreInChest diff --git a/src/Chest-Commands/ChestCommand.class.st b/src/Chest-Commands/ChestCommand.class.st index 8543b37..45b00d4 100644 --- a/src/Chest-Commands/ChestCommand.class.st +++ b/src/Chest-Commands/ChestCommand.class.st @@ -2,18 +2,19 @@ Abstract class whose subclasses are all commands for `Chest`. It is also an utility class that provides on class side groups of commands that can be used to create Commander command groups. " Class { - #name : #ChestCommand, - #superclass : #CmCommand, - #category : #'Chest-Commands' + #name : 'ChestCommand', + #superclass : 'CmCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestCodePresenterCommandClasses [ ^ { ChestLoadObjectIntoCodeCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestLoadChestCommandClasses [ ^ { @@ -21,13 +22,13 @@ ChestCommand class >> chestLoadChestCommandClasses [ ChestLoadBindingsFromAllChestsInPlaygroundCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestLoadItemCommandClasses [ ^ { ChestLoadSingleBindingInPlaygroundCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTableContentMenuCommandClasses [ ^ { @@ -38,7 +39,7 @@ ChestCommand class >> chestTableContentMenuCommandClasses [ ChestRemoveAllItemsInChestCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTableContentToolbarCommandClasses [ ^ { @@ -46,7 +47,7 @@ ChestCommand class >> chestTableContentToolbarCommandClasses [ ChestRemoveItemCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTableMenuCommandClasses [ ^ { @@ -57,7 +58,7 @@ ChestCommand class >> chestTableMenuCommandClasses [ ChestRemoveAllChestsCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTableToolbarCommandClasses [ ^ { @@ -65,14 +66,14 @@ ChestCommand class >> chestTableToolbarCommandClasses [ ChestRemoveChestCommand } ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTreeTableMenuCommandClasses [ ^ self chestTableMenuCommandClasses , self chestTableContentMenuCommandClasses ] -{ #category : #'accessing - commands classes' } +{ #category : 'accessing - commands classes' } ChestCommand class >> chestTreeTableToolbarCommandClasses [ ^ { @@ -80,19 +81,19 @@ ChestCommand class >> chestTreeTableToolbarCommandClasses [ ChestRemoveAllChestsCommand } ] -{ #category : #default } +{ #category : 'default' } ChestCommand class >> defaultIconName [ ^ nil ] -{ #category : #default } +{ #category : 'default' } ChestCommand class >> defaultShortcutKey [ ^ nil ] -{ #category : #default } +{ #category : 'default' } ChestCommand class >> isVisibleForContext: aSpecContext [ ^ true diff --git a/src/Chest-Commands/ChestCommandTreeBuilder.class.st b/src/Chest-Commands/ChestCommandTreeBuilder.class.st index 99a2bda..8b4801d 100644 --- a/src/Chest-Commands/ChestCommandTreeBuilder.class.st +++ b/src/Chest-Commands/ChestCommandTreeBuilder.class.st @@ -2,16 +2,17 @@ Class that builds the group of Chest commands for the `SpCodePresenter` context menu. " Class { - #name : #ChestCommandTreeBuilder, - #superclass : #Object, + #name : 'ChestCommandTreeBuilder', + #superclass : 'Object', #instVars : [ 'rootCommandGroup', 'codePresenter' ], - #category : #'Chest-Commands' + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder class >> buildCommandsGroupWith: aCodePresenter forRoot: aRootCommandGroup [ self new @@ -19,25 +20,25 @@ ChestCommandTreeBuilder class >> buildCommandsGroupWith: aCodePresenter forRoot: forRoot: aRootCommandGroup ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder class >> displayStrategy [ ^ CmUIDisplayAsSubMenu ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder class >> groupDescription [ ^ 'Actions interacting with Chest' ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder class >> groupName [ ^ 'Chest' ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> buildAndRegisterGroup [ "builds the group that will register under the provided root command group" @@ -50,7 +51,7 @@ ChestCommandTreeBuilder >> buildAndRegisterGroup [ ^ group ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> buildChestCommandGroup [ self chestCommandClasses do: [ :commandClass | @@ -60,7 +61,7 @@ ChestCommandTreeBuilder >> buildChestCommandGroup [ self group beDisplayedAsGroup ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> buildCommandsGroupWith: aCodePresenter forRoot: aRootCommandGroup [ codePresenter := aCodePresenter. @@ -68,7 +69,7 @@ ChestCommandTreeBuilder >> buildCommandsGroupWith: aCodePresenter forRoot: aRoot self buildChestCommandGroup ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> buildPasteLoadCodeGroup [ | specGroup allChests subSpecGroup | @@ -89,13 +90,13 @@ ChestCommandTreeBuilder >> buildPasteLoadCodeGroup [ ^ specGroup ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> buildSpecCommand: commandClass forContext: aContext [ ^ commandClass forSpecContext: aContext ] -{ #category : #building } +{ #category : 'building' } ChestCommandTreeBuilder >> chestCommandClasses [ ^ { @@ -104,13 +105,13 @@ ChestCommandTreeBuilder >> chestCommandClasses [ each isVisibleForContext: codePresenter ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder >> displayStrategy [ ^ self class displayStrategy new ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder >> group [ ^ rootCommandGroup @@ -118,13 +119,13 @@ ChestCommandTreeBuilder >> group [ ifNone: [ self buildAndRegisterGroup ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder >> groupDescription [ ^ self class groupDescription ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCommandTreeBuilder >> groupName [ ^ self class groupName diff --git a/src/Chest-Commands/ChestCopyObjectCommand.class.st b/src/Chest-Commands/ChestCopyObjectCommand.class.st index 97c627d..6cce92b 100644 --- a/src/Chest-Commands/ChestCopyObjectCommand.class.st +++ b/src/Chest-Commands/ChestCopyObjectCommand.class.st @@ -1,35 +1,30 @@ Class { - #name : #ChestCopyObjectCommand, - #superclass : #SpCodeSelectionCommand, - #category : #'Chest-Commands' + #name : 'ChestCopyObjectCommand', + #superclass : 'SpCodeSelectionCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestCopyObjectCommand class >> defaultDescription [ ^ 'Store the result of the selected expression in a clipboard chest to paste it later' ] -{ #category : #defaults } +{ #category : 'defaults' } ChestCopyObjectCommand class >> defaultIconName [ ^ #smallCopy ] -{ #category : #default } +{ #category : 'default' } ChestCopyObjectCommand class >> defaultName [ ^ 'Copy object in a clipboard chest' ] -{ #category : #executing } +{ #category : 'executing' } ChestCopyObjectCommand >> execute [ - self evaluateSelectionAndDo: [ :result | - [ ClipboardChest at: ClipboardChest clipboardEntryName put: result ] - on: ChestKeyAlreadyInUseError - do: [ - ClipboardChest removeObjectNamed: - ClipboardChest clipboardEntryName. - ClipboardChest at: ClipboardChest clipboardEntryName put: result ] ] + self evaluateSelectionAndDo: [ :result | ClipboardChest add: result ] ] diff --git a/src/Chest-Commands/ChestInspectChestCommand.class.st b/src/Chest-Commands/ChestInspectChestCommand.class.st index 294df81..e956456 100644 --- a/src/Chest-Commands/ChestInspectChestCommand.class.st +++ b/src/Chest-Commands/ChestInspectChestCommand.class.st @@ -1,40 +1,41 @@ Class { - #name : #ChestInspectChestCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestInspectChestCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestInspectChestCommand class >> defaultDescription [ ^ 'Inspect the chest' ] -{ #category : #default } +{ #category : 'default' } ChestInspectChestCommand class >> defaultIconName [ ^ #glamorousInspect ] -{ #category : #default } +{ #category : 'default' } ChestInspectChestCommand class >> defaultName [ ^ 'Inspect chest' ] -{ #category : #default } +{ #category : 'default' } ChestInspectChestCommand class >> defaultShortcutKey [ ^ $i meta ] -{ #category : #testing } +{ #category : 'testing' } ChestInspectChestCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestInspectChestCommand >> execute [ context selectedChest inspect diff --git a/src/Chest-Commands/ChestInspectItemCommand.class.st b/src/Chest-Commands/ChestInspectItemCommand.class.st index 89d655f..0e2a781 100644 --- a/src/Chest-Commands/ChestInspectItemCommand.class.st +++ b/src/Chest-Commands/ChestInspectItemCommand.class.st @@ -1,40 +1,41 @@ Class { - #name : #ChestInspectItemCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestInspectItemCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestInspectItemCommand class >> defaultDescription [ ^ 'Inspect the object' ] -{ #category : #default } +{ #category : 'default' } ChestInspectItemCommand class >> defaultIconName [ ^ #glamorousInspect ] -{ #category : #default } +{ #category : 'default' } ChestInspectItemCommand class >> defaultName [ ^ 'Inspect item' ] -{ #category : #default } +{ #category : 'default' } ChestInspectItemCommand class >> defaultShortcutKey [ ^ $i meta ] -{ #category : #testing } +{ #category : 'testing' } ChestInspectItemCommand >> canBeExecuted [ ^ context selectedItem isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestInspectItemCommand >> execute [ ^ context selectedItem value inspect diff --git a/src/Chest-Commands/ChestLoadBindingsFromAllChestsInPlaygroundCommand.class.st b/src/Chest-Commands/ChestLoadBindingsFromAllChestsInPlaygroundCommand.class.st index f9711aa..0f9d77e 100644 --- a/src/Chest-Commands/ChestLoadBindingsFromAllChestsInPlaygroundCommand.class.st +++ b/src/Chest-Commands/ChestLoadBindingsFromAllChestsInPlaygroundCommand.class.st @@ -1,28 +1,29 @@ Class { - #name : #ChestLoadBindingsFromAllChestsInPlaygroundCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestLoadBindingsFromAllChestsInPlaygroundCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestLoadBindingsFromAllChestsInPlaygroundCommand class >> defaultDescription [ ^ 'Load all objects from all chests into the playground, in variables of same name as their key in their respective chest' ] -{ #category : #default } +{ #category : 'default' } ChestLoadBindingsFromAllChestsInPlaygroundCommand class >> defaultName [ ^ 'Load all chests'' bindings' ] -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestLoadBindingsFromAllChestsInPlaygroundCommand class >> defaultShortcutKey [ ^ $l shift meta ] -{ #category : #executing } +{ #category : 'executing' } ChestLoadBindingsFromAllChestsInPlaygroundCommand >> execute [ ^ context loadBindingsFromAllChestsInPlayground diff --git a/src/Chest-Commands/ChestLoadBindingsInPlaygroundCommand.class.st b/src/Chest-Commands/ChestLoadBindingsInPlaygroundCommand.class.st index ae286c2..cb29608 100644 --- a/src/Chest-Commands/ChestLoadBindingsInPlaygroundCommand.class.st +++ b/src/Chest-Commands/ChestLoadBindingsInPlaygroundCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestLoadBindingsInPlaygroundCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestLoadBindingsInPlaygroundCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestLoadBindingsInPlaygroundCommand class >> defaultDescription [ ^ 'Load all objects from the selected chest into the context''s playground, in variables of same name as their key in the chest' ] -{ #category : #default } +{ #category : 'default' } ChestLoadBindingsInPlaygroundCommand class >> defaultName [ ^ 'Load bindings' ] -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestLoadBindingsInPlaygroundCommand class >> defaultShortcutKey [ ^ $l meta ] -{ #category : #testing } +{ #category : 'testing' } ChestLoadBindingsInPlaygroundCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestLoadBindingsInPlaygroundCommand >> execute [ ^ context loadBindingsFromSelectedChestInPlayground diff --git a/src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st b/src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st index 00cdeee..ae59248 100644 --- a/src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st +++ b/src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st @@ -2,42 +2,43 @@ Command that allows to load an object or several objects from a chest into a code presenter in a playground or in a debugger. " Class { - #name : #ChestLoadObjectIntoCodeCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestLoadObjectIntoCodeCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestLoadObjectIntoCodeCommand class >> defaultDescription [ ^ 'Load an object from a chest into a code presenter' ] -{ #category : #initialization } +{ #category : 'initialization' } ChestLoadObjectIntoCodeCommand class >> defaultIconName [ ^ #group ] -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestLoadObjectIntoCodeCommand class >> defaultName [ ^ 'Load object from chest' ] -{ #category : #testing } +{ #category : 'testing' } ChestLoadObjectIntoCodeCommand class >> isVisibleForContext: aCodePresenter [ ^ aCodePresenter canLoadBindings ] -{ #category : #accessing } +{ #category : 'accessing' } ChestLoadObjectIntoCodeCommand class >> variableTag [ ^ Chest comesFromChestVariableTag ] -{ #category : #initialization } +{ #category : 'initialization' } ChestLoadObjectIntoCodeCommand >> buildChoicePresenter [ | choicePresenter | @@ -61,13 +62,13 @@ ChestLoadObjectIntoCodeCommand >> buildChoicePresenter [ ^ choicePresenter ] -{ #category : #testing } +{ #category : 'testing' } ChestLoadObjectIntoCodeCommand >> canBeExecuted [ ^ self isVisibleForContext: context ] -{ #category : #execution } +{ #category : 'execution' } ChestLoadObjectIntoCodeCommand >> execute [ | choicePresenter | @@ -75,7 +76,7 @@ ChestLoadObjectIntoCodeCommand >> execute [ choicePresenter open ] -{ #category : #testing } +{ #category : 'testing' } ChestLoadObjectIntoCodeCommand >> isVisibleForContext: aCodePresenter [ ^ aCodePresenter interactionModel isNotNil and: [ @@ -83,7 +84,7 @@ ChestLoadObjectIntoCodeCommand >> isVisibleForContext: aCodePresenter [ identityIncludes: #addBinding: ] ] -{ #category : #execution } +{ #category : 'execution' } ChestLoadObjectIntoCodeCommand >> loadAssocIntoContext: assoc [ (context interactionModel hasBindingOf: assoc key) @@ -95,7 +96,7 @@ ChestLoadObjectIntoCodeCommand >> loadAssocIntoContext: assoc [ self loadIntoContextObject: assoc value named: assoc variableName ] ] -{ #category : #'private - commands' } +{ #category : 'private - commands' } ChestLoadObjectIntoCodeCommand >> loadIntoContextObject: anObject named: objectName [ | interactionModel | @@ -106,13 +107,13 @@ ChestLoadObjectIntoCodeCommand >> loadIntoContextObject: anObject named: objectN yourself) ] -{ #category : #accessing } +{ #category : 'accessing' } ChestLoadObjectIntoCodeCommand >> variableTag [ ^ self class variableTag ] -{ #category : #'private - commands' } +{ #category : 'private - commands' } ChestLoadObjectIntoCodeCommand >> warnUserWhenDeletingBindingWithKey: key withNewValue: newValue [ | presenter | diff --git a/src/Chest-Commands/ChestLoadSingleBindingInPlaygroundCommand.class.st b/src/Chest-Commands/ChestLoadSingleBindingInPlaygroundCommand.class.st index a07ec2f..7fa53b8 100644 --- a/src/Chest-Commands/ChestLoadSingleBindingInPlaygroundCommand.class.st +++ b/src/Chest-Commands/ChestLoadSingleBindingInPlaygroundCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestLoadSingleBindingInPlaygroundCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestLoadSingleBindingInPlaygroundCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestLoadSingleBindingInPlaygroundCommand class >> defaultDescription [ ^ 'Load the selected object into the playground, in a variable of same name as its key in the chest.' ] -{ #category : #default } +{ #category : 'default' } ChestLoadSingleBindingInPlaygroundCommand class >> defaultName [ ^ 'Load item' ] -{ #category : #default } +{ #category : 'default' } ChestLoadSingleBindingInPlaygroundCommand class >> defaultShortcutKey [ ^ $l meta ] -{ #category : #testing } +{ #category : 'testing' } ChestLoadSingleBindingInPlaygroundCommand >> canBeExecuted [ ^ context selectedItem isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestLoadSingleBindingInPlaygroundCommand >> execute [ ^ context loadSelectedItemBindingInPlayground diff --git a/src/Chest-Commands/ChestPasteLastObjectLoadCodeCommand.class.st b/src/Chest-Commands/ChestPasteLastObjectLoadCodeCommand.class.st index b201f1d..00496dc 100644 --- a/src/Chest-Commands/ChestPasteLastObjectLoadCodeCommand.class.st +++ b/src/Chest-Commands/ChestPasteLastObjectLoadCodeCommand.class.st @@ -1,43 +1,57 @@ Class { - #name : #ChestPasteLastObjectLoadCodeCommand, - #superclass : #ChestPasteLoadCodeCommand, - #category : #'Chest-Commands' + #name : 'ChestPasteLastObjectLoadCodeCommand', + #superclass : 'ChestPasteLoadCodeCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestPasteLastObjectLoadCodeCommand class >> defaultDescription [ ^ 'Paste last object from clipboard chest' ] -{ #category : #default } +{ #category : 'default' } ChestPasteLastObjectLoadCodeCommand class >> defaultName [ ^ 'Paste last object copied to clipboard' ] -{ #category : #default } +{ #category : 'default' } ChestPasteLastObjectLoadCodeCommand class >> defaultShortcutKey [ ^ $v meta shift ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestPasteLastObjectLoadCodeCommand class >> forSpecContext: aContext [ ^ self forSpecContext: aContext withChestName: ClipboardChest defaultInstance name - withObjectName: ClipboardChest clipboardEntryName + withObjectName: nil ] -{ #category : #accessing } +{ #category : 'executing' } +ChestPasteLastObjectLoadCodeCommand >> buildInjectedCode [ + + objectName := ClipboardChest lastClipboardKeys last. + ^ super buildInjectedCode +] + +{ #category : 'testing' } +ChestPasteLastObjectLoadCodeCommand >> canBeExecuted [ + + ^ ClipboardChest lastClipboardKeys notEmpty +] + +{ #category : 'accessing' } ChestPasteLastObjectLoadCodeCommand >> description [ ^ self class defaultDescription ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLastObjectLoadCodeCommand >> name [ ^ self class defaultName diff --git a/src/Chest-Commands/ChestPasteLoadCodeCommand.class.st b/src/Chest-Commands/ChestPasteLoadCodeCommand.class.st index 25fb070..be2a546 100644 --- a/src/Chest-Commands/ChestPasteLoadCodeCommand.class.st +++ b/src/Chest-Commands/ChestPasteLoadCodeCommand.class.st @@ -2,40 +2,41 @@ Command that allows to paste (inject) code to load an object from a chest into a spec context " Class { - #name : #ChestPasteLoadCodeCommand, - #superclass : #ChestCommand, + #name : 'ChestPasteLoadCodeCommand', + #superclass : 'ChestCommand', #instVars : [ 'chestName', 'objectName' ], - #category : #'Chest-Commands' + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestPasteLoadCodeCommand class >> defaultDescription [ ^ 'Paste object from a chest' ] -{ #category : #default } +{ #category : 'default' } ChestPasteLoadCodeCommand class >> defaultIconName [ ^ #smallPaste ] -{ #category : #default } +{ #category : 'default' } ChestPasteLoadCodeCommand class >> defaultName [ ^ 'ChestObjectPaste' ] -{ #category : #default } +{ #category : 'default' } ChestPasteLoadCodeCommand class >> defaultShortcutKey [ ^ $v meta , $l meta ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestPasteLoadCodeCommand class >> forSpecContext: specContext withChestName: chestName withObjectName: objectName [ ^ self new @@ -46,7 +47,7 @@ ChestPasteLoadCodeCommand class >> forSpecContext: specContext withChestName: ch asSpecCommand ] -{ #category : #executing } +{ #category : 'executing' } ChestPasteLoadCodeCommand >> buildInjectedCode [ ^ '(Chest named: ''{1}'') at: ''{2}''' format: { @@ -54,19 +55,19 @@ ChestPasteLoadCodeCommand >> buildInjectedCode [ objectName } ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> chestName [ ^ chestName ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> chestName: anObject [ chestName := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> description [ ^ 'Paste object from chest > {1} > {2}' format: { @@ -74,7 +75,7 @@ ChestPasteLoadCodeCommand >> description [ objectName } ] -{ #category : #executing } +{ #category : 'executing' } ChestPasteLoadCodeCommand >> execute [ | code | @@ -83,19 +84,19 @@ ChestPasteLoadCodeCommand >> execute [ context doTextPaste ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> name [ ^ objectName ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> objectName [ ^ objectName ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPasteLoadCodeCommand >> objectName: anObject [ objectName := anObject diff --git a/src/Chest-Commands/ChestRemoveAllChestsCommand.class.st b/src/Chest-Commands/ChestRemoveAllChestsCommand.class.st index 8f819d4..c634d98 100644 --- a/src/Chest-Commands/ChestRemoveAllChestsCommand.class.st +++ b/src/Chest-Commands/ChestRemoveAllChestsCommand.class.st @@ -1,28 +1,29 @@ Class { - #name : #ChestRemoveAllChestsCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRemoveAllChestsCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRemoveAllChestsCommand class >> defaultDescription [ ^ 'Remove all chests' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveAllChestsCommand class >> defaultIconName [ ^ #glamorousTrash ] -{ #category : #default } +{ #category : 'default' } ChestRemoveAllChestsCommand class >> defaultName [ ^ 'Remove all chests' ] -{ #category : #executing } +{ #category : 'executing' } ChestRemoveAllChestsCommand >> execute [ ^ context removeAllChests diff --git a/src/Chest-Commands/ChestRemoveAllItemsInChestCommand.class.st b/src/Chest-Commands/ChestRemoveAllItemsInChestCommand.class.st index b205ab8..bfc5d03 100644 --- a/src/Chest-Commands/ChestRemoveAllItemsInChestCommand.class.st +++ b/src/Chest-Commands/ChestRemoveAllItemsInChestCommand.class.st @@ -1,40 +1,41 @@ Class { - #name : #ChestRemoveAllItemsInChestCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRemoveAllItemsInChestCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRemoveAllItemsInChestCommand class >> defaultDescription [ ^ 'Remove all objects from the selected chest' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveAllItemsInChestCommand class >> defaultIconName [ ^ #glamorousTrash ] -{ #category : #default } +{ #category : 'default' } ChestRemoveAllItemsInChestCommand class >> defaultName [ ^ 'Remove all items' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveAllItemsInChestCommand class >> defaultShortcutKey [ ^ $r meta , $m meta shift ] -{ #category : #testing } +{ #category : 'testing' } ChestRemoveAllItemsInChestCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestRemoveAllItemsInChestCommand >> execute [ ^ context removeAllItemsFromSelectedChest diff --git a/src/Chest-Commands/ChestRemoveChestCommand.class.st b/src/Chest-Commands/ChestRemoveChestCommand.class.st index c80c377..2813a1b 100644 --- a/src/Chest-Commands/ChestRemoveChestCommand.class.st +++ b/src/Chest-Commands/ChestRemoveChestCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestRemoveChestCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRemoveChestCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRemoveChestCommand class >> defaultDescription [ ^ 'Remove selected chest' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveChestCommand class >> defaultIconName [ ^ #remotesManagerRemoveRemote ] -{ #category : #default } +{ #category : 'default' } ChestRemoveChestCommand class >> defaultName [ ^ 'Remove chest' ] -{ #category : #testing } +{ #category : 'testing' } ChestRemoveChestCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestRemoveChestCommand >> execute [ ^ context removeSelectedChest diff --git a/src/Chest-Commands/ChestRemoveItemCommand.class.st b/src/Chest-Commands/ChestRemoveItemCommand.class.st index e3e36c8..d9e561a 100644 --- a/src/Chest-Commands/ChestRemoveItemCommand.class.st +++ b/src/Chest-Commands/ChestRemoveItemCommand.class.st @@ -1,40 +1,41 @@ Class { - #name : #ChestRemoveItemCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRemoveItemCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRemoveItemCommand class >> defaultDescription [ ^ 'Remove the selected object from the selected chest' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveItemCommand class >> defaultIconName [ ^ #remotesManagerRemoveRemote ] -{ #category : #default } +{ #category : 'default' } ChestRemoveItemCommand class >> defaultName [ ^ 'Remove item' ] -{ #category : #default } +{ #category : 'default' } ChestRemoveItemCommand class >> defaultShortcutKey [ ^ $r meta , $m meta ] -{ #category : #testing } +{ #category : 'testing' } ChestRemoveItemCommand >> canBeExecuted [ ^ context selectedItem isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestRemoveItemCommand >> execute [ ^ context removeSelectedItem diff --git a/src/Chest-Commands/ChestRenameChestCommand.class.st b/src/Chest-Commands/ChestRenameChestCommand.class.st index a2e4145..a866844 100644 --- a/src/Chest-Commands/ChestRenameChestCommand.class.st +++ b/src/Chest-Commands/ChestRenameChestCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestRenameChestCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRenameChestCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRenameChestCommand class >> defaultDescription [ ^ 'Rename the selected chest' ] -{ #category : #default } +{ #category : 'default' } ChestRenameChestCommand class >> defaultName [ ^ 'Rename chest' ] -{ #category : #default } +{ #category : 'default' } ChestRenameChestCommand class >> defaultShortcutKey [ ^ $r meta ] -{ #category : #testing } +{ #category : 'testing' } ChestRenameChestCommand >> canBeExecuted [ ^ context selectedChest isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestRenameChestCommand >> execute [ ^ context renameSelectedChest diff --git a/src/Chest-Commands/ChestRenameItemCommand.class.st b/src/Chest-Commands/ChestRenameItemCommand.class.st index 9b0a067..fae8a29 100644 --- a/src/Chest-Commands/ChestRenameItemCommand.class.st +++ b/src/Chest-Commands/ChestRenameItemCommand.class.st @@ -1,34 +1,35 @@ Class { - #name : #ChestRenameItemCommand, - #superclass : #ChestCommand, - #category : #'Chest-Commands' + #name : 'ChestRenameItemCommand', + #superclass : 'ChestCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #default } +{ #category : 'default' } ChestRenameItemCommand class >> defaultDescription [ ^ 'Rename the selected item in chest' ] -{ #category : #default } +{ #category : 'default' } ChestRenameItemCommand class >> defaultName [ ^ 'Rename item' ] -{ #category : #default } +{ #category : 'default' } ChestRenameItemCommand class >> defaultShortcutKey [ ^ $r meta shift ] -{ #category : #testing } +{ #category : 'testing' } ChestRenameItemCommand >> canBeExecuted [ ^ context selectedItem isNotNil ] -{ #category : #executing } +{ #category : 'executing' } ChestRenameItemCommand >> execute [ ^ context renameSelectedItem diff --git a/src/Chest-Commands/ChestStoreObjectCommand.class.st b/src/Chest-Commands/ChestStoreObjectCommand.class.st index 02ba27c..5a957c7 100644 --- a/src/Chest-Commands/ChestStoreObjectCommand.class.st +++ b/src/Chest-Commands/ChestStoreObjectCommand.class.st @@ -2,30 +2,31 @@ Command that allows to store the result of the evaluation of the selected expression in a `SpCodePresenter` into a chest. " Class { - #name : #ChestStoreObjectCommand, - #superclass : #SpCodeSelectionCommand, - #category : #'Chest-Commands' + #name : 'ChestStoreObjectCommand', + #superclass : 'SpCodeSelectionCommand', + #category : 'Chest-Commands', + #package : 'Chest-Commands' } -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestStoreObjectCommand class >> defaultDescription [ ^ 'Store the result of the selected expression in the chest of your choice' ] -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestStoreObjectCommand class >> defaultIconName [ ^ #group ] -{ #category : #'accessing - defaults' } +{ #category : 'accessing - defaults' } ChestStoreObjectCommand class >> defaultName [ ^ 'Store object in a chest' ] -{ #category : #initialization } +{ #category : 'initialization' } ChestStoreObjectCommand >> buildChoicePresenter [ | choicePresenter | @@ -61,7 +62,7 @@ ChestStoreObjectCommand >> buildChoicePresenter [ ^ choicePresenter ] -{ #category : #execution } +{ #category : 'execution' } ChestStoreObjectCommand >> execute [ | choicePresenter | @@ -69,19 +70,19 @@ ChestStoreObjectCommand >> execute [ choicePresenter open ] -{ #category : #execution } +{ #category : 'execution' } ChestStoreObjectCommand >> storeObject: result intoChest: chest [ chest ifNotNil: [ chest add: result ] ] -{ #category : #execution } +{ #category : 'execution' } ChestStoreObjectCommand >> storeObject: result intoChest: chest withName: objectName [ chest ifNotNil: [ chest at: objectName put: result ] ] -{ #category : #execution } +{ #category : 'execution' } ChestStoreObjectCommand >> storeResult: result intoChest: chest withName: objectName replacing: replacingBoolean [ replacingBoolean ifTrue: [ chest removeObjectNamed: objectName ]. @@ -92,7 +93,7 @@ ChestStoreObjectCommand >> storeResult: result intoChest: chest withName: object self storeObject: result intoChest: chest withName: objectName ] ] -{ #category : #execution } +{ #category : 'execution' } ChestStoreObjectCommand >> storeSelectionInChest: aChest withName: objectName withSelector: selectorSentToSelectionBeforeStoring replacing: replacingBoolean [ self evaluateSelectionAndDo: [ :result | diff --git a/src/Chest-Commands/SpCodeInteractionModel.extension.st b/src/Chest-Commands/SpCodeInteractionModel.extension.st index b7246be..2464abc 100644 --- a/src/Chest-Commands/SpCodeInteractionModel.extension.st +++ b/src/Chest-Commands/SpCodeInteractionModel.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #SpCodeInteractionModel } +Extension { #name : 'SpCodeInteractionModel' } -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } SpCodeInteractionModel >> canLoadBindings [ ^ false diff --git a/src/Chest-Commands/SpCodePresenter.extension.st b/src/Chest-Commands/SpCodePresenter.extension.st index 38d6c59..69c8725 100644 --- a/src/Chest-Commands/SpCodePresenter.extension.st +++ b/src/Chest-Commands/SpCodePresenter.extension.st @@ -1,12 +1,12 @@ -Extension { #name : #SpCodePresenter } +Extension { #name : 'SpCodePresenter' } -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } SpCodePresenter class >> buildChestCommandsGroupWith: aCodePresenter forRoot: rootCommandGroup [ ChestCommandTreeBuilder buildCommandsGroupWith: aCodePresenter forRoot: rootCommandGroup ] -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } SpCodePresenter >> canLoadBindings [ ^ self interactionModel canLoadBindings diff --git a/src/Chest-Commands/SpCodeScriptingInteractionModel.extension.st b/src/Chest-Commands/SpCodeScriptingInteractionModel.extension.st index 91e21a9..4e5a601 100644 --- a/src/Chest-Commands/SpCodeScriptingInteractionModel.extension.st +++ b/src/Chest-Commands/SpCodeScriptingInteractionModel.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #SpCodeScriptingInteractionModel } +Extension { #name : 'SpCodeScriptingInteractionModel' } -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } SpCodeScriptingInteractionModel >> canLoadBindings [ ^ true diff --git a/src/Chest-Commands/StDebuggerContextInteractionModel.extension.st b/src/Chest-Commands/StDebuggerContextInteractionModel.extension.st index c2c2795..1fd5e7c 100644 --- a/src/Chest-Commands/StDebuggerContextInteractionModel.extension.st +++ b/src/Chest-Commands/StDebuggerContextInteractionModel.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #StDebuggerContextInteractionModel } +Extension { #name : 'StDebuggerContextInteractionModel' } -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } StDebuggerContextInteractionModel >> canLoadBindings [ ^ true diff --git a/src/Chest-Commands/Variable.extension.st b/src/Chest-Commands/Variable.extension.st index e570eaa..25822f6 100644 --- a/src/Chest-Commands/Variable.extension.st +++ b/src/Chest-Commands/Variable.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Variable } +Extension { #name : 'Variable' } -{ #category : #'*Chest-Commands' } +{ #category : '*Chest-Commands' } Variable >> comesFromChest [ ^ self propertyAt: #comesFromChest ifAbsent: [ false ] diff --git a/src/Chest-Commands/package.st b/src/Chest-Commands/package.st index 3a5c33d..7beafa4 100644 --- a/src/Chest-Commands/package.st +++ b/src/Chest-Commands/package.st @@ -1 +1 @@ -Package { #name : #'Chest-Commands' } +Package { #name : 'Chest-Commands' } diff --git a/src/Chest/Chest.class.st b/src/Chest/Chest.class.st index 32b8dd8..dc0c0b8 100644 --- a/src/Chest/Chest.class.st +++ b/src/Chest/Chest.class.st @@ -101,8 +101,8 @@ The 6 messages above can be sent to `Chest class` unlike the ones below: name: " Class { - #name : #Chest, - #superclass : #Object, + #name : 'Chest', + #superclass : 'Object', #instVars : [ 'contents', 'name', @@ -116,46 +116,48 @@ Class { 'defaultInstance', 'nextAvailableID' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #api } +{ #category : 'api' } Chest class >> add: anObject [ ^ self defaultInstance add: anObject ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> allChests [ ^ ChestDictionary values ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> announcer [ ^ CAnnouncer ifNil: [ CAnnouncer := ChestAnnouncer uniqueInstance ] ] -{ #category : #api } +{ #category : 'api' } Chest class >> at: anIndex [ ^ self defaultInstance at: anIndex ] -{ #category : #api } +{ #category : 'api' } Chest class >> at: aKey put: anObject [ ^ self defaultInstance at: aKey put: anObject ] -{ #category : #api } +{ #category : 'api' } Chest class >> at: aKey put: anObject ifPresent: aBlock [ ^ self defaultInstance at: aKey put: anObject ifPresent: aBlock ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> at: aKey putChestIfKeyIsAbsent: aChest [ (ChestDictionary includesKey: aKey) ifTrue: [ @@ -164,62 +166,62 @@ Chest class >> at: aKey putChestIfKeyIsAbsent: aChest [ ChestDictionary at: aKey put: aChest ] -{ #category : #validating } +{ #category : 'validating' } Chest class >> checkValidName: aString [ [ Slot checkValidName: aString ] on: InvalidSlotName do: [ ChestInvalidNameError signal ] ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> chestDictionary [ ^ ChestDictionary copy ] -{ #category : #icons } +{ #category : 'icons' } Chest class >> chestIcon [ ^ Smalltalk ui icons iconNamed: 'group' ] -{ #category : #'accessing - tags' } +{ #category : 'accessing - tags' } Chest class >> comesFromChestVariableTag [ ^ #comesFromChest ] -{ #category : #api } +{ #category : 'api' } Chest class >> contents [ ^ self defaultInstance contents ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> default [ ^ self defaultInstance ] -{ #category : #accessing } +{ #category : 'accessing' } Chest class >> defaultInstance [ ^ defaultInstance ifNil: [ defaultInstance := self newNamed: self defaultInstanceName ] ] -{ #category : #'default values' } +{ #category : 'default values' } Chest class >> defaultInstanceName [ ^ 'Default' ] -{ #category : #'default values' } +{ #category : 'default values' } Chest class >> defaultNameForNewChest [ ^ 'Chest_' ] -{ #category : #private } +{ #category : 'private' } Chest class >> getNewID [ | newId | @@ -228,7 +230,7 @@ Chest class >> getNewID [ ^ newId ] -{ #category : #api } +{ #category : 'api' } Chest class >> inChest: aChestName at: aKey put: anObject [ | chest | @@ -239,7 +241,7 @@ Chest class >> inChest: aChestName at: aKey put: anObject [ ^ chest at: aKey put: anObject ] -{ #category : #'class initialization' } +{ #category : 'class initialization' } Chest class >> initialize [ ChestDictionary := Dictionary new. @@ -247,7 +249,7 @@ Chest class >> initialize [ defaultInstance := nil ] -{ #category : #'class initialization' } +{ #category : 'class initialization' } Chest class >> named: aString [ "Returns the Chest whose name is aString" @@ -255,13 +257,13 @@ Chest class >> named: aString [ ^ ChestDictionary at: aString ] -{ #category : #api } +{ #category : 'api' } Chest class >> new [ ^ self newNamed: self defaultNameForNewChest , self getNewID asString ] -{ #category : #api } +{ #category : 'api' } Chest class >> newNamed: aString [ | chest | @@ -271,37 +273,37 @@ Chest class >> newNamed: aString [ ^ chest ] -{ #category : #'event system' } +{ #category : 'event system' } Chest class >> notifyChestRemoved: aChest [ self announcer notifyChestRemoved: aChest ] -{ #category : #'event system' } +{ #category : 'event system' } Chest class >> notifyContentsOfChest: aChest updatedTo: contents [ self announcer notifyContentsOfChest: aChest updatedTo: contents ] -{ #category : #'event system' } +{ #category : 'event system' } Chest class >> notifyNewChest: aChest [ self announcer notifyNewChest: aChest ] -{ #category : #api } +{ #category : 'api' } Chest class >> remove: anObject [ ^ self defaultInstance remove: anObject ] -{ #category : #removing } +{ #category : 'removing' } Chest class >> removeChest: aChest [ ^ self removeChestNamed: aChest name ] -{ #category : #removing } +{ #category : 'removing' } Chest class >> removeChestNamed: aKey [ | removedChest | @@ -310,31 +312,31 @@ Chest class >> removeChestNamed: aKey [ self notifyChestRemoved: removedChest ] -{ #category : #api } +{ #category : 'api' } Chest class >> removeObjectNamed: aString [ ^ self defaultInstance removeObjectNamed: aString ] -{ #category : #subscription } +{ #category : 'subscription' } Chest class >> unsubscribe: subscriber [ self announcer unsubscribe: subscriber ] -{ #category : #validating } +{ #category : 'validating' } Chest class >> variableNameTag [ ^ #variableName ] -{ #category : #'wrapped protocol' } +{ #category : 'wrapped protocol' } Chest class >> weak [ ^ WeakChest ] -{ #category : #api } +{ #category : 'api' } Chest >> add: anObject [ "Adds an object to the chest. Returns the index at which it has been added." @@ -345,13 +347,13 @@ Chest >> add: anObject [ ^ self at: nameForTheObject put: anObject ] -{ #category : #api } +{ #category : 'api' } Chest >> at: aString [ ^ self contentsPrivate at: aString ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> at: aString put: anObject [ self checkValidName: aString. @@ -367,7 +369,7 @@ Chest >> at: aString put: anObject [ ^ aString ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> at: aString put: anObject ifPresent: aBlock [ [ self at: aString put: anObject ] @@ -375,86 +377,86 @@ Chest >> at: aString put: anObject ifPresent: aBlock [ do: aBlock ] -{ #category : #validating } +{ #category : 'validating' } Chest >> checkValidName: aString [ ^ self class checkValidName: aString ] -{ #category : #'private - tree building' } +{ #category : 'private - tree building' } Chest >> chestChildren [ ^ self contentsPrivate associations ] -{ #category : #evaluation } +{ #category : 'evaluation' } Chest >> chestEvaluation [ ^ self contentsPrivate asString ] -{ #category : #'private - tree building' } +{ #category : 'private - tree building' } Chest >> chestName [ ^ self name ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> contents [ ^ self contentsPrivate copy ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> contentsPrivate [ ^ contents ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> contentsUpdated [ self class notifyContentsOfChest: self updatedTo: self contents ] -{ #category : #api } +{ #category : 'api' } Chest >> empty [ self initializeContents. self contentsUpdated ] -{ #category : #initialization } +{ #category : 'initialization' } Chest >> initialize [ lastUsedNumber := 1. self initializeContents ] -{ #category : #initialization } +{ #category : 'initialization' } Chest >> initializeContents [ contents := ChestContentDictionary new ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> inspectAt: aString [ ^ (self contentsPrivate at: aString) inspect ] -{ #category : #testing } +{ #category : 'testing' } Chest >> isChest [ ^ true ] -{ #category : #api } +{ #category : 'api' } Chest >> name [ ^ name ] -{ #category : #api } +{ #category : 'api' } Chest >> name: aString [ | oldName | @@ -465,13 +467,13 @@ Chest >> name: aString [ oldName ifNotNil: [ self class removeChestNamed: oldName ] ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> nextDefaultNameForObject [ ^ self name , '_' , lastUsedNumber asString ] -{ #category : #removing } +{ #category : 'removing' } Chest >> remove [ "Remove this chest from the list of all chests" @@ -479,7 +481,7 @@ Chest >> remove [ self class removeChest: self ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> remove: anObject [ (contents keyForIdentity: anObject) ifNotNil: [ :key | @@ -487,7 +489,7 @@ Chest >> remove: anObject [ self contentsUpdated ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> removeObjectNamed: aString [ [ self contentsPrivate removeKey: aString ] @@ -496,7 +498,7 @@ Chest >> removeObjectNamed: aString [ self contentsUpdated ] -{ #category : #accessing } +{ #category : 'accessing' } Chest >> renameObject: anObject into: aString [ | oldKey | diff --git a/src/Chest/ChestAnnouncer.class.st b/src/Chest/ChestAnnouncer.class.st index 48206c5..88f874b 100644 --- a/src/Chest/ChestAnnouncer.class.st +++ b/src/Chest/ChestAnnouncer.class.st @@ -6,39 +6,41 @@ Announcer for `Chest` that announces to its subscribers when: - the content of a chest has been modified " Class { - #name : #ChestAnnouncer, - #superclass : #Announcer, + #name : 'ChestAnnouncer', + #superclass : 'Announcer', #classInstVars : [ 'uniqueInstance' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #'class initialization' } +{ #category : 'class initialization' } ChestAnnouncer class >> initialize [ uniqueInstance := self new ] -{ #category : #initialization } +{ #category : 'initialization' } ChestAnnouncer class >> uniqueInstance [ ^ uniqueInstance ] -{ #category : #'event system' } +{ #category : 'event system' } ChestAnnouncer >> notifyChestRemoved: aChest [ self announce: (ChestRemoved new: aChest) ] -{ #category : #'event system' } +{ #category : 'event system' } ChestAnnouncer >> notifyContentsOfChest: aChest updatedTo: contents [ self announce: (ChestUpdated new: aChest withContent: contents) ] -{ #category : #'event system' } +{ #category : 'event system' } ChestAnnouncer >> notifyNewChest: aChest [ self announce: (ChestCreated new: aChest) diff --git a/src/Chest/ChestAssociation.class.st b/src/Chest/ChestAssociation.class.st index 4e59046..34e5c1b 100644 --- a/src/Chest/ChestAssociation.class.st +++ b/src/Chest/ChestAssociation.class.st @@ -2,9 +2,11 @@ Association used by `ChestContentDictionary` that, when its value will be loaded into a playground or a debugger, can have a variable name that is different from its key in the dictionary. " Class { - #name : #ChestAssociation, - #superclass : #Association, + #name : 'ChestAssociation', + #superclass : 'Association', #traits : 'TChestAssociation', #classTraits : 'TChestAssociation classTrait', - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } diff --git a/src/Chest/ChestCodeScriptingInteractionModel.class.st b/src/Chest/ChestCodeScriptingInteractionModel.class.st index d44f677..3b5d1e5 100644 --- a/src/Chest/ChestCodeScriptingInteractionModel.class.st +++ b/src/Chest/ChestCodeScriptingInteractionModel.class.st @@ -1,13 +1,15 @@ Class { - #name : #ChestCodeScriptingInteractionModel, - #superclass : #StPlaygroundInteractionModel, + #name : 'ChestCodeScriptingInteractionModel', + #superclass : 'StPlaygroundInteractionModel', #instVars : [ 'debugger' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #accessing } +{ #category : 'accessing' } ChestCodeScriptingInteractionModel class >> debugger: aStDebugger [ ^ self new @@ -15,7 +17,7 @@ ChestCodeScriptingInteractionModel class >> debugger: aStDebugger [ yourself ] -{ #category : #binding } +{ #category : 'binding' } ChestCodeScriptingInteractionModel >> addBinding: aBinding [ super addBinding: aBinding. @@ -23,7 +25,7 @@ ChestCodeScriptingInteractionModel >> addBinding: aBinding [ debugger ifNotNil: [ debugger interactionModel addBinding: aBinding ] ] -{ #category : #'private - bindings' } +{ #category : 'private - bindings' } ChestCodeScriptingInteractionModel >> addSelfAndThisContextBindings [ | debuggerInteractionModel | @@ -38,7 +40,7 @@ ChestCodeScriptingInteractionModel >> addSelfAndThisContextBindings [ value: debuggerInteractionModel doItContext) ] -{ #category : #binding } +{ #category : 'binding' } ChestCodeScriptingInteractionModel >> bindingOf: aString [ | key | @@ -58,7 +60,7 @@ ChestCodeScriptingInteractionModel >> bindingOf: aString [ ^ self localBindings associationAt: key ] -{ #category : #binding } +{ #category : 'binding' } ChestCodeScriptingInteractionModel >> bindings [ "Combining shared bindings and local bindings needs to be done like this because the @@ -83,7 +85,7 @@ ChestCodeScriptingInteractionModel >> bindings [ ^ joinedBindings ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCodeScriptingInteractionModel >> debugger: aStDebugger [ debugger := aStDebugger. @@ -92,7 +94,7 @@ ChestCodeScriptingInteractionModel >> debugger: aStDebugger [ debugger code whenInteractionModelChangedDo: [ self addSelfAndThisContextBindings ] ] -{ #category : #binding } +{ #category : 'binding' } ChestCodeScriptingInteractionModel >> hasBindingOf: aString [ ^ (self sharedBindings includesKey: aString asSymbol) or: [ @@ -101,7 +103,7 @@ ChestCodeScriptingInteractionModel >> hasBindingOf: aString [ debugger interactionModel hasBindingOf: aString ] ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCodeScriptingInteractionModel >> removeBinding: aBinding [ self bindings removeKey: aBinding key. diff --git a/src/Chest/ChestContentDictionary.class.st b/src/Chest/ChestContentDictionary.class.st index a41faca..80b1e81 100644 --- a/src/Chest/ChestContentDictionary.class.st +++ b/src/Chest/ChestContentDictionary.class.st @@ -2,24 +2,26 @@ Dictionary used by Chest that contains `(key, value, variable name)` triplets, variable name being the name of the variable when the association will be loaded into a playground or a debugger. " Class { - #name : #ChestContentDictionary, - #superclass : #Dictionary, - #category : #Chest + #name : 'ChestContentDictionary', + #superclass : 'Dictionary', + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #accessing } +{ #category : 'accessing' } ChestContentDictionary class >> associationClass [ ^ ChestAssociation ] -{ #category : #accessing } +{ #category : 'accessing' } ChestContentDictionary >> associationClass [ ^ self class associationClass ] -{ #category : #accessing } +{ #category : 'accessing' } ChestContentDictionary >> at: key put: anObject [ "Set the value at key to be anObject. If key is not found, create a diff --git a/src/Chest/ChestCreated.class.st b/src/Chest/ChestCreated.class.st index 1d6abf2..2356315 100644 --- a/src/Chest/ChestCreated.class.st +++ b/src/Chest/ChestCreated.class.st @@ -2,15 +2,17 @@ Announcement made by a `ChestAnnouncer` when a new chest has been created " Class { - #name : #ChestCreated, - #superclass : #Announcement, + #name : 'ChestCreated', + #superclass : 'Announcement', #instVars : [ 'createdChest' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestCreated class >> new: newChest [ ^ self new @@ -18,13 +20,13 @@ ChestCreated class >> new: newChest [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCreated >> createdChest [ ^ createdChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestCreated >> createdChest: newChest [ createdChest := newChest diff --git a/src/Chest/ChestInvalidNameError.class.st b/src/Chest/ChestInvalidNameError.class.st index 5302e0f..2180030 100644 --- a/src/Chest/ChestInvalidNameError.class.st +++ b/src/Chest/ChestInvalidNameError.class.st @@ -2,7 +2,9 @@ Exception raised when you want to name/rename a chest (resp. an object in a chest) when another chest (resp. another object in the same chest) is already named so. " Class { - #name : #ChestInvalidNameError, - #superclass : #Error, - #category : #'Chest-Errors' + #name : 'ChestInvalidNameError', + #superclass : 'Error', + #category : 'Chest-Errors', + #package : 'Chest', + #tag : 'Errors' } diff --git a/src/Chest/ChestKeyAlreadyInUseError.class.st b/src/Chest/ChestKeyAlreadyInUseError.class.st index 01da4a2..a78eee3 100644 --- a/src/Chest/ChestKeyAlreadyInUseError.class.st +++ b/src/Chest/ChestKeyAlreadyInUseError.class.st @@ -2,7 +2,9 @@ Exception raised when you want to name/rename a chest (resp. an object in a chest) when another chest (resp. another object in the same chest) is already named so. " Class { - #name : #ChestKeyAlreadyInUseError, - #superclass : #Error, - #category : #'Chest-Errors' + #name : 'ChestKeyAlreadyInUseError', + #superclass : 'Error', + #category : 'Chest-Errors', + #package : 'Chest', + #tag : 'Errors' } diff --git a/src/Chest/ChestPresenter.class.st b/src/Chest/ChestPresenter.class.st index 6f3684c..730f46a 100644 --- a/src/Chest/ChestPresenter.class.st +++ b/src/Chest/ChestPresenter.class.st @@ -2,8 +2,8 @@ Presenter used to visualize chests and their contents. This is also a debugger extension. " Class { - #name : #ChestPresenter, - #superclass : #SpPresenter, + #name : 'ChestPresenter', + #superclass : 'SpPresenter', #traits : 'TStDebuggerExtension', #classTraits : 'TStDebuggerExtension classTrait', #instVars : [ @@ -22,10 +22,12 @@ Class { 'ShowInspector', 'ShowPlayground' ], - #category : #Chest + #category : 'Chest-Presenters', + #package : 'Chest', + #tag : 'Presenters' } -{ #category : #commands } +{ #category : 'commands' } ChestPresenter class >> buildCommandsGroupWith: aChestWithTablePresenter forRoot: aCmCommandGroup [ self @@ -37,7 +39,7 @@ ChestPresenter class >> buildCommandsGroupWith: aChestWithTablePresenter forRoot forRoot: aCmCommandGroup ] -{ #category : #commands } +{ #category : 'commands' } ChestPresenter class >> buildLoadChestCommandGroup: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -52,7 +54,7 @@ ChestPresenter class >> buildLoadChestCommandGroup: aChestWithContentPresenter f aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestPresenter class >> buildLoadItemCommandGroup: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -67,7 +69,7 @@ ChestPresenter class >> buildLoadItemCommandGroup: aChestWithContentPresenter fo aRoot register: group ] -{ #category : #settings } +{ #category : 'settings' } ChestPresenter class >> chestSettingsOn: aBuilder [ @@ -89,7 +91,7 @@ ChestPresenter class >> chestSettingsOn: aBuilder [ 'Shows an inspector on the right to chests and their contents, on the selected chest item' ] ] -{ #category : #'menu-entry' } +{ #category : 'menu-entry' } ChestPresenter class >> debugWorldMenuOn: aBuilder [ @@ -106,19 +108,19 @@ ChestPresenter class >> debugWorldMenuOn: aBuilder [ icon: (Smalltalk ui icons iconNamed: #group) ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> loadChestGroupName [ ^ 'LoadChest' ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> loadItemGroupName [ ^ 'LoadItem' ] -{ #category : #examples } +{ #category : 'examples' } ChestPresenter class >> open [ @@ -129,7 +131,7 @@ ChestPresenter class >> open [ ^ chestPresenter ] -{ #category : #commands } +{ #category : 'commands' } ChestPresenter class >> registerClasses: commandClasses toGroup: aGroup withContext: aChestWithContentPresenter [ commandClasses do: [ :aClass | @@ -140,44 +142,44 @@ ChestPresenter class >> registerClasses: commandClasses toGroup: aGroup withCont beHiddenWhenCantBeRun) ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> showInspector [ ^ ShowInspector ifNil: [ ShowInspector := false ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> showInspector: anObject [ ShowInspector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> showPlayground [ ^ ShowPlayground ifNil: [ ShowPlayground := false ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter class >> showPlayground: anObject [ ShowPlayground := anObject ] -{ #category : #visiting } +{ #category : 'visiting' } ChestPresenter >> accept: aVisitor [ ^ aVisitor visitChest: self ] -{ #category : #adding } +{ #category : 'adding' } ChestPresenter >> addBindingsInPlayground: aCollectionOfBindings [ playground firstPage interactionModel addBindings: aCollectionOfBindings ] -{ #category : #adding } +{ #category : 'adding' } ChestPresenter >> addButtonsToPresenter: aDialogPresenter withConfirmAction: aBlock [ | dialogLayout | @@ -188,45 +190,45 @@ ChestPresenter >> addButtonsToPresenter: aDialogPresenter withConfirmAction: aBl yourself) ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter >> chestContentsTableToolbar [ ^ chestTableWithContent chestContentsTableToolbar ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter >> chestsTableToolbar [ ^ chestTableWithContent chestsTableToolbar ] -{ #category : #binding } +{ #category : 'binding' } ChestPresenter >> collectBindingsFromAllChests [ ^ chestsTable items flatCollect: [ :each | self collectBindingsFromChest: each ] ] -{ #category : #binding } +{ #category : 'binding' } ChestPresenter >> collectBindingsFromChest: aChest [ ^ aChest contents associations collect: [ :each | self convertBindingIntoProperWorkspaceVariable: each ] ] -{ #category : #converting } +{ #category : 'converting' } ChestPresenter >> convertBindingIntoProperWorkspaceVariable: aBinding [ ^ WorkspaceVariable key: aBinding key value: aBinding value ] -{ #category : #'debugger extension' } +{ #category : 'debugger extension' } ChestPresenter >> debuggerExtensionToolName [ ^ 'Chest' ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> debuggerLayout [ ^ SpBoxLayout newVertical @@ -237,7 +239,7 @@ ChestPresenter >> debuggerLayout [ yourself ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> defaultLayout [ | labelHeight topThirdHeight toolbarHeight helpButtonSize bottomRibbonHeight | @@ -257,7 +259,7 @@ ChestPresenter >> defaultLayout [ ^ globalContainer ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> displayInspector [ showInspectorContainer := SpBoxLayout newHorizontal @@ -271,14 +273,14 @@ ChestPresenter >> displayInspector [ showInspectorButton icon: (self application iconNamed: #enable) ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> displayPlayground [ showPlaygroundContainer add: playground. showPlaygroundButton icon: (self application iconNamed: #enable) ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> headerLayoutWithTitle: aString withToolbar: aToolbar [ ^ SpBoxLayout newHorizontal @@ -287,7 +289,7 @@ ChestPresenter >> headerLayoutWithTitle: aString withToolbar: aToolbar [ yourself ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> hideInspector [ showInspectorContainer := showInspectorButton. @@ -298,32 +300,32 @@ ChestPresenter >> hideInspector [ showInspectorButton icon: (self application iconNamed: #disable) ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> hidePlayground [ showPlaygroundContainer remove: playground. showPlaygroundButton icon: (self application iconNamed: #disable) ] -{ #category : #helper } +{ #category : 'helper' } ChestPresenter >> iconManager [ ^ Smalltalk ui icons ] -{ #category : #specs } +{ #category : 'specs' } ChestPresenter >> initialExtent [ ^ 800 @ 600 ] -{ #category : #initialization } +{ #category : 'initialization' } ChestPresenter >> initialize [ super initialize ] -{ #category : #initialization } +{ #category : 'initialization' } ChestPresenter >> initializePresenters [ playground := self makePlayground. @@ -342,34 +344,34 @@ ChestPresenter >> initializePresenters [ self layout: self defaultLayout ] -{ #category : #initialization } +{ #category : 'initialization' } ChestPresenter >> initializeWindow: aWindowPresenter [ chestTableWithContent initializeWindow: aWindowPresenter. super initializeWindow: aWindowPresenter ] -{ #category : #loading } +{ #category : 'loading' } ChestPresenter >> loadBindingsFromAllChestsInPlayground [ ^ self addBindingsInPlayground: self collectBindingsFromAllChests ] -{ #category : #loading } +{ #category : 'loading' } ChestPresenter >> loadBindingsFromSelectedChestInPlayground [ ^ self addBindingsInPlayground: (self collectBindingsFromChest: self selectedChest) ] -{ #category : #adding } +{ #category : 'adding' } ChestPresenter >> loadSelectedItemBindingInPlayground [ self addBindingsInPlayground: { (self convertBindingIntoProperWorkspaceVariable: self selectedItem) } ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makeChestContentTableContextMenu [ | contextMenu | @@ -386,7 +388,7 @@ ChestPresenter >> makeChestContentTableContextMenu [ chestContentsTable contextMenu: contextMenu ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makeChestContentsTable [ self makeChestContentTableContextMenu. @@ -402,7 +404,7 @@ ChestPresenter >> makeChestContentsTable [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makeChestTableContextMenu [ | contextMenu | @@ -417,7 +419,7 @@ ChestPresenter >> makeChestTableContextMenu [ chestsTable contextMenu: contextMenu ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makeChestTreeTableContextMenu [ | contextMenu | @@ -439,7 +441,7 @@ ChestPresenter >> makeChestTreeTableContextMenu [ applyKeyBindingsFromMenu: contextMenu value ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makeChestsTable [ self makeChestTableContextMenu. @@ -448,7 +450,7 @@ ChestPresenter >> makeChestsTable [ yourself ] -{ #category : #layout } +{ #category : 'layout' } ChestPresenter >> makeExpandableLayouts [ showPlaygroundButton := self newToggleButton @@ -492,7 +494,7 @@ ChestPresenter >> makeExpandableLayouts [ self layout: globalContainer ] ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestPresenter >> makePlayground [ | newPlayground | @@ -510,73 +512,73 @@ Chest weak newNamed: ''WeakChestExample'' "creates a new chest that holds weak r ^ newPlayground ] -{ #category : #removing } +{ #category : 'removing' } ChestPresenter >> removeAllChests [ chestTableWithContent removeAllChests ] -{ #category : #removing } +{ #category : 'removing' } ChestPresenter >> removeAllItemsFromSelectedChest [ chestTableWithContent removeAllItemsFromSelectedChest ] -{ #category : #removing } +{ #category : 'removing' } ChestPresenter >> removeSelectedChest [ chestTableWithContent removeSelectedChest ] -{ #category : #removing } +{ #category : 'removing' } ChestPresenter >> removeSelectedItem [ chestTableWithContent removeSelectedItem ] -{ #category : #renaming } +{ #category : 'renaming' } ChestPresenter >> renameSelectedChest [ ^ chestTableWithContent renameSelectedChest ] -{ #category : #renaming } +{ #category : 'renaming' } ChestPresenter >> renameSelectedItem [ ^ chestTableWithContent renameSelectedItem ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestPresenter >> requestExpressionToStoreInChest [ chestTableWithContent requestExpressionToStoreInChest ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestPresenter >> requestNameNewChest [ chestTableWithContent requestNameNewChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter >> selectedChest [ ^ chestTableWithContent selectedChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestPresenter >> selectedItem [ ^ chestTableWithContent selectedItem ] -{ #category : #initialization } +{ #category : 'initialization' } ChestPresenter >> setModelBeforeInitialization: aStDebugger [ debugger := aStDebugger ] -{ #category : #specs } +{ #category : 'specs' } ChestPresenter >> title [ ^ 'Chests' diff --git a/src/Chest/ChestRemoved.class.st b/src/Chest/ChestRemoved.class.st index 5b6fbfe..23bcaf9 100644 --- a/src/Chest/ChestRemoved.class.st +++ b/src/Chest/ChestRemoved.class.st @@ -2,15 +2,17 @@ Announcement made by a `ChestAnnouncer` when a chest has been removed. " Class { - #name : #ChestRemoved, - #superclass : #Announcement, + #name : 'ChestRemoved', + #superclass : 'Announcement', #instVars : [ 'removedChest' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestRemoved class >> new: removedChest [ ^ self new @@ -18,13 +20,13 @@ ChestRemoved class >> new: removedChest [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRemoved >> removedChest [ ^ removedChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRemoved >> removedChest: anObject [ removedChest := anObject diff --git a/src/Chest/ChestRequestDialogPresenter.class.st b/src/Chest/ChestRequestDialogPresenter.class.st index c61c210..6dadb20 100644 --- a/src/Chest/ChestRequestDialogPresenter.class.st +++ b/src/Chest/ChestRequestDialogPresenter.class.st @@ -2,8 +2,8 @@ Request dialog used by `ChestPresenter` to ask users to name/rename a chest or an object in a chest. " Class { - #name : #ChestRequestDialogPresenter, - #superclass : #SpPresenter, + #name : 'ChestRequestDialogPresenter', + #superclass : 'SpPresenter', #instVars : [ 'titleLabel', 'image', @@ -12,10 +12,12 @@ Class { 'acceptBlock', 'cancelBlock' ], - #category : #Chest + #category : 'Chest-Presenters', + #package : 'Chest', + #tag : 'Presenters' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestRequestDialogPresenter class >> confirm: requestText onAccept: acceptBlock onCancel: cancelBlock [ ^ self basicNew @@ -27,7 +29,7 @@ ChestRequestDialogPresenter class >> confirm: requestText onAccept: acceptBlock yourself ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestRequestDialogPresenter class >> request: requestText onAccept: aBlock [ ^ self basicNew @@ -36,19 +38,19 @@ ChestRequestDialogPresenter class >> request: requestText onAccept: aBlock [ initialize ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> acceptBlock [ ^ acceptBlock ifNil: [ acceptBlock := [ :textContent | ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> acceptBlock: anObject [ acceptBlock := anObject ] -{ #category : #layout } +{ #category : 'layout' } ChestRequestDialogPresenter >> buildActionBar [ ^ self newActionBar @@ -71,19 +73,19 @@ ChestRequestDialogPresenter >> buildActionBar [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> cancelBlock [ ^ cancelBlock ifNil: [ cancelBlock := [ :aText| ] ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> cancelBlock: anObject [ cancelBlock := anObject ] -{ #category : #layout } +{ #category : 'layout' } ChestRequestDialogPresenter >> defaultLayout [ ^ SpBoxLayout newTopToBottom @@ -101,13 +103,13 @@ ChestRequestDialogPresenter >> defaultLayout [ yourself ] -{ #category : #configuration } +{ #category : 'configuration' } ChestRequestDialogPresenter >> disableText [ text beNotEditable ] -{ #category : #layout } +{ #category : 'layout' } ChestRequestDialogPresenter >> initializePresenters [ actionBar := self buildActionBar. @@ -116,13 +118,13 @@ ChestRequestDialogPresenter >> initializePresenters [ image := self newImage image: (self application iconNamed: #question) ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> text [ ^ text ] -{ #category : #accessing } +{ #category : 'accessing' } ChestRequestDialogPresenter >> titleLabel: aString [ titleLabel := self newLabel. diff --git a/src/Chest/ChestTableWithContentPresenter.class.st b/src/Chest/ChestTableWithContentPresenter.class.st index ffe0037..f6f1079 100644 --- a/src/Chest/ChestTableWithContentPresenter.class.st +++ b/src/Chest/ChestTableWithContentPresenter.class.st @@ -2,8 +2,8 @@ Minimal subpresenter used by `ChestPresenter` and some commands in the `Chest-Commands` package, that displays all chests with their contents, and a text input field to name different entities according to the context. " Class { - #name : #ChestTableWithContentPresenter, - #superclass : #SpPresenter, + #name : 'ChestTableWithContentPresenter', + #superclass : 'SpPresenter', #instVars : [ 'chestsTable', 'chestContentsTable', @@ -25,10 +25,12 @@ Class { 'buttonShallowCopy', 'buttonDeepCopy' ], - #category : #Chest + #category : 'Chest-Presenters', + #package : 'Chest', + #tag : 'Presenters' } -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildChestContentTableMenuGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -44,7 +46,7 @@ ChestTableWithContentPresenter class >> buildChestContentTableMenuGroupWith: aCh aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildChestContentTableToolbarGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -58,7 +60,7 @@ ChestTableWithContentPresenter class >> buildChestContentTableToolbarGroupWith: aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildChestTableMenuGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -73,7 +75,7 @@ ChestTableWithContentPresenter class >> buildChestTableMenuGroupWith: aChestWith aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildChestTableToolbarGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -87,7 +89,7 @@ ChestTableWithContentPresenter class >> buildChestTableToolbarGroupWith: aChestW aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildCommandsGroupWith: aChestWithTablePresenter forRoot: aCmCommandGroup [ self @@ -110,7 +112,7 @@ ChestTableWithContentPresenter class >> buildCommandsGroupWith: aChestWithTableP forRoot: aCmCommandGroup ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildTreeTableMenuGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -126,7 +128,7 @@ ChestTableWithContentPresenter class >> buildTreeTableMenuGroupWith: aChestWithC aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> buildTreeTableToolbarGroupWith: aChestWithContentPresenter forRoot: aRoot [ | group | @@ -140,43 +142,43 @@ ChestTableWithContentPresenter class >> buildTreeTableToolbarGroupWith: aChestWi aRoot register: group ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestContentMenuGroupName [ ^ 'ChestContentMenu' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestContentToolbarGroupName [ ^ 'ChestContentToolbar' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestMenuGroupName [ ^ 'ChestMenu' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestToolbarGroupName [ ^ 'ChestToolbar' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestWithContentMenuGroupName [ ^ 'ChestWithContentMenu' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> chestWithContentToolbarGroupName [ ^ 'ChestWithContentToolbar' ] -{ #category : #commands } +{ #category : 'commands' } ChestTableWithContentPresenter class >> registerClasses: commandClasses toGroup: aGroup withContext: aChestWithContentPresenter [ commandClasses do: [ :aClass | @@ -187,67 +189,67 @@ ChestTableWithContentPresenter class >> registerClasses: commandClasses toGroup: beHiddenWhenCantBeRun) ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> activePresenter [ ^ activePresenter ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> buttonDeepCopy [ ^ buttonDeepCopy ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> buttonNoCopy [ ^ buttonNoCopy ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> buttonShallowCopy [ ^ buttonShallowCopy ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> cancelButton [ ^ cancelButton ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> chestContentTable [ ^ chestContentsTable ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestContentTableContainer [ ^ chestContentTableContainer ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestContentsTableToolbar [ ^ chestContentsTableToolbar ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> chestContentsTableTransmitBlock [ ^ [ :selection | self updateChestContentToolbar ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestTableContainer [ ^ chestTableContainer ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestTableTransmitBlock [ ^ [ :aChest | @@ -264,31 +266,31 @@ ChestTableWithContentPresenter >> chestTableTransmitBlock [ self updateChestToolbar ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestTableWithContentContainer [ ^ chestTableWithContentContainer ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestWithContentTreeTable [ ^ chestWithContentTreeTable ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> chestsTable [ ^ chestsTable ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> chestsTableToolbar [ ^ chestsTableToolbar ] -{ #category : #'ui requests' } +{ #category : 'ui requests' } ChestTableWithContentPresenter >> confirm: aWarning [ ^ SpConfirmDialog new @@ -298,19 +300,19 @@ ChestTableWithContentPresenter >> confirm: aWarning [ cancelLabel: 'No' ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> confirmActionBar [ ^ confirmActionBar ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> confirmButton [ ^ confirmButton ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> connectPresenters [ chestsTable @@ -320,7 +322,7 @@ ChestTableWithContentPresenter >> connectPresenters [ chestContentsTable transmitDo: self chestContentsTableTransmitBlock ] -{ #category : #layout } +{ #category : 'layout' } ChestTableWithContentPresenter >> debuggerLayout [ activePresenter := self chestWithContentTreeTable. @@ -331,7 +333,7 @@ ChestTableWithContentPresenter >> debuggerLayout [ yourself ] -{ #category : #layout } +{ #category : 'layout' } ChestTableWithContentPresenter >> defaultLayout [ chestTableContainer @@ -355,13 +357,13 @@ ChestTableWithContentPresenter >> defaultLayout [ ^ chestTableWithContentContainer ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> eventChestRemoved: aChestRemovedAnnouncement [ self updateChestsTable ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> eventContentOfChestUpdated: aChestUpdatedAnnouncement [ | currentlySelectedChest updatedChest | @@ -376,13 +378,13 @@ ChestTableWithContentPresenter >> eventContentOfChestUpdated: aChestUpdatedAnnou self updateChestContentTableForChest: updatedChest ] ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> eventNewChest: aChestCreatedAnnouncement [ self updateChestsTable ] -{ #category : #layout } +{ #category : 'layout' } ChestTableWithContentPresenter >> headerLayoutWithTitle: aString withToolbar: aToolbar [ ^ SpBoxLayout newHorizontal @@ -394,20 +396,20 @@ ChestTableWithContentPresenter >> headerLayoutWithTitle: aString withToolbar: aT yourself ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> iconManager [ ^ Smalltalk ui icons ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> initialize [ super initialize. self subscribeToChestAnnouncer ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> initializePresenters [ self makeChestsTable. @@ -439,20 +441,20 @@ ChestTableWithContentPresenter >> initializePresenters [ self layout: self defaultLayout ] -{ #category : #initialization } +{ #category : 'initialization' } ChestTableWithContentPresenter >> initializeWindow: aWindowPresenter [ super initializeWindow: aWindowPresenter. aWindowPresenter whenClosedDo: [ self unsubscribeFromChestAnnouncer ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> inputField [ ^ inputField ] -{ #category : #layout } +{ #category : 'layout' } ChestTableWithContentPresenter >> loadCommandLayout [ | inputVariableNameColumn | @@ -486,7 +488,7 @@ ChestTableWithContentPresenter >> loadCommandLayout [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestContentTableContextMenu [ chestContentsTable contextMenu: [ @@ -497,7 +499,7 @@ ChestTableWithContentPresenter >> makeChestContentTableContextMenu [ chestContentsTable contextMenu value ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestContentsTable [ chestContentsTable := self newTable @@ -521,7 +523,7 @@ ChestTableWithContentPresenter >> makeChestContentsTable [ self makeChestContentTableContextMenu ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestContentsTableToolbar [ | toolbar | @@ -537,7 +539,7 @@ ChestTableWithContentPresenter >> makeChestContentsTableToolbar [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestTableContextMenu [ chestsTable contextMenu: [ @@ -547,7 +549,7 @@ ChestTableWithContentPresenter >> makeChestTableContextMenu [ chestsTable applyKeyBindingsFromMenu: chestsTable contextMenu value ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestTreeTableContextMenu [ chestWithContentTreeTable contextMenu: [ @@ -558,7 +560,7 @@ ChestTableWithContentPresenter >> makeChestTreeTableContextMenu [ chestWithContentTreeTable contextMenu value ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestTreeTableToolbar [ | toolbar | @@ -571,7 +573,7 @@ ChestTableWithContentPresenter >> makeChestTreeTableToolbar [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestWithContentTreeTable [ | treeTable | @@ -608,7 +610,7 @@ ChestTableWithContentPresenter >> makeChestWithContentTreeTable [ self makeChestTreeTableContextMenu ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestsTable [ chestsTable := self newTable @@ -628,7 +630,7 @@ ChestTableWithContentPresenter >> makeChestsTable [ self makeChestTableContextMenu ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeChestsTableToolbar [ | toolbar | @@ -644,7 +646,7 @@ ChestTableWithContentPresenter >> makeChestsTableToolbar [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeConfirmActionBar [ confirmButton := self newButton @@ -662,7 +664,7 @@ ChestTableWithContentPresenter >> makeConfirmActionBar [ yourself ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeCopyRadioButtons [ buttonNoCopy := self newRadioButton. @@ -678,7 +680,7 @@ ChestTableWithContentPresenter >> makeCopyRadioButtons [ buttonDeepCopy label: 'Deep copy' ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> makeInputField [ ^ self newTextInput @@ -690,13 +692,13 @@ ChestTableWithContentPresenter >> makeInputField [ yourself ] -{ #category : #'ui - requests' } +{ #category : 'ui - requests' } ChestTableWithContentPresenter >> namingQuery [ ^ 'What name do you want to give to your object?' ] -{ #category : #'ui - requests' } +{ #category : 'ui - requests' } ChestTableWithContentPresenter >> popupWithPresenter: requestPresenter onRightTo: anItem [ (self newPopover @@ -706,7 +708,7 @@ ChestTableWithContentPresenter >> popupWithPresenter: requestPresenter onRightTo yourself) popup ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> presenterToNameNewChest [ ^ ChestRequestDialogPresenter @@ -732,7 +734,7 @@ ChestTableWithContentPresenter >> presenterToNameNewChest [ newChestName , ' is not a valid name for a chest.' ] ] ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> presenterToRenameChest: chest [ ^ ChestRequestDialogPresenter @@ -759,7 +761,7 @@ ChestTableWithContentPresenter >> presenterToRenameChest: chest [ , ' is not a valid name for a chest.' ] ] ] -{ #category : #'presenter building' } +{ #category : 'presenter building' } ChestTableWithContentPresenter >> presenterToRenameObject: object inChest: chest [ ^ ChestRequestDialogPresenter @@ -779,7 +781,7 @@ ChestTableWithContentPresenter >> presenterToRenameObject: object inChest: chest name , ' is not a valid name an object.' ] ] ] -{ #category : #removing } +{ #category : 'removing' } ChestTableWithContentPresenter >> removeAllChests [ | items | @@ -791,7 +793,7 @@ ChestTableWithContentPresenter >> removeAllChests [ items copy do: [ :chest | chest remove ] ] -{ #category : #removing } +{ #category : 'removing' } ChestTableWithContentPresenter >> removeAllItemsFromSelectedChest [ | items | @@ -804,7 +806,7 @@ ChestTableWithContentPresenter >> removeAllItemsFromSelectedChest [ items do: [ :assoc | self selectedChest remove: assoc value ] ] -{ #category : #removing } +{ #category : 'removing' } ChestTableWithContentPresenter >> removeSelectedChest [ self flag: 'to do with polymorphism'. @@ -815,7 +817,7 @@ ChestTableWithContentPresenter >> removeSelectedChest [ (1 max: chestsTable selection selectedIndex - 1) ] -{ #category : #removing } +{ #category : 'removing' } ChestTableWithContentPresenter >> removeSelectedItem [ | assoc | @@ -832,7 +834,7 @@ ChestTableWithContentPresenter >> removeSelectedItem [ chestContentsTable selection selectedIndex - 1 ] ] -{ #category : #renaming } +{ #category : 'renaming' } ChestTableWithContentPresenter >> renameSelectedChest [ self flag: 'to do with polymorphism'. @@ -844,7 +846,7 @@ ChestTableWithContentPresenter >> renameSelectedChest [ ifFalse: [ chestsTable ]) ] -{ #category : #renaming } +{ #category : 'renaming' } ChestTableWithContentPresenter >> renameSelectedItem [ "need to redo renaming and removing + event handlers to take into account tree table (+ add load commands in ChestPresenter for treeTable menu)" @@ -859,7 +861,7 @@ ChestTableWithContentPresenter >> renameSelectedItem [ ifFalse: [ chestContentsTable ]) ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> requestExpressionToStoreInChest [ | expression selectedChest expressionName | @@ -877,7 +879,7 @@ ChestTableWithContentPresenter >> requestExpressionToStoreInChest [ expressionName }) ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> requestNameNewChest [ | requestPresenter | @@ -885,7 +887,7 @@ ChestTableWithContentPresenter >> requestNameNewChest [ self popupWithPresenter: requestPresenter onRightTo: activePresenter ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> requestRenameChest: chest fromContextMenuItem: anItem [ | requestPresenter | @@ -893,7 +895,7 @@ ChestTableWithContentPresenter >> requestRenameChest: chest fromContextMenuItem: self popupWithPresenter: requestPresenter onRightTo: anItem ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> requestRenameObjectFromChest: objectNameValueAssociation fromContextMenuItem: anItem [ | chest requestPresenter object | @@ -910,7 +912,7 @@ ChestTableWithContentPresenter >> requestRenameObjectFromChest: objectNameValueA self popupWithPresenter: requestPresenter onRightTo: anItem ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> selectedChest [ self flag: 'to do with polymorphism'. @@ -923,7 +925,7 @@ ChestTableWithContentPresenter >> selectedChest [ ^ chestsTable selection selectedItem ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> selectedItem [ self flag: 'to do with polymorphism'. @@ -936,7 +938,7 @@ ChestTableWithContentPresenter >> selectedItem [ ^ chestContentsTable selection selectedItem ] -{ #category : #layout } +{ #category : 'layout' } ChestTableWithContentPresenter >> storeCommandLayout [ self makeChestContentsTable. @@ -964,7 +966,7 @@ ChestTableWithContentPresenter >> storeCommandLayout [ yourself ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> storeExpression: expression inChest: aChest [ | result | @@ -974,7 +976,7 @@ ChestTableWithContentPresenter >> storeExpression: expression inChest: aChest [ ^ aChest add: result ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> subscribeToChestAnnouncer [ self @@ -983,7 +985,7 @@ ChestTableWithContentPresenter >> subscribeToChestAnnouncer [ subscribeToChestRemovedAnnouncement ] -{ #category : #subscription } +{ #category : 'subscription' } ChestTableWithContentPresenter >> subscribeToChestCreatedAnnouncement [ Chest announcer weak @@ -992,7 +994,7 @@ ChestTableWithContentPresenter >> subscribeToChestCreatedAnnouncement [ to: self ] -{ #category : #subscription } +{ #category : 'subscription' } ChestTableWithContentPresenter >> subscribeToChestRemovedAnnouncement [ Chest announcer weak @@ -1001,7 +1003,7 @@ ChestTableWithContentPresenter >> subscribeToChestRemovedAnnouncement [ to: self ] -{ #category : #subscription } +{ #category : 'subscription' } ChestTableWithContentPresenter >> subscribeToChestUpdatedAnnouncement [ Chest announcer weak @@ -1010,19 +1012,19 @@ ChestTableWithContentPresenter >> subscribeToChestUpdatedAnnouncement [ to: self ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> title [ ^ 'Choose a variable name for your object' ] -{ #category : #subscription } +{ #category : 'subscription' } ChestTableWithContentPresenter >> unsubscribeFromChestAnnouncer [ Chest unsubscribe: self ] -{ #category : #update } +{ #category : 'update' } ChestTableWithContentPresenter >> updateChestContentTableForChest: aChest [ self flag: 'to do with polymorphism'. @@ -1034,19 +1036,19 @@ ChestTableWithContentPresenter >> updateChestContentTableForChest: aChest [ lst items: aChest contents associations asOrderedCollection ] ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> updateChestContentToolbar [ self updateToolbar: chestContentsTableToolbarCommandGroup ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> updateChestToolbar [ self updateToolbar: chestTableToolbarCommandGroup ] -{ #category : #updating } +{ #category : 'updating' } ChestTableWithContentPresenter >> updateChestsTable [ self flag: 'to do with polymorphism'. @@ -1057,14 +1059,14 @@ ChestTableWithContentPresenter >> updateChestsTable [ chestsTable ifNotNil: [ :lst | lst items: Chest allChests ] ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTableWithContentPresenter >> updateToolbar: aCmCommandGroup [ aCmCommandGroup allCommands do: [ :spCommand | spCommand updateEnableStatus ] ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> warningNamingChest: newChestName [ ^ '`' , newChestName @@ -1072,7 +1074,7 @@ ChestTableWithContentPresenter >> warningNamingChest: newChestName [ '` is the name of a chest that already exists. If you proceed, all objects in the existing chest will be lost. Are you sure you want to proceed?' ] -{ #category : #'ui - dialogs' } +{ #category : 'ui - dialogs' } ChestTableWithContentPresenter >> warningNamingObjectInChest: newObjectName [ ^ '`' , newObjectName diff --git a/src/Chest/ChestUpdated.class.st b/src/Chest/ChestUpdated.class.st index c4227d4..73b61a7 100644 --- a/src/Chest/ChestUpdated.class.st +++ b/src/Chest/ChestUpdated.class.st @@ -2,16 +2,18 @@ Announcement made by a `ChestAnnouncer` when the content of a chest has been updated. " Class { - #name : #ChestUpdated, - #superclass : #Announcement, + #name : 'ChestUpdated', + #superclass : 'Announcement', #instVars : [ 'updatedChest', 'newContent' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } ChestUpdated class >> new: updatedChest withContent: newContent [ ^ self new @@ -20,25 +22,25 @@ ChestUpdated class >> new: updatedChest withContent: newContent [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } ChestUpdated >> newContent [ ^ newContent ] -{ #category : #accessing } +{ #category : 'accessing' } ChestUpdated >> newContent: anObject [ newContent := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } ChestUpdated >> updatedChest [ ^ updatedChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestUpdated >> updatedChest: anObject [ updatedChest := anObject diff --git a/src/Chest/ClipboardChest.class.st b/src/Chest/ClipboardChest.class.st index a9ba19b..9e06341 100644 --- a/src/Chest/ClipboardChest.class.st +++ b/src/Chest/ClipboardChest.class.st @@ -1,29 +1,124 @@ Class { - #name : #ClipboardChest, - #superclass : #WeakChest, - #category : #Chest + #name : 'ClipboardChest', + #superclass : 'WeakChest', + #instVars : [ + 'lastClipboardKeys', + 'maxSize', + 'currentSize' + ], + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #icons } +{ #category : 'icons' } ClipboardChest class >> chestIcon [ ^ Smalltalk ui icons iconNamed: 'smallCopy' ] -{ #category : #accessing } +{ #category : 'accessing' } ClipboardChest class >> clipboardEntryName [ ^ 'clipboardEntry' ] -{ #category : #'default values' } +{ #category : 'default values' } ClipboardChest class >> defaultInstanceName [ ^ 'ClipboardDefault' ] -{ #category : #accessing } +{ #category : 'accessing' } +ClipboardChest class >> lastClipboardKeys [ + + ^ self defaultInstance lastClipboardKeys +] + +{ #category : 'accessing' } +ClipboardChest class >> maxSize [ + + ^ self defaultInstance maxSize +] + +{ #category : 'accessing' } +ClipboardChest class >> maxSize: anInteger [ + + self defaultInstance maxSize: anInteger +] + +{ #category : 'removing' } +ClipboardChest class >> removeFirstClipboardEntry [ + + self defaultInstance removeFirstClipboardEntry +] + +{ #category : 'accessing' } +ClipboardChest >> at: aString put: anObject [ + + | result | + result := super at: aString put: anObject. + lastClipboardKeys add: aString. + currentSize = maxSize + ifTrue: [ self removeFirstClipboardEntry ] + ifFalse: [ currentSize := currentSize - 1 ]. + ^ result +] + +{ #category : 'accessing' } ClipboardChest >> clipboardEntryName [ ^ self class clipboardEntryName ] + +{ #category : 'initialization' } +ClipboardChest >> initializeContents [ + + super initializeContents. + lastClipboardKeys := LinkedList new. + currentSize := 0 +] + +{ #category : 'accessing' } +ClipboardChest >> lastClipboardKeys [ + + ^ lastClipboardKeys copy +] + +{ #category : 'accessing' } +ClipboardChest >> maxSize [ + + ^ maxSize ifNil: [ maxSize := 10 ] +] + +{ #category : 'accessing' } +ClipboardChest >> maxSize: anInteger [ + + maxSize := anInteger. + 1 to: currentSize - maxSize do: [ self removeFirstClipboardEntry ] +] + +{ #category : 'accessing' } +ClipboardChest >> remove: anObject [ + + super remove: anObject. + currentSize := currentSize - 1 +] + +{ #category : 'removing' } +ClipboardChest >> removeFirstClipboardEntry [ + + | firstKey | + firstKey := lastClipboardKeys first + on: CollectionIsEmpty + do: [ "If the collection is empty, the next call will raise a proper exception for Chest" + nil ]. + self removeObjectNamed: firstKey +] + +{ #category : 'accessing' } +ClipboardChest >> removeObjectNamed: aString [ + + super removeObjectNamed: aString. + currentSize := currentSize - 1 +] diff --git a/src/Chest/Object.extension.st b/src/Chest/Object.extension.st index ebe8dba..0007e6a 100644 --- a/src/Chest/Object.extension.st +++ b/src/Chest/Object.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Object } +Extension { #name : 'Object' } -{ #category : #'*Chest' } +{ #category : '*Chest' } Object >> isChest [ ^ false diff --git a/src/Chest/ObjectNotInChestError.class.st b/src/Chest/ObjectNotInChestError.class.st index a03055b..d0b3735 100644 --- a/src/Chest/ObjectNotInChestError.class.st +++ b/src/Chest/ObjectNotInChestError.class.st @@ -2,7 +2,9 @@ Exception signaled when you want to remove or rename an object that is not in a chest. " Class { - #name : #ObjectNotInChestError, - #superclass : #Error, - #category : #'Chest-Errors' + #name : 'ObjectNotInChestError', + #superclass : 'Error', + #category : 'Chest-Errors', + #package : 'Chest', + #tag : 'Errors' } diff --git a/src/Chest/StDebugger.extension.st b/src/Chest/StDebugger.extension.st index 4c616fb..e48ff7a 100644 --- a/src/Chest/StDebugger.extension.st +++ b/src/Chest/StDebugger.extension.st @@ -1,12 +1,12 @@ -Extension { #name : #StDebugger } +Extension { #name : 'StDebugger' } -{ #category : #'*Chest' } +{ #category : '*Chest' } StDebugger >> bindings [ ^ self interactionModel bindings ] -{ #category : #'*Chest' } +{ #category : '*Chest' } StDebugger >> interactionModel [ ^ self code interactionModel diff --git a/src/Chest/StDebuggerExtensionInspectorNodeBuilderVisitor.extension.st b/src/Chest/StDebuggerExtensionInspectorNodeBuilderVisitor.extension.st index 200ee1e..982cf9f 100644 --- a/src/Chest/StDebuggerExtensionInspectorNodeBuilderVisitor.extension.st +++ b/src/Chest/StDebuggerExtensionInspectorNodeBuilderVisitor.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #StDebuggerExtensionInspectorNodeBuilderVisitor } +Extension { #name : 'StDebuggerExtensionInspectorNodeBuilderVisitor' } -{ #category : #'*Chest' } +{ #category : '*Chest' } StDebuggerExtensionInspectorNodeBuilderVisitor >> visitChest: aChestExtension [ | debuggerInteractionModel | diff --git a/src/Chest/StDebuggerExtensionVisitor.extension.st b/src/Chest/StDebuggerExtensionVisitor.extension.st index c5ec9cb..e03f2ec 100644 --- a/src/Chest/StDebuggerExtensionVisitor.extension.st +++ b/src/Chest/StDebuggerExtensionVisitor.extension.st @@ -1,5 +1,5 @@ -Extension { #name : #StDebuggerExtensionVisitor } +Extension { #name : 'StDebuggerExtensionVisitor' } -{ #category : #'*Chest' } +{ #category : '*Chest' } StDebuggerExtensionVisitor >> visitChest: aChestExtension [ ] diff --git a/src/Chest/TChestAssociation.trait.st b/src/Chest/TChestAssociation.trait.st index 0d7a877..3f7bde3 100644 --- a/src/Chest/TChestAssociation.trait.st +++ b/src/Chest/TChestAssociation.trait.st @@ -2,21 +2,23 @@ I'm a trait allowing associations to hold a variable name for a key-value association in chests, to be able to load objects into contexts with a different variable name than its key in the chest. " Trait { - #name : #TChestAssociation, + #name : 'TChestAssociation', #instVars : [ 'variableName' ], - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #icons } +{ #category : 'icons' } TChestAssociation classSide >> chestIcon [ ^ Smalltalk ui icons iconNamed: 'objects' ] -{ #category : #'instance creation' } +{ #category : 'instance creation' } TChestAssociation classSide >> key: key value: value variableName: variableName [ ^ self new @@ -25,31 +27,31 @@ TChestAssociation classSide >> key: key value: value variableName: variableName variableName: variableName ] -{ #category : #accessing } +{ #category : 'accessing' } TChestAssociation >> chestChildren [ ^ { } asOrderedCollection ] -{ #category : #accessing } +{ #category : 'accessing' } TChestAssociation >> chestEvaluation [ ^ self value ] -{ #category : #accessing } +{ #category : 'accessing' } TChestAssociation >> chestName [ ^ self key ] -{ #category : #accessing } +{ #category : 'accessing' } TChestAssociation >> variableName [ ^ variableName ] -{ #category : #accessing } +{ #category : 'accessing' } TChestAssociation >> variableName: aString [ Chest checkValidName: aString. diff --git a/src/Chest/WeakChest.class.st b/src/Chest/WeakChest.class.st index ad935a1..84d232b 100644 --- a/src/Chest/WeakChest.class.st +++ b/src/Chest/WeakChest.class.st @@ -2,50 +2,52 @@ I am a chest that holds weakly each object I contain. " Class { - #name : #WeakChest, - #superclass : #Chest, - #category : #Chest + #name : 'WeakChest', + #superclass : 'Chest', + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #icons } +{ #category : 'icons' } WeakChest class >> chestIcon [ ^ Smalltalk ui icons iconNamed: 'box' ] -{ #category : #accessing } +{ #category : 'accessing' } WeakChest class >> defaultInstance [ ^ defaultInstance ifNil: [ defaultInstance := self newNamed: self defaultInstanceName ] ] -{ #category : #'default values' } +{ #category : 'default values' } WeakChest class >> defaultInstanceName [ ^ 'WDefault' ] -{ #category : #'default values' } +{ #category : 'default values' } WeakChest class >> defaultNameForNewChest [ ^ 'WChest_' ] -{ #category : #'class initialization' } +{ #category : 'class initialization' } WeakChest class >> initialize [ nextAvailableID := 1. defaultInstance := nil ] -{ #category : #'wrapped protocol' } +{ #category : 'wrapped protocol' } WeakChest class >> weak [ ^ self ] -{ #category : #initialization } +{ #category : 'initialization' } WeakChest >> initializeContents [ contents := WeakChestContentDictionary new diff --git a/src/Chest/WeakChestAssociation.class.st b/src/Chest/WeakChestAssociation.class.st index 8960554..4825da0 100644 --- a/src/Chest/WeakChestAssociation.class.st +++ b/src/Chest/WeakChestAssociation.class.st @@ -2,10 +2,12 @@ I am a weak association (held on the value of the association) for Chests' contents, that can hold a variable name " Class { - #name : #WeakChestAssociation, - #superclass : #WeakValueAssociation, - #type : #weak, + #name : 'WeakChestAssociation', + #superclass : 'WeakValueAssociation', + #type : 'weak', #traits : 'TChestAssociation', #classTraits : 'TChestAssociation classTrait', - #category : #Chest + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } diff --git a/src/Chest/WeakChestContentDictionary.class.st b/src/Chest/WeakChestContentDictionary.class.st index 558ec32..f5591ec 100644 --- a/src/Chest/WeakChestContentDictionary.class.st +++ b/src/Chest/WeakChestContentDictionary.class.st @@ -2,12 +2,14 @@ I'm a dictionary used by `WeakChest` to keep weak references to objects a weak chest contains. " Class { - #name : #WeakChestContentDictionary, - #superclass : #ChestContentDictionary, - #category : #Chest + #name : 'WeakChestContentDictionary', + #superclass : 'ChestContentDictionary', + #category : 'Chest-Model', + #package : 'Chest', + #tag : 'Model' } -{ #category : #accessing } +{ #category : 'accessing' } WeakChestContentDictionary class >> associationClass [ ^ WeakChestAssociation diff --git a/src/Chest/package.st b/src/Chest/package.st index ab24c3f..e59808a 100644 --- a/src/Chest/package.st +++ b/src/Chest/package.st @@ -1 +1 @@ -Package { #name : #Chest } +Package { #name : 'Chest' } From be84c613f1d62e41edc49030bf7f2a6f02851ece Mon Sep 17 00:00:00 2001 From: "adrien.vanegue.etu" Date: Tue, 30 Apr 2024 14:50:56 +0200 Subject: [PATCH 2/4] adding tests for ClipboardChest + making some refactorings to make the tests pass --- .../ChestEventListenerForTest.class.st | 31 +- src/Chest-Tests/ChestTest.class.st | 77 ++--- src/Chest-Tests/ClipboardChest.extension.st | 7 + src/Chest-Tests/ClipboardChestTest.class.st | 291 ++++++++++++++++++ src/Chest-Tests/WeakChestTest.class.st | 13 +- src/Chest-Tests/package.st | 2 +- src/Chest/Chest.class.st | 18 +- src/Chest/ClipboardChest.class.st | 25 +- 8 files changed, 384 insertions(+), 80 deletions(-) create mode 100644 src/Chest-Tests/ClipboardChest.extension.st create mode 100644 src/Chest-Tests/ClipboardChestTest.class.st diff --git a/src/Chest-Tests/ChestEventListenerForTest.class.st b/src/Chest-Tests/ChestEventListenerForTest.class.st index e470b5c..9949b96 100644 --- a/src/Chest-Tests/ChestEventListenerForTest.class.st +++ b/src/Chest-Tests/ChestEventListenerForTest.class.st @@ -1,6 +1,6 @@ Class { - #name : #ChestEventListenerForTest, - #superclass : #Object, + #name : 'ChestEventListenerForTest', + #superclass : 'Object', #instVars : [ 'chestRemovedReceived', 'contentOfChestUpdatedReceived', @@ -10,26 +10,27 @@ Class { 'newContentsOfUpdatedChest', 'newChest' ], - #category : #'Chest-Tests' + #category : 'Chest-Tests', + #package : 'Chest-Tests' } -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> chestRemovedReceived [ ^ chestRemovedReceived ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> contentOfChestUpdatedReceived [ ^ contentOfChestUpdatedReceived ] -{ #category : #initialization } +{ #category : 'initialization' } ChestEventListenerForTest >> eventChestRemoved: aChestRemovedAnnouncement [ chestRemovedReceived := true. removedChest := aChestRemovedAnnouncement removedChest ] -{ #category : #initialization } +{ #category : 'initialization' } ChestEventListenerForTest >> eventContentOfChestUpdated: aChestUpdatedAnnouncement [ contentOfChestUpdatedReceived := true. updatedChest := aChestUpdatedAnnouncement updatedChest . @@ -37,40 +38,40 @@ ChestEventListenerForTest >> eventContentOfChestUpdated: aChestUpdatedAnnounceme ] -{ #category : #initialization } +{ #category : 'initialization' } ChestEventListenerForTest >> eventNewChest: aChestCreatedAnnouncement [ newChestReceived := true. newChest := aChestCreatedAnnouncement createdChest ] -{ #category : #initialization } +{ #category : 'initialization' } ChestEventListenerForTest >> initialize [ chestRemovedReceived := false. contentOfChestUpdatedReceived := false. newChestReceived := false ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> newChest [ ^ newChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> newChestReceived [ ^ newChestReceived ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> newContentsOfUpdatedChest [ ^ newContentsOfUpdatedChest ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> removedChest [ ^ removedChest ] -{ #category : #updating } +{ #category : 'updating' } ChestEventListenerForTest >> subscribeToChestAnnouncer [ Chest announcer weak when: ChestCreated send: #eventNewChest: to: self. @@ -80,7 +81,7 @@ ChestEventListenerForTest >> subscribeToChestAnnouncer [ ] -{ #category : #accessing } +{ #category : 'accessing' } ChestEventListenerForTest >> updatedChest [ ^ updatedChest ] diff --git a/src/Chest-Tests/ChestTest.class.st b/src/Chest-Tests/ChestTest.class.st index f5c32a7..a7391d6 100644 --- a/src/Chest-Tests/ChestTest.class.st +++ b/src/Chest-Tests/ChestTest.class.st @@ -1,25 +1,26 @@ Class { - #name : #ChestTest, - #superclass : #TestCase, + #name : 'ChestTest', + #superclass : 'TestCase', #instVars : [ 'initialChests' ], - #category : #'Chest-Tests' + #category : 'Chest-Tests', + #package : 'Chest-Tests' } -{ #category : #tests } +{ #category : 'tests' } ChestTest class >> chestClass [ ^ Chest ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> chestClass [ ^ self class chestClass ] -{ #category : #accessing } +{ #category : 'accessing' } ChestTest >> firstChestNameAvailable [ "provides a name of a chest that doesn't already exists" @@ -36,7 +37,7 @@ ChestTest >> firstChestNameAvailable [ ^ firstNameAvailable ] -{ #category : #running } +{ #category : 'running' } ChestTest >> setUp [ "Hooks that subclasses may override to define the fixture of test." @@ -45,7 +46,7 @@ ChestTest >> setUp [ initialChests := Chest allChests copy "Keep a copy of all the chests that currently exist" ] -{ #category : #running } +{ #category : 'running' } ChestTest >> tearDown [ | nowChests | @@ -58,12 +59,12 @@ ChestTest >> tearDown [ super tearDown ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAddRemoveToChest [ self testAddRemoveToChest: self chestClass new. ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAddRemoveToChest: aChest [ | c o1 o2 initialChestSize o1Name o2Name | c := aChest. @@ -83,13 +84,13 @@ ChestTest >> testAddRemoveToChest: aChest [ ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAddRemoveToDefaultChest [ "Tests that the Chest class itself works as a chest" self testAddRemoveToChest: self chestClass. ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAddingAnObjectTwiceInSameChestWithDifferentNamesRemoveTheOldKeyForThisObject [ | chest object oldName newName | @@ -105,7 +106,7 @@ ChestTest >> testAddingAnObjectTwiceInSameChestWithDifferentNamesRemoveTheOldKey self should: [ chest at: oldName ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAlwaysGiveFreshIDToNewChests [ | c1 c2 c3 idList c4 | c1 := self chestClass new. @@ -123,7 +124,7 @@ ChestTest >> testAlwaysGiveFreshIDToNewChests [ ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testAtPutAddsObjectToChestWithCorrectName [ | chest object | @@ -137,7 +138,7 @@ ChestTest >> testAtPutAddsObjectToChestWithCorrectName [ self assert: (chest at: 'toto') identicalTo: object ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testCannotNameChestWithInvalidName [ | chest | @@ -150,7 +151,7 @@ ChestTest >> testCannotNameChestWithInvalidName [ should: [ chest name: 'a/b' ] raise: ChestInvalidNameError ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testCannotNameObjectInChestWithInvalidName [ | chest | @@ -167,7 +168,7 @@ ChestTest >> testCannotNameObjectInChestWithInvalidName [ raise: ChestInvalidNameError ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testCannotReNameObjectInChestWithInvalidName [ | chest object | @@ -191,7 +192,7 @@ ChestTest >> testCannotReNameObjectInChestWithInvalidName [ assert: (chest at: '_1a') identicalTo: object ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testChestCreationWithCustomName [ | firstNameAvailable chestWithCustomName | @@ -207,7 +208,7 @@ ChestTest >> testChestCreationWithCustomName [ identicalTo: chestWithCustomName ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testChestCreationWithDefaultName [ | chestWithDefaultName1 chestWithDefaultName2 | @@ -227,7 +228,7 @@ ChestTest >> testChestCreationWithDefaultName [ identicalTo: chestWithDefaultName2 ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testChestCreationWithNameThatAlreadyExistsRaisesAnError [ | firstNameAvailable | @@ -242,7 +243,7 @@ ChestTest >> testChestCreationWithNameThatAlreadyExistsRaisesAnError [ raise: ChestKeyAlreadyInUseError ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testChestDictionaryProvidesCopyOfAllChests [ | chestDictionary firstNameAvailable | @@ -256,7 +257,7 @@ ChestTest >> testChestDictionaryProvidesCopyOfAllChests [ raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testContentsProvidesCopyOfChestContent [ | chest object contents objectInCopy | @@ -273,13 +274,13 @@ ChestTest >> testContentsProvidesCopyOfChestContent [ self should: [ chest at: 'titi' ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testDefaultInstance [ "Tests that the default instance of the Chest class does exist" self assert: (Chest defaultInstance isKindOf: Chest). ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testEmpty [ | chest | @@ -300,7 +301,7 @@ ChestTest >> testEmpty [ self should: [ chest at: 'titi' ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testEmptyChest [ | chest | @@ -316,7 +317,7 @@ ChestTest >> testEmptyChest [ self assert: chest contents size equals: 0 ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testGettingChestFromID [ "Tests that retrieving chests by their id works" | c1 c2 | @@ -329,7 +330,7 @@ ChestTest >> testGettingChestFromID [ self should: [ Chest named: c2 name ] raise: Error. ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testNotifications [ "Tests that the Chest class does indeed send the notifications it is supposed to" | l c o | @@ -358,7 +359,7 @@ ChestTest >> testNotifications [ self assert: l removedChest identicalTo: c. ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemove [ | chest | @@ -371,7 +372,7 @@ ChestTest >> testRemove [ self should: [ self chestClass named: chest name ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemoveChestNamed [ | chest | @@ -384,7 +385,7 @@ ChestTest >> testRemoveChestNamed [ self should: [ self chestClass named: chest name ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemoveChestNamedWithDefaultInstance [ | chest | @@ -398,7 +399,7 @@ ChestTest >> testRemoveChestNamedWithDefaultInstance [ self deny: self chestClass defaultInstance identicalTo: chest ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemoveObjectNamedWithExistingObject [ | chest | @@ -415,7 +416,7 @@ ChestTest >> testRemoveObjectNamedWithExistingObject [ self should: [ chest at: 'toto' ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemoveObjectNamedWithObjectThatDoesNotExist [ | chest | @@ -432,7 +433,7 @@ ChestTest >> testRemoveObjectNamedWithObjectThatDoesNotExist [ raise: ObjectNotInChestError ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRemoveWithDefaultInstance [ | chest | @@ -446,7 +447,7 @@ ChestTest >> testRemoveWithDefaultInstance [ self deny: self chestClass defaultInstance identicalTo: chest ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRenameObjectInto [ | chest object | @@ -462,7 +463,7 @@ ChestTest >> testRenameObjectInto [ self should: [ chest at: 'toto' ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRenameObjectIntoRaisesErrorWhenObjectIsNotInChest [ | chest objectToBeRenamed objectInChest | @@ -483,7 +484,7 @@ ChestTest >> testRenameObjectIntoRaisesErrorWhenObjectIsNotInChest [ self should: [ chest at: 'titi' ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRenameObjectIntoRaisesErrorWhenObjectOfSameNameAlreadyExists [ | chest objectToBeRenamed objectAlreadyHavingNewName | @@ -508,7 +509,7 @@ ChestTest >> testRenameObjectIntoRaisesErrorWhenObjectOfSameNameAlreadyExists [ self assert: (chest at: 'toto') identicalTo: objectToBeRenamed ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRenamingChestChangesItsKeyInDictionary [ | chest firstNameAvailable oldName | @@ -523,7 +524,7 @@ ChestTest >> testRenamingChestChangesItsKeyInDictionary [ self should: [ self chestClass named: oldName ] raise: KeyNotFound ] -{ #category : #tests } +{ #category : 'tests' } ChestTest >> testRenamingChestRaisesErrorWhenChestOfSameNameAlreadyExists [ | chestToBeRenamed firstNameAvailable oldName chestAlreadyHavingNewName | diff --git a/src/Chest-Tests/ClipboardChest.extension.st b/src/Chest-Tests/ClipboardChest.extension.st new file mode 100644 index 0000000..cf41ba2 --- /dev/null +++ b/src/Chest-Tests/ClipboardChest.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'ClipboardChest' } + +{ #category : '*Chest-Tests' } +ClipboardChest >> currentSize [ + + ^ currentSize +] diff --git a/src/Chest-Tests/ClipboardChestTest.class.st b/src/Chest-Tests/ClipboardChestTest.class.st new file mode 100644 index 0000000..fc70da2 --- /dev/null +++ b/src/Chest-Tests/ClipboardChestTest.class.st @@ -0,0 +1,291 @@ +Class { + #name : 'ClipboardChestTest', + #superclass : 'WeakChestTest', + #category : 'Chest-Tests', + #package : 'Chest-Tests' +} + +{ #category : 'tests' } +ClipboardChestTest >> chestClass [ + + ^ ClipboardChest +] + +{ #category : 'tests' } +ClipboardChestTest >> testAddObjectToClipboard [ + + | chest | + chest := self chestClass new. + chest at: 'v1' put: 1. + self assertCollection: chest lastClipboardKeys equals: #( 'v1' ). + self assert: (chest at: 'v1') equals: 1. + self assert: chest currentSize equals: 1. + + chest at: 'v2' put: 2. + self assertCollection: chest lastClipboardKeys equals: #( 'v1' 'v2' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: chest currentSize equals: 2. + + chest at: 'v3' put: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + self assert: chest currentSize equals: 3 +] + +{ #category : 'tests' } +ClipboardChestTest >> testAddObjectToClipboardWhenClipboardIsFull [ + + | chest | + chest := self chestClass new + maxSize: 3; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + + chest at: 'v4' put: 4. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v2' 'v3' 'v4' ). + self assert: (chest at: 'v4') equals: 4. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + self should: [ chest at: 'v1' ] raise: KeyNotFound +] + +{ #category : 'tests' } +ClipboardChestTest >> testAddObjectToClipboardWhenClipboardIsFullAndKeyAlreadyExists [ + + | chest | + chest := self chestClass new + maxSize: 3; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + + self + should: [ chest at: 'v2' put: 4 ] + raise: ChestKeyAlreadyInUseError. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3 +] + +{ #category : 'tests' } +ClipboardChestTest >> testAddObjectToClipboardWhenClipboardIsFullAndObjectAlreadyExists [ + + | chest | + chest := self chestClass new + maxSize: 3; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + + chest at: 'v4' put: 2. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v3' 'v4' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v4') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + self should: [ chest at: 'v2' ] raise: KeyNotFound +] + +{ #category : 'tests' } +ClipboardChestTest >> testClipboardDefaultInstance [ + + self assert: (self chestClass defaultInstance isKindOf: self chestClass) +] + +{ #category : 'tests' } +ClipboardChestTest >> testClipboardInitialize [ + + | chest | + chest := self chestClass new. + self assert: chest maxSize equals: 10. + self assert: chest contents size equals: 0. + self assertEmpty: chest lastClipboardKeys. + self assert: chest currentSize equals: 0 +] + +{ #category : 'tests' } +ClipboardChestTest >> testMaxSizeWhenChestIsExpanded [ + + | chest | + chest := self chestClass new + maxSize: 5; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + chest at: 'v4' put: 4. + chest at: 'v5' put: 5. + + self assert: chest maxSize equals: 5. + self assert: chest currentSize equals: 5. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' 'v4' 'v5' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + self assert: (chest at: 'v4') equals: 4. + self assert: (chest at: 'v5') equals: 5. + + chest maxSize: 10. + + self assert: chest maxSize equals: 10. + self assert: chest currentSize equals: 5. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' 'v4' 'v5' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + self assert: (chest at: 'v4') equals: 4. + self assert: (chest at: 'v5') equals: 5 +] + +{ #category : 'tests' } +ClipboardChestTest >> testMaxSizeWhenChestIsShrunk [ + + | chest | + chest := self chestClass new + maxSize: 5; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + chest at: 'v4' put: 4. + chest at: 'v5' put: 5. + + self assert: chest maxSize equals: 5. + self assert: chest currentSize equals: 5. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' 'v4' 'v5' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + self assert: (chest at: 'v4') equals: 4. + self assert: (chest at: 'v5') equals: 5. + + chest maxSize: 3. + + self assert: chest maxSize equals: 3. + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v3' 'v4' 'v5' ). + self assert: (chest at: 'v3') equals: 3. + self assert: (chest at: 'v4') equals: 4. + self assert: (chest at: 'v5') equals: 5. + self should: [ chest at: 'v1' ] raise: KeyNotFound. + self should: [ chest at: 'v2' ] raise: KeyNotFound +] + +{ #category : 'tests' } +ClipboardChestTest >> testRemoveFirstClipboardEntry [ + + | chest | + chest := self chestClass new + maxSize: 3; + yourself. + chest at: 'v1' put: 1. + chest at: 'v2' put: 2. + chest at: 'v3' put: 3. + + self assert: chest currentSize equals: 3. + self + assertCollection: chest lastClipboardKeys + equals: #( 'v1' 'v2' 'v3' ). + self assert: (chest at: 'v1') equals: 1. + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + + + chest removeFirstClipboardEntry. + + self assert: chest currentSize equals: 2. + self assertCollection: chest lastClipboardKeys equals: #( 'v2' 'v3' ). + self assert: (chest at: 'v2') equals: 2. + self assert: (chest at: 'v3') equals: 3. + self should: [ chest at: 'v1' ] raise: KeyNotFound. + + chest removeFirstClipboardEntry. + + self assert: chest currentSize equals: 1. + self assertCollection: chest lastClipboardKeys equals: #( 'v3' ). + self assert: (chest at: 'v3') equals: 3. + self should: [ chest at: 'v1' ] raise: KeyNotFound. + self should: [ chest at: 'v2' ] raise: KeyNotFound. + + chest removeFirstClipboardEntry. + + self assert: chest currentSize equals: 0. + self assertCollection: chest lastClipboardKeys equals: #( ). + self should: [ chest at: 'v1' ] raise: KeyNotFound. + self should: [ chest at: 'v2' ] raise: KeyNotFound. + self should: [ chest at: 'v2' ] raise: KeyNotFound +] + +{ #category : 'tests' } +ClipboardChestTest >> testRemoveFirstClipboardEntryWhenListIsEmpty [ + + | chest | + chest := self chestClass new + maxSize: 3; + yourself. + + self assert: chest currentSize equals: 0. + self assertCollection: chest lastClipboardKeys equals: #( ). + + self + should: [ chest removeFirstClipboardEntry ] + raise: ObjectNotInChestError +] diff --git a/src/Chest-Tests/WeakChestTest.class.st b/src/Chest-Tests/WeakChestTest.class.st index b746929..6c2331a 100644 --- a/src/Chest-Tests/WeakChestTest.class.st +++ b/src/Chest-Tests/WeakChestTest.class.st @@ -1,16 +1,17 @@ Class { - #name : #WeakChestTest, - #superclass : #ChestTest, - #category : #'Chest-Tests' + #name : 'WeakChestTest', + #superclass : 'ChestTest', + #category : 'Chest-Tests', + #package : 'Chest-Tests' } -{ #category : #tests } +{ #category : 'tests' } WeakChestTest >> chestClass [ ^ WeakChest ] -{ #category : #tests } +{ #category : 'tests' } WeakChestTest >> testAddObjectToWeakChest [ | chest object | @@ -27,7 +28,7 @@ WeakChestTest >> testAddObjectToWeakChest [ self assert: (chest at: 'toto') equals: nil ] -{ #category : #tests } +{ #category : 'tests' } WeakChestTest >> testWeakDefaultInstance [ self assert: (WeakChest defaultInstance isKindOf: WeakChest) diff --git a/src/Chest-Tests/package.st b/src/Chest-Tests/package.st index 343bfde..3ca4622 100644 --- a/src/Chest-Tests/package.st +++ b/src/Chest-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Chest-Tests' } +Package { #name : 'Chest-Tests' } diff --git a/src/Chest/Chest.class.st b/src/Chest/Chest.class.st index dc0c0b8..abc5128 100644 --- a/src/Chest/Chest.class.st +++ b/src/Chest/Chest.class.st @@ -357,12 +357,12 @@ Chest >> at: aString [ Chest >> at: aString put: anObject [ self checkValidName: aString. - (self contentsPrivate includesKey: aString) ifTrue: [ + (self contentsPrivate includesKey: aString) ifTrue: [ ChestKeyAlreadyInUseError signal: 'You cannot put an object named ' , aString , ' as it already exist in this chest' ]. - (self contentsPrivate keyForIdentity: anObject) ifNotNil: [ :key | - self contentsPrivate removeKey: key ]. "The idea is that an object has a unique key in a chest: its name. So if the object was already in a chest, the former key should be removed." + (self contentsPrivate keyForIdentity: anObject) ifNotNil: [ :key | + self removeKeySilently: key ]. "The idea is that an object has a unique key in a chest: its name. So if the object was already in a chest, the former key should be removed." self contentsPrivate at: aString put: anObject. (self contentsPrivate associationAt: aString) variableName: aString. self contentsUpdated. @@ -484,15 +484,21 @@ Chest >> remove [ { #category : 'accessing' } Chest >> remove: anObject [ - (contents keyForIdentity: anObject) ifNotNil: [ :key | - contents removeKey: key ]. + (contents keyForIdentity: anObject) ifNotNil: [ :key | + self removeKeySilently: key ]. self contentsUpdated ] +{ #category : 'accessing' } +Chest >> removeKeySilently: key [ + + ^ self contentsPrivate removeKey: key +] + { #category : 'accessing' } Chest >> removeObjectNamed: aString [ - [ self contentsPrivate removeKey: aString ] + [ self removeKeySilently: aString ] on: KeyNotFound do: [ ObjectNotInChestError signal ]. self contentsUpdated diff --git a/src/Chest/ClipboardChest.class.st b/src/Chest/ClipboardChest.class.st index 9e06341..d52a7bf 100644 --- a/src/Chest/ClipboardChest.class.st +++ b/src/Chest/ClipboardChest.class.st @@ -1,3 +1,6 @@ +" +I am a chest that holds weakly each object I contain and that is used to temporarily copy objects from somewhere and paste them later elsewhere. +" Class { #name : 'ClipboardChest', #superclass : 'WeakChest', @@ -59,9 +62,8 @@ ClipboardChest >> at: aString put: anObject [ | result | result := super at: aString put: anObject. lastClipboardKeys add: aString. - currentSize = maxSize - ifTrue: [ self removeFirstClipboardEntry ] - ifFalse: [ currentSize := currentSize - 1 ]. + currentSize = maxSize ifTrue: [ self removeFirstClipboardEntry ]. + currentSize := currentSize + 1. ^ result ] @@ -95,21 +97,15 @@ ClipboardChest >> maxSize [ ClipboardChest >> maxSize: anInteger [ maxSize := anInteger. - 1 to: currentSize - maxSize do: [ self removeFirstClipboardEntry ] -] - -{ #category : 'accessing' } -ClipboardChest >> remove: anObject [ - - super remove: anObject. - currentSize := currentSize - 1 + 1 to: currentSize - maxSize do: [ :i | + self removeFirstClipboardEntry ] ] { #category : 'removing' } ClipboardChest >> removeFirstClipboardEntry [ | firstKey | - firstKey := lastClipboardKeys first + firstKey := [ lastClipboardKeys first ] on: CollectionIsEmpty do: [ "If the collection is empty, the next call will raise a proper exception for Chest" nil ]. @@ -117,8 +113,9 @@ ClipboardChest >> removeFirstClipboardEntry [ ] { #category : 'accessing' } -ClipboardChest >> removeObjectNamed: aString [ +ClipboardChest >> removeKeySilently: aKey [ - super removeObjectNamed: aString. + super removeKeySilently: aKey. + lastClipboardKeys remove: aKey. currentSize := currentSize - 1 ] From 707c6775419f3f0019d9b5b268b50099b1295e4c Mon Sep 17 00:00:00 2001 From: "adrien.vanegue.etu" Date: Tue, 30 Apr 2024 14:53:37 +0200 Subject: [PATCH 3/4] initializing class variables that are not shared with superclasses --- src/Chest/ClipboardChest.class.st | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Chest/ClipboardChest.class.st b/src/Chest/ClipboardChest.class.st index d52a7bf..525441c 100644 --- a/src/Chest/ClipboardChest.class.st +++ b/src/Chest/ClipboardChest.class.st @@ -32,6 +32,13 @@ ClipboardChest class >> defaultInstanceName [ ^ 'ClipboardDefault' ] +{ #category : 'class initialization' } +ClipboardChest class >> initialize [ + + nextAvailableID := 1. + defaultInstance := nil +] + { #category : 'accessing' } ClipboardChest class >> lastClipboardKeys [ From 60f1aa8d5125f0a38fda4d764ae109d38c0bb1cc Mon Sep 17 00:00:00 2001 From: "adrien.vanegue.etu" Date: Tue, 30 Apr 2024 14:58:39 +0200 Subject: [PATCH 4/4] removing now useless methods --- src/Chest/ClipboardChest.class.st | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/Chest/ClipboardChest.class.st b/src/Chest/ClipboardChest.class.st index 525441c..4c504a3 100644 --- a/src/Chest/ClipboardChest.class.st +++ b/src/Chest/ClipboardChest.class.st @@ -20,12 +20,6 @@ ClipboardChest class >> chestIcon [ ^ Smalltalk ui icons iconNamed: 'smallCopy' ] -{ #category : 'accessing' } -ClipboardChest class >> clipboardEntryName [ - - ^ 'clipboardEntry' -] - { #category : 'default values' } ClipboardChest class >> defaultInstanceName [ @@ -74,12 +68,6 @@ ClipboardChest >> at: aString put: anObject [ ^ result ] -{ #category : 'accessing' } -ClipboardChest >> clipboardEntryName [ - - ^ self class clipboardEntryName -] - { #category : 'initialization' } ClipboardChest >> initializeContents [