Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added last selection index #635

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions src/PharoLauncher-Spec2/PhLImageCreationPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Class {
'imageNameCheck',
'isNameValid'
],
#classVars : [
'LastSelectedIndex'
],
#category : #'PharoLauncher-Spec2'
}

Expand Down Expand Up @@ -59,6 +62,16 @@ PhLImageCreationPresenter class >> example [
model: {PhLRemoteTemplate example}) open
]

{ #category : #accessing }
PhLImageCreationPresenter class >> lastSelectedIndex [
^ LastSelectedIndex
]

{ #category : #accessing }
PhLImageCreationPresenter class >> lastSelectedIndex: aNumber [
LastSelectedIndex := aNumber
]

{ #category : #initialization }
PhLImageCreationPresenter >> checkNewName: name [
"If the image name is taken we display a red cross. Else we display a validation sign.
Expand Down Expand Up @@ -161,8 +174,12 @@ PhLImageCreationPresenter >> initializePresenters [
display: [ :file | file basename ];
whenSelectionChangedDo: [ :selection |
selection selectedItem ifNotNil: [ :item |
self class lastSelectedIndex: selection selectedIndex.
initScriptText text: item model contents ] ];
yourself.

self initializeSelectedItem.

descriptionText := self newText.
editInitScriptButton := self newButton
addStyle: 'small';
Expand All @@ -176,6 +193,16 @@ PhLImageCreationPresenter >> initializePresenters [
createButton disable
]

{ #category : #initialization }
PhLImageCreationPresenter >> initializeSelectedItem [
| index |
index := self class lastSelectedIndex.
index ifNil: [ ^ self ].
(index between: 1 and: initScript items size)
ifTrue: [ ^ self class lastSelectedIndex: 1 ].
initScript selectIndex: index
]

{ #category : #testing }
PhLImageCreationPresenter >> isNameValid [
^ isNameValid
Expand Down
Loading