Skip to content

Commit

Permalink
Merge pull request #1 from adri09070/easy-refactorings
Browse files Browse the repository at this point in the history
Version 0.1: easy refactorings
  • Loading branch information
adri09070 authored Jan 20, 2023
2 parents 0de0aba + 874061b commit 8e41eb2
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 197 deletions.
2 changes: 1 addition & 1 deletion Chest-Commands/ChestCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Class {
{ #category : #'accessing - commands classes' }
ChestCommand class >> chestCodePresenterCommandClasses [

^ { ChestLoadObjectIntoCode }
^ { ChestLoadObjectIntoCodeCommand }
]

{ #category : #'accessing - commands classes' }
Expand Down
3 changes: 2 additions & 1 deletion Chest-Commands/ChestCommandTreeBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ ChestCommandTreeBuilder >> buildSpecCommand: commandClass forContext: aContext [
{ #category : #building }
ChestCommandTreeBuilder >> chestCommandClasses [

^ { ChestLoadObjectIntoCode }
^ { ChestLoadObjectIntoCodeCommand } select: [ :each |
each isVisibleForContext: codePresenter ]
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,49 @@
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 : #ChestLoadObjectIntoCode,
#name : #ChestLoadObjectIntoCodeCommand,
#superclass : #ChestCommand,
#category : #'Chest-Commands'
}

{ #category : #'accessing - defaults' }
ChestLoadObjectIntoCode class >> defaultDescription [
ChestLoadObjectIntoCodeCommand class >> defaultDescription [

^ 'Load an object from a chest into a code presenter'
]

{ #category : #initialization }
ChestLoadObjectIntoCode class >> defaultIconName [
ChestLoadObjectIntoCodeCommand class >> defaultIconName [

^ #group
]

{ #category : #'accessing - defaults' }
ChestLoadObjectIntoCode class >> defaultName [
ChestLoadObjectIntoCodeCommand class >> defaultName [

^ 'Load object from chest'
]

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

^ $c meta , $l meta
]

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

^ aCodePresenter canLoadBindings
]

{ #category : #accessing }
ChestLoadObjectIntoCode class >> variableTag [
ChestLoadObjectIntoCodeCommand class >> variableTag [

^ #comesFromChest
^ Chest comesFromChestVariableTag
]

{ #category : #initialization }
ChestLoadObjectIntoCode >> buildChoicePresenter [
ChestLoadObjectIntoCodeCommand >> buildChoicePresenter [

| choicePresenter |
choicePresenter := ChestTableWithContentPresenter new.
Expand Down Expand Up @@ -68,49 +74,46 @@ ChestLoadObjectIntoCode >> buildChoicePresenter [
]

{ #category : #testing }
ChestLoadObjectIntoCode >> canBeExecuted [
ChestLoadObjectIntoCodeCommand >> canBeExecuted [

^ self isVisibleForContext: context
]

{ #category : #execution }
ChestLoadObjectIntoCode >> execute [
ChestLoadObjectIntoCodeCommand >> execute [

| choicePresenter |
choicePresenter := self buildChoicePresenter.
choicePresenter open
]

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

^ aCodePresenter interactionModel isNotNil and: [
aCodePresenter interactionModel class allSelectors
identityIncludes: #addBinding: ]
]

{ #category : #'as yet unclassified' }
ChestLoadObjectIntoCode >> loadIntoContextObject: anObject named: objectName [
{ #category : #'private - commands' }
ChestLoadObjectIntoCodeCommand >> loadIntoContextObject: anObject named: objectName [

| metalink interactionModel |
| interactionModel |
interactionModel := self context interactionModel.
interactionModel addBinding:
((WorkspaceVariable key: objectName value: anObject)
propertyAt: self variableTag put: true;
yourself)
"metalink := MetaLink new.
metalink arguments: #(receiver arguments).
metalink metaObject: [:receiver :arguments| ]."
]

{ #category : #accessing }
ChestLoadObjectIntoCode >> variableTag [
ChestLoadObjectIntoCodeCommand >> variableTag [

^ self class variableTag
]

{ #category : #'as yet unclassified' }
ChestLoadObjectIntoCode >> warnUserWhenDeletingBindingWithKey: key withNewValue: newValue [
{ #category : #'private - commands' }
ChestLoadObjectIntoCodeCommand >> warnUserWhenDeletingBindingWithKey: key withNewValue: newValue [

| presenter |
presenter := ChestRequestDialogPresenter
Expand Down
2 changes: 1 addition & 1 deletion Chest-Commands/ChestStoreObjectCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ChestStoreObjectCommand class >> defaultShortcutKey [
^ $c meta , $s meta
]

{ #category : #'as yet unclassified' }
{ #category : #'private - commands' }
ChestStoreObjectCommand >> blockToEvaluateToStoreResult: result intoChest: chest withName: objectName withPresenter: choicePresenter [

^ [
Expand Down
7 changes: 7 additions & 0 deletions Chest-Commands/SpCodeInteractionModel.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #SpCodeInteractionModel }

{ #category : #'*Chest-Commands' }
SpCodeInteractionModel >> canLoadBindings [

^ false
]
6 changes: 6 additions & 0 deletions Chest-Commands/SpCodePresenter.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ SpCodePresenter class >> buildChestCommandsGroupWith: aCodePresenter forRoot: ro
<extensionCommands>
ChestCommandTreeBuilder buildCommandsGroupWith: aCodePresenter forRoot: rootCommandGroup
]

{ #category : #'*Chest-Commands' }
SpCodePresenter >> canLoadBindings [

^ self interactionModel canLoadBindings
]
7 changes: 7 additions & 0 deletions Chest-Commands/SpCodeScriptingInteractionModel.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #SpCodeScriptingInteractionModel }

{ #category : #'*Chest-Commands' }
SpCodeScriptingInteractionModel >> canLoadBindings [

^ true
]
7 changes: 7 additions & 0 deletions Chest-Commands/StDebuggerContextInteractionModel.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #StDebuggerContextInteractionModel }

{ #category : #'*Chest-Commands' }
StDebuggerContextInteractionModel >> canLoadBindings [

^ true
]
Loading

0 comments on commit 8e41eb2

Please sign in to comment.