Skip to content

Commit

Permalink
fixing bugs in actions of the tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
adri09070 committed Jun 9, 2023
1 parent a65b5fd commit c6da44d
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 c6da44d

Please sign in to comment.