Skip to content

Commit

Permalink
Merge pull request #34 from adri09070/27-In-the-Chest-tree-table-view…
Browse files Browse the repository at this point in the history
…-as-a-debugger-extension-Remove-item-context-menu-entry-raises-an-exception-remove-was-sent-to-nil

Fixing #selectedChest when selecting an item in the tree table view
  • Loading branch information
StevenCostiou authored May 6, 2024
2 parents 029ce79 + 41b8c08 commit 67c8b6f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 24 deletions.
28 changes: 16 additions & 12 deletions src/BaselineOfChest/BaselineOfChest.class.st
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
Class {
#name : #BaselineOfChest,
#superclass : #BaselineOf,
#category : #BaselineOfChest
#name : 'BaselineOfChest',
#superclass : 'BaselineOf',
#category : 'BaselineOfChest',
#package : 'BaselineOfChest'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfChest >> baseline: spec [

<baseline>
spec for: #common do: [
spec postLoadDoIt: #postload:package:.

spec
package: 'Chest';
package: 'Chest-Tests';
package: 'Chest-Commands';
package: 'Chest-Commands-Tests' ].
package: 'Chest-Tests' with: [ spec requires: #( 'Chest' ) ];
package: 'Chest-Commands' with: [ spec requires: #( 'Chest' ) ];
package: 'Chest-Commands-Tests'
with: [ spec requires: #( 'Chest-Commands' ) ] ].

spec
group: 'default'
with:
#( 'Chest' 'Chest-Commands' 'Chest-Tests' 'Chest-Commands-Tests' )
]

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfChest >> createChestExamples [

Chest at: 'fortyTwo' put: 42.
(Chest newNamed: 'ExampleChest')
| chestClass |
chestClass := self class environment at: #Chest ifAbsent: [ ^ self ].
chestClass at: 'fortyTwo' put: 42.
(chestClass newNamed: 'ExampleChest')
at: 'tata'
put: 'someExampleStringCalledTata'
]

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfChest >> postload: loader package: packageSpec [

self createChestExamples
Expand Down
2 changes: 1 addition & 1 deletion src/BaselineOfChest/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfChest }
Package { #name : 'BaselineOfChest' }
8 changes: 4 additions & 4 deletions src/Chest-Commands/ChestLoadObjectIntoCodeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ ChestLoadObjectIntoCodeCommand >> isVisibleForContext: aCodePresenter [
{ #category : 'execution' }
ChestLoadObjectIntoCodeCommand >> loadAssocIntoContext: assoc [

(context interactionModel hasBindingOf: assoc key)
ifTrue: [
(context interactionModel hasBindingOf: assoc variableName)
ifTrue: [
self
warnUserWhenDeletingBindingWithKey: assoc key
warnUserWhenDeletingBindingWithKey: assoc variableName
withNewValue: assoc value ]
ifFalse: [
ifFalse: [
self loadIntoContextObject: assoc value named: assoc variableName ]
]

Expand Down
2 changes: 1 addition & 1 deletion src/Chest/ChestPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ChestPresenter >> chestsTableToolbar [
{ #category : 'binding' }
ChestPresenter >> collectBindingsFromAllChests [

^ chestsTable items flatCollect: [ :each |
^ Chest allChests collect: [ :each |
self collectBindingsFromChest: each ]
]

Expand Down
18 changes: 12 additions & 6 deletions src/Chest/ChestTableWithContentPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -796,14 +796,15 @@ ChestTableWithContentPresenter >> removeAllChests [
{ #category : 'removing' }
ChestTableWithContentPresenter >> removeAllItemsFromSelectedChest [

| items |
| items chest |
self flag: 'to do with polymorphism'.

items := activePresenter == chestWithContentTreeTable
ifTrue: [
ifTrue: [
chestWithContentTreeTable childrenFor: self selectedChest ]
ifFalse: [ chestContentsTable items ].
items do: [ :assoc | self selectedChest remove: assoc value ]
chest := self selectedChest.
items do: [ :assoc | chest remove: assoc value ]
]

{ #category : 'removing' }
Expand Down Expand Up @@ -917,11 +918,16 @@ ChestTableWithContentPresenter >> selectedChest [

self flag: 'to do with polymorphism'.

(activePresenter isNotNil and: [
activePresenter == chestWithContentTreeTable ]) ifTrue: [
(activePresenter isNotNil and: [
activePresenter == chestWithContentTreeTable ]) ifTrue: [
^ chestWithContentTreeTable selectedItem isChest
ifTrue: [ chestWithContentTreeTable selectedItem ]
ifFalse: [ nil ] ].
ifFalse: [
chestWithContentTreeTable roots
detect: [ :root |
(chestWithContentTreeTable childrenFor: root)
identityIncludes: chestWithContentTreeTable selectedItem ]
ifNone: [ nil ] ] ].
^ chestsTable selection selectedItem
]

Expand Down

0 comments on commit 67c8b6f

Please sign in to comment.