migrating interactions
MODIFY
src/PharoLauncher-Core/PhLUIConfirmation.class.st
src/PharoLauncher-Core/PhLUIConfirmation.class.st
@@ -7,12 +7,15 @@ Class {
#instVars : [
'message'
],
- #category : 'PharoLauncher-Core-Commands'
+ #category : #'PharoLauncher-Core-Commands'
}
{ #category : #action }
PhLUIConfirmation >> confirm [
- ^ UIManager default confirm: message
+
+ ^ self application newConfirm
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #accessing }

MODIFY
src/PharoLauncher-Core/PhLUIInformation.class.st
src/PharoLauncher-Core/PhLUIInformation.class.st
@@ -7,32 +7,51 @@ Class {
#instVars : [
'message'
],
- #category : 'PharoLauncher-Core-Commands'
+ #category : #'PharoLauncher-Core-Commands'
}
{ #category : #action }
PhLUIInformation >> abort [
- UIManager default abort: message
+
+ self application newInform
+ title: 'Error';
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #action }
PhLUIInformation >> alert [
- UIManager default alert: message
+
+ self application newInform
+ title: 'Alert';
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #action }
PhLUIInformation >> deny [
- UIManager default deny: message
+
+ self application newInform
+ title: 'Access Denied';
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #action }
PhLUIInformation >> denyWithTitle: titleString [
- UIManager default deny: message title: titleString
+
+ self application newInform
+ title: titleString;
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #action }
PhLUIInformation >> inform [
- UIManager inform: message
+
+ self application newInform
+ label: message;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #accessing }

MODIFY
src/PharoLauncher-Core/PhLUIRequest.class.st
src/PharoLauncher-Core/PhLUIRequest.class.st
@@ -14,23 +14,33 @@ Class {
{ #category : #action }
PhLUIRequest >> chooseFrom: aListOfChoices [
- ^ UIManager default
- chooseFrom: aListOfChoices
- lines: #()
- title: title
+
+ ^ self application newSelect
+ title: title;
+ items: aListOfChoices;
+ openModalWithSpecParent: self application topWindow
]
{ #category : #accessing }
PhLUIRequest >> initialAnswer: aString [
+
initialAnswer := aString
]
{ #category : #action }
PhLUIRequest >> request [
| answer |
- [ answer := UIManager default request: title initialAnswer: initialAnswer ]
- doWhileTrue: [ answer isNotNil and: [ validationBlock isNotNil and: [ (validationBlock value: answer) not ] ] ].
- "answer is nil when the user press cancels. That's a possible answer we have to accept."
+
+ [
+ answer := self application newRequest
+ title: title;
+ text: initialAnswer;
+ openModalWithSpecParent: self application topWindow.
+ ] doWhileTrue: [
+ answer isNotNil
+ and: [ validationBlock isNotNil
+ and: [ (validationBlock value: answer) not ] ] ].
+
^ answer
]

MODIFY
src/PharoLauncher-Core/PhLUserInteraction.class.st
src/PharoLauncher-Core/PhLUserInteraction.class.st
Class {
#name : #PhLUserInteraction,
#superclass : #Object,
- #category : 'PharoLauncher-Core-Commands'
+ #category : #'PharoLauncher-Core-Commands'
}
+
+{ #category : #accessing }
+PhLUserInteraction >> application [
+
+ ^ PharoLauncherApplication default
+]

MODIFY
src/PharoLauncher-Spec2-Gtk/PhLGtkConfiguration.class.st
src/PharoLauncher-Spec2-Gtk/PhLGtkConfiguration.class.st
@@ -11,7 +11,7 @@ PhLGtkConfiguration >> configureGeneral: anApplication [
toolbar.compact {
font-size: 0.6em }
toolbar.compact toolbutton > button {
- padding: 2px;
- margin: 2px }
+ padding: 1px;
+ margin: 1px }
'
]

MODIFY
src/PharoLauncher-Spec2/PhLImageCreationPresenter.class.st
src/PharoLauncher-Spec2/PhLImageCreationPresenter.class.st
@@ -27,10 +27,13 @@ Class {
{ #category : #specs }
PhLImageCreationPresenter class >> defaultSpec [
+
^ SpBoxLayout newVertical
+ borderWidth: 5;
spacing: 5;
add: 'Image name:' expand: false;
add: (SpBoxLayout newHorizontal
+ spacing: 5;
add: #imageName;
add: #imageNameCheck expand: false;
yourself)
@@ -39,12 +42,13 @@ PhLImageCreationPresenter class >> defaultSpec [
add: #descriptionText height: 60;
add: 'Initialization script:' expand: false;
add: (SpBoxLayout newHorizontal
+ spacing: 5;
add: #initScript;
add: #editInitScriptButton expand: false;
yourself)
expand: false;
add: #initScriptText height: 100;
- add: #createButton expand: false;
+ addLast: #createButton expand: false;
yourself
]
@@ -125,6 +129,7 @@ PhLImageCreationPresenter >> initialize [
{ #category : #initialization }
PhLImageCreationPresenter >> initializePresenters [
+
imageName := self newTextInput.
imageNameCheck := self newImage.
initScriptText := self newText
@@ -150,13 +155,16 @@ PhLImageCreationPresenter >> initializePresenters [
[ createImageCommand execute.
self close. ]
on: PhLNameNotAvailableError
- do: [ PhLUIInformation new
+ do: [
+ self newInformation
message: 'An image with the same name already exists! Please choose a new one.';
alert ] ] ]
]
{ #category : #initialization }
PhLImageCreationPresenter >> modelChanged [
+'OK' crTrace.
+self template crTrace.
self template ifNil: [ ^ self ].
self template isTemplate
ifTrue: [ self enable.

MODIFY
src/PharoLauncher-Spec2/PhLImageDetailPresenter.class.st
src/PharoLauncher-Spec2/PhLImageDetailPresenter.class.st
@@ -17,7 +17,8 @@ Class {
'location',
'vm',
'templateUrl',
- 'shouldRunInitializationScript'
+ 'shouldRunInitializationScript',
+ 'updating'
],
#category : #'PharoLauncher-Spec2'
}
@@ -25,23 +26,7 @@ Class {
{ #category : #specs }
PhLImageDetailPresenter class >> defaultSpec [
- ^ SpBoxLayout newTopToBottom
- add: #imageLabel expand: false;
- add: (SpGridLayout new
- beRowNotHomogeneous;
- beColumnNotHomogeneous;
- column: 1 withConstraints: [ :c | c beNotExpand; vAlignStart ];
- column: 2 withConstraints: [ :c | c beExpand ];
- add: 'Description' at: 1@1; add: #description at: 2@1;
- add: 'Origin template' at: 1@2; add: #template at: 2@2;
- add: #templateUrl at: 2@3;
- add: 'Initialization script' at: 1@4; add: (SpBoxLayout newLeftToRight
- add: #initializationScript expand: false;
- add: #shouldRunInitializationScript expand: false;
- yourself) at: 2@4;
- add: 'Location' at: 1@5; add: #location at: 2@5;
- yourself);
- yourself
+ ^ nil
]
{ #category : #specs }
@@ -59,10 +44,9 @@ PhLImageDetailPresenter class >> labelWidth [
{ #category : #initialization }
PhLImageDetailPresenter >> connectPresenters [
- description
- whenTextChangedDo: [ :text | PhLImageDescriptionUpdater image: self image description: text ].
- shouldRunInitializationScript
- whenChangedDo: [ :state | self image shouldRunInitializationScript: state ].
+
+ description whenTextChangedDo: [ :text | self updateImageDescription: text ].
+ shouldRunInitializationScript whenChangedDo: [ :state | self updateImageRunScript: state ].
]
{ #category : #accessing }
@@ -80,8 +64,16 @@ PhLImageDetailPresenter >> imageLabel [
^ imageLabel
]
+{ #category : #initialization }
+PhLImageDetailPresenter >> initialize [
+
+ updating := false.
+ super initialize.
+]
+
{ #category : #initialization }
PhLImageDetailPresenter >> initializePresenters [
+
imageLabel := self newLabel.
description := self newText.
template := self newLabel.
@@ -92,6 +84,23 @@ PhLImageDetailPresenter >> initializePresenters [
disable.
location := self newLabel.
vm := self newTextInput.
+
+ self layout: (SpGridLayout new
+ beRowNotHomogeneous;
+ beColumnNotHomogeneous;
+ "column: 1 withConstraints: [ :c | c beNotExpand ];"
+ column: 2 withConstraints: [ :c | c beExpand ];
+ add: imageLabel at: 1@1 span: 2@1;
+ add: 'Description' at: 1@2; add: description at: 2@2;
+ add: 'Origin template' at: 1@3; add: template at: 2@3;
+ add: templateUrl at: 2@4;
+ add: 'Initialization script' at: 1@5; add: (SpBoxLayout newLeftToRight
+ add: initializationScript expand: false;
+ add: shouldRunInitializationScript expand: false;
+ yourself)
+ at: 2@5;
+ add: 'Location' at: 1@6; add: location at: 2@6;
+ yourself)
]
{ #category : #accessing }
@@ -102,14 +111,18 @@ PhLImageDetailPresenter >> location [
{ #category : #updating }
PhLImageDetailPresenter >> modelChanged [
| image |
+
+ updating := true.
+
image := self image ifNil: [ PhLNullImage new ].
- imageLabel label: image name asText allBold, ' image, last edited ', image lastModification asString.
+ imageLabel label: image name, ' image, last edited ', image lastModification asString.
description text: image description.
- template label: image originTemplateName.
+ template label: (image originTemplateName ifEmpty: [ '(noname)' ]).
templateUrl label: image originTemplateUrl.
image initializationScript
- ifNil: [ initializationScript label: '<none>'.
+ ifNil: [
+ initializationScript label: '<none>'.
shouldRunInitializationScript disable. ]
ifNotNil: [ :script |
initializationScript label: script basename.
@@ -117,7 +130,9 @@ PhLImageDetailPresenter >> modelChanged [
enable;
state: image shouldRunInitializationScript. ].
location label: image location.
- vm text: 'N/A'"self image vm".
+ vm text: 'N/A'. "self image vm."
+
+ updating := false
]
{ #category : #accessing }
@@ -130,6 +145,24 @@ PhLImageDetailPresenter >> templateUrl [
^ templateUrl
]
+{ #category : #initialization }
+PhLImageDetailPresenter >> updateImageDescription: text [
+
+ updating ifTrue: [ ^ self ].
+
+ PhLImageDescriptionUpdater
+ image: self image
+ description: text
+]
+
+{ #category : #initialization }
+PhLImageDetailPresenter >> updateImageRunScript: state [
+
+ updating ifTrue: [ ^ self ].
+
+ self image shouldRunInitializationScript: state
+]
+
{ #category : #accessing }
PhLImageDetailPresenter >> vm [
^ vm

MODIFY
src/PharoLauncher-Spec2/PhLImagesPresenter.class.st
src/PharoLauncher-Spec2/PhLImagesPresenter.class.st
@@ -106,7 +106,8 @@ PhLImagesPresenter >> actionFilter [
{ #category : #'api - actions' }
PhLImagesPresenter >> actionLaunch [
| cmd |
- cmd := self toolbarGroup commandOrGroupNamed: 'Launch'.
+
+ cmd := PhLLaunchImageCommand forContext: self.
cmd execute
]
@@ -131,6 +132,7 @@ PhLImagesPresenter >> buildImageFilter [
PhLImagesPresenter >> buildImageTable [
^ self newTable
+ activateOnDoubleClick;
items: self imageRepository images;
sortingBlock: #lastModification descending;
whenActivatedDo: [ self actionLaunch ];
@@ -240,7 +242,7 @@ PhLImagesPresenter >> initializePresenters [
add: toolbar expand: false;
add: imageFilter expand: false;
add: (SpPanedLayout newTopToBottom
- positionOfSlider: 60 percent;
+ positionOfSlider: 55 percent;
add: imageTable;
add: descriptionPanel;
yourself);
@@ -251,6 +253,7 @@ PhLImagesPresenter >> initializePresenters [
{ #category : #initialization }
PhLImagesPresenter >> initializeWindow: aWindowPresenter [
+
aWindowPresenter
title: 'Pharo Launcher';
initialExtent: 700 @ 550;

MODIFY
src/PharoLauncher-Spec2/PhLLaunchConfigurationPresenter.class.st
src/PharoLauncher-Spec2/PhLLaunchConfigurationPresenter.class.st
@@ -133,6 +133,7 @@ PhLLaunchConfigurationPresenter >> imageArguments [
{ #category : #initialization }
PhLLaunchConfigurationPresenter >> initializePresenters [
+
configurationTable := (self instantiate: SpEditableListPresenter)
addItemBlock: [ self newConfiguration ];
label: 'Launch configurations';
@@ -156,24 +157,27 @@ PhLLaunchConfigurationPresenter >> initializePresenters [
"Run in a separate process to do not block UI. Can take some seconds."
[ self initializeVmListContent ] fork.
vmArgumentList := (self instantiate: SpEditableListPresenter)
- addItemBlock: [ self application newRequest
+ addItemBlock: [
+ self newRequest
title: 'New VM argument?';
request ];
yourself.
imageArgumentList := (self instantiate: SpEditableListPresenter)
- addItemBlock: [ self application newRequest
+ addItemBlock: [
+ self newRequest
title: 'New image argument?';
request ];
yourself.
applyChangesButton := self newButton
label: 'Apply';
- icon: (self iconNamed: #scriptManager);
+ icon: (self application iconNamed: #scriptManager);
action: [ self saveSelectedConfiguration ];
yourself.
saveAndSelectsButton := self newButton
label: 'Save & select';
- icon: (self iconNamed: #smallSave);
- action: [ self saveSelectedConfiguration.
+ icon: (self application iconNamed: #smallSave);
+ action: [
+ self saveSelectedConfiguration.
self delete ];
yourself
]
@@ -195,11 +199,12 @@ PhLLaunchConfigurationPresenter >> initializeWindow: aWindowPresenter [
{ #category : #action }
PhLLaunchConfigurationPresenter >> newConfiguration [
| newName configuration |
+
newName := self application newRequest
title: 'New Launch configuration name?';
validateAnswer: [ :answer |
self image launchConfigurations noneSatisfy: [ :each | each name = answer ] ];
- request.
+ openModalWithSpec.
newName ifNil: [ ^ nil ].
configuration := (PhLLaunchConfiguration withImage: self image)

MODIFY
src/PharoLauncher-Spec2/PhLScriptPresenter.class.st
src/PharoLauncher-Spec2/PhLScriptPresenter.class.st
@@ -17,12 +17,11 @@ Class {
{ #category : #example }
PhLScriptPresenter class >> defaultSpec [
+
^ SpPanedLayout newHorizontal
- position: 30 percent;
- add: #scriptTable
- withConstraints: [ :constraints |
- constraints
- spec: #withoutOrderingBar";
+ positionOfSlider: 30 percent;
+ add: #scriptTable withConstraints: [ :constraints |
+ constraints spec: #withoutOrderingBar ";
width: 200" ];
add: (SpBoxLayout newVertical
add: #fileEditor;
@@ -92,10 +91,12 @@ PhLScriptPresenter >> initializeWindow: aWindowPresenter [
{ #category : #action }
PhLScriptPresenter >> newScript [
| newName |
- newName := self application newRequest
+
+ newName := self newRequest
title: 'New script name?';
validateAnswer: [ :answer | (self scriptDirectory / answer) exists not ];
request.
+
^ self newScriptNamed: newName
]

MODIFY
src/PharoLauncher-Spec2/PhLTemplatesPresenter.class.st
src/PharoLauncher-Spec2/PhLTemplatesPresenter.class.st
@@ -36,14 +36,15 @@ PhLTemplatesPresenter class >> buildContextualMenuGroup [
{ #category : #specs }
PhLTemplatesPresenter class >> defaultSpec [
+
^ SpPanedLayout newHorizontal
add: (SpPanedLayout newHorizontal
add: (SpBoxLayout newVertical
- add: '1. Choose a template category:' height: self labelHeight;
+ add: '1. Choose a template category:' expand: false;
add: #categoryTable;
yourself);
add: (SpBoxLayout newVertical
- add: '2. Choose a template:' height: self labelHeight;
+ add: '2. Choose a template:' expand: false;
add: #templateTable;
yourself);
yourself);
@@ -67,6 +68,46 @@ PhLTemplatesPresenter class >> example [
yourself
]
+{ #category : #initialization }
+PhLTemplatesPresenter >> buildCategoryTable [
+
+ ^ self newTable
+ hideColumnHeaders;
+ items: self templateRepository roots;
+ addColumn: ((SpImageTableColumn evaluated: #icon) width: 30);
+ addColumn: (SpStringTableColumn evaluated: #name);
+ yourself
+]
+
+{ #category : #initialization }
+PhLTemplatesPresenter >> buildDescriptionPanel [
+ | panel |
+
+ panel := self instantiate: PhLImageCreationPresenter on: nil.
+ panel disable.
+
+ ^ panel
+]
+
+{ #category : #initialization }
+PhLTemplatesPresenter >> buildTemplateTable [
+
+ ^ self newTreeTable
+ hideColumnHeaders;
+ children: #children;
+ addColumn: (SpStringTableColumn evaluated: #name);
+ contextMenuFromCommandsGroup: [ self rootCommandsGroup / 'Context Menu' ];
+ beMultipleSelection; "bulk delete templates for example"
+ "whenBuiltDo: [ :tree | tree widget alternateRowsColor ];"
+ whenRootsChangedDo: [ :roots |
+ templateTable lazilyComputeChildren: (roots anySatisfy: #shouldComputeChildrenLazily) ];
+ whenSelectionChangedDo: [ :selection |
+ selection isEmpty
+ ifTrue: [ descriptionPanel disable ]
+ ifFalse: [ descriptionPanel enable ] ]
+ yourself
+]
+
{ #category : #initialization }
PhLTemplatesPresenter >> connectPresenters [
@@ -124,28 +165,10 @@ PhLTemplatesPresenter >> initializationScript [
{ #category : #initialization }
PhLTemplatesPresenter >> initializePresenters [
- categoryTable := self newTable
- items: self templateRepository roots;
- addColumn: ((SpImageTableColumn evaluated: #icon) width: 30);
- addColumn: (SpStringTableColumn evaluated: #name);
- yourself.
- templateTable := self newTreeTable
- children: #children;
- addColumn: (SpStringTableColumn evaluated: #name);
- contextMenuFromCommandsGroup: [ self rootCommandsGroup / 'Context Menu' ];
- beMultipleSelection; "bulk delete templates for example"
- "whenBuiltDo: [ :tree | tree widget alternateRowsColor ];"
- whenRootsChangedDo: [ :roots |
- templateTable lazilyComputeChildren: (roots anySatisfy: #shouldComputeChildrenLazily) ];
- whenSelectionChangedDo: [ :selection |
- selection isEmpty
- ifTrue: [ descriptionPanel disable ]
- ifFalse: [ descriptionPanel enable ] ]
- yourself.
- descriptionPanel := self
- instantiate: PhLImageCreationPresenter
- on: nil.
- descriptionPanel disable.
+
+ categoryTable := self buildCategoryTable.
+ templateTable := self buildTemplateTable.
+ descriptionPanel := self buildDescriptionPanel
]
{ #category : #initialization }

MODIFY
src/PharoLauncher-Spec2/PharoLauncherApplication.class.st
src/PharoLauncher-Spec2/PharoLauncherApplication.class.st
@@ -6,8 +6,6 @@ PharoLauncherApplication open
Class {
#name : #PharoLauncherApplication,
#superclass : #SpApplication,
- #traits : 'TPhLInteractionTrait',
- #classTraits : 'TPhLInteractionTrait classTrait',
#instVars : [
'imageRepository',
'templateRepository',

migrating interactions