Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/NewTools-Playground/StPlaygroundPage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ StPlaygroundPage >> defaultObjectInspectorClass [
^ StPlaygroundPagePresenter
]

{ #category : 'submorphs - add/remove' }
StPlaygroundPage >> delete [
"Delete the corresponding page"

self fileReference ensureDelete.
(self fileReference withExtension: 'ombu') ensureDelete
]

{ #category : 'accessing' }
StPlaygroundPage >> ensureContentsFlushed [

Expand Down
35 changes: 28 additions & 7 deletions src/NewTools-Playground/StPlaygroundPageSummaryPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Class {
#classTraits : 'SpTModel classTrait',
#instVars : [
'firstLineLabel',
'timeLabel'
'timeLabel',
'deleteIcon',
'deleteBlock'
],
#category : 'NewTools-Playground-View',
#package : 'NewTools-Playground',
Expand All @@ -27,13 +29,26 @@ StPlaygroundPageSummaryPresenter >> contents [
StPlaygroundPageSummaryPresenter >> initializePresenters [

layout := SpBoxLayout newTopToBottom
borderWidth: 1;
spacing: 2;
add: (firstLineLabel := self newLabel) expand: false;
add: (timeLabel := self newLabel) expand: false;
yourself.
borderWidth: 1;
spacing: 2;
add: (firstLineLabel := self newLabel) expand: false;
add: (SpBoxLayout newLeftToRight
spacing: 5;
borderWidth: 1;
add: (timeLabel := self newLabel);
add: (deleteIcon := self newButton) width: 25;
yourself)
expand: false;
yourself.

timeLabel addStyle: 'dim'
timeLabel addStyle: 'dim'.

deleteIcon
icon: (self iconNamed: #remove);
help: 'This action will remove the page from the playground and remove the persisted page.';
action: [
self model delete.
deleteBlock ifNotNil: [ deleteBlock value ] ]
]

{ #category : 'accessing' }
Expand All @@ -55,3 +70,9 @@ StPlaygroundPageSummaryPresenter >> updatePresenter [
firstLineLabel label: self pageTitle.
timeLabel label: self model modificationTime epiceaBrowsersAsString
]

{ #category : 'events' }
StPlaygroundPageSummaryPresenter >> whenDeleteButtonPressed: aBlock [

deleteBlock := aBlock
]
13 changes: 9 additions & 4 deletions src/NewTools-Playground/StPlaygroundPagesPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ StPlaygroundPagesPresenter >> pagesActions [
{ #category : 'initialization' }
StPlaygroundPagesPresenter >> pagesAsPresenters [

^ self pages collect: [ :each |
self
instantiate: StPlaygroundPageSummaryPresenter
on: each ]
^ self pages collect: [ :each |
(self instantiate: StPlaygroundPageSummaryPresenter on: each)
whenDeleteButtonPressed: [
| oldIndex |
"Refresh the list but keep the selected index to not jump in the list."
oldIndex := pageList selectedIndex.
pageList presenters: self pagesAsPresenters.
pageList selectIndex: oldIndex ];
yourself ]
]

{ #category : 'private' }
Expand Down
Loading