Skip to content

Commit

Permalink
Merge pull request #15 from adri09070/9-remove-was-sent-to-nil-when-r…
Browse files Browse the repository at this point in the history
…emoving-an-object-from-a-chest-with-the-tree-view-within-the-debugger

fixing bugs in actions of the tree view
  • Loading branch information
StevenCostiou authored Jul 31, 2023
2 parents 7dae9c7 + c6da44d commit c6dd43f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Chest/ChestTableWithContentPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,15 @@ ChestTableWithContentPresenter >> removeAllChests [
{ #category : #removing }
ChestTableWithContentPresenter >> removeAllItemsFromSelectedChest [

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

items := activePresenter == chestWithContentTreeTable
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 @@ -829,7 +830,7 @@ ChestTableWithContentPresenter >> selectedChest [
activePresenter == chestWithContentTreeTable ]) ifTrue: [
^ chestWithContentTreeTable selectedItem isChest
ifTrue: [ chestWithContentTreeTable selectedItem ]
ifFalse: [ nil ] ].
ifFalse: [ chestWithContentTreeTable parentOfSelected ] ].
^ chestsTable selection selectedItem
]

Expand Down
11 changes: 11 additions & 0 deletions src/Chest/SpTreeTablePresenter.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Extension { #name : #SpTreeTablePresenter }

{ #category : #'*Chest' }
SpTreeTablePresenter >> parentOfSelected [

| parentPath |
parentPath := self selection selectedPath.
parentPath ifEmpty: [ ^ nil ].
parentPath := parentPath allButLast.
^ self itemAtPath: parentPath ifAbsent: nil
]

0 comments on commit c6dd43f

Please sign in to comment.