From d34ce7193a810a3b29e162805b5f5b1fc397934b Mon Sep 17 00:00:00 2001 From: Christophe Demarey Date: Fri, 21 Jun 2024 10:56:13 +0200 Subject: [PATCH] use FileRequest interaction --- .../BaselineOfPharoLauncher.class.st | 10 ++++++ .../PhLImportImageCommand.class.st | 4 +-- .../PhLLaunchImageFromDiskCommand.class.st | 6 ++-- .../PhLUIFileRequest.class.st | 36 ------------------- .../TPhLInteractionTrait.trait.st | 2 +- 5 files changed, 16 insertions(+), 42 deletions(-) delete mode 100644 src/PharoLauncher-Core/PhLUIFileRequest.class.st diff --git a/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st b/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st index a584d2bd..8d6cbee3 100644 --- a/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st +++ b/src/BaselineOfPharoLauncher/BaselineOfPharoLauncher.class.st @@ -17,6 +17,7 @@ BaselineOfPharoLauncher >> baseline: spec [ self xmlParser: spec. self clap: spec. self objCBridge: spec. + self interactions: spec. spec package: 'PharoLauncher-100Compatibility'; @@ -26,6 +27,7 @@ BaselineOfPharoLauncher >> baseline: spec [ 'OSSubprocess' 'OSWinSubprocess' 'Ston' + 'Interactions' 'ObjCBridge' 'PharoLauncher-100Compatibility'). ]; package: 'PharoLauncher-Spec2' with: [ @@ -69,6 +71,14 @@ BaselineOfPharoLauncher >> clap: spec [ with: [ spec repository: 'github://pharo-contributions/clap-st:master/src' ] ] +{ #category : 'external projects' } +BaselineOfPharoLauncher >> interactions: spec [ + + spec + baseline: #Interactions + with: [ spec repository: 'github://pharo-contributions/interactions' ] +] + { #category : 'external projects' } BaselineOfPharoLauncher >> objCBridge: spec [ diff --git a/src/PharoLauncher-Core/PhLImportImageCommand.class.st b/src/PharoLauncher-Core/PhLImportImageCommand.class.st index d753d385..71471c35 100644 --- a/src/PharoLauncher-Core/PhLImportImageCommand.class.st +++ b/src/PharoLauncher-Core/PhLImportImageCommand.class.st @@ -81,8 +81,8 @@ PhLImportImageCommand >> importImage [ | imageFile | imageFile := self imagesPresenter newFileRequest title: 'Import a Pharo image (will move image, changes file and pharo-local folder)'; - extensionsToShow: #('image'); - path: FileLocator home; + filter: '.image'; + currentFolder: FileLocator home; chooseFile. imageFile ifNil: [ self imagesPresenter newInformation diff --git a/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st b/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st index f52d12db..3444d680 100644 --- a/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st +++ b/src/PharoLauncher-Core/PhLLaunchImageFromDiskCommand.class.st @@ -30,11 +30,11 @@ PhLLaunchImageFromDiskCommand >> execute [ | imageFile | imageFile := self imagesPresenter newFileRequest title: 'Open a Pharo image'; - extensionsToShow: #('image'); - path: FileLocator home; + filter: '.image'; + currentFolder: FileLocator home; chooseFile. imageFile ifNil: [ ^ self ]. - imageFile isFile ifFalse: [ ^self ]. + imageFile isFile ifFalse: [ ^ self ]. ^ self launchImage: (PhLImage location: imageFile). ] diff --git a/src/PharoLauncher-Core/PhLUIFileRequest.class.st b/src/PharoLauncher-Core/PhLUIFileRequest.class.st deleted file mode 100644 index 666614d2..00000000 --- a/src/PharoLauncher-Core/PhLUIFileRequest.class.st +++ /dev/null @@ -1,36 +0,0 @@ -Class { - #name : 'PhLUIFileRequest', - #superclass : 'PhLUserInteraction', - #instVars : [ - 'title', - 'extensionsToShow', - 'path' - ], - #category : 'PharoLauncher-Core-Commands', - #package : 'PharoLauncher-Core', - #tag : 'Commands' -} - -{ #category : 'action' } -PhLUIFileRequest >> chooseFile [ - ^ UIManager default - chooseExistingFileReference: title - extensions: extensionsToShow - path: path - preview: false. -] - -{ #category : 'accessing' } -PhLUIFileRequest >> extensionsToShow: anObject [ - extensionsToShow := anObject -] - -{ #category : 'accessing' } -PhLUIFileRequest >> path: anObject [ - path := anObject -] - -{ #category : 'accessing' } -PhLUIFileRequest >> title: anObject [ - title := anObject -] diff --git a/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st b/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st index 55f7576f..47f09b74 100644 --- a/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st +++ b/src/PharoLauncher-Spec2/TPhLInteractionTrait.trait.st @@ -16,7 +16,7 @@ TPhLInteractionTrait >> newConfirmation [ { #category : 'user interaction' } TPhLInteractionTrait >> newFileRequest [ - ^ PhLUIFileRequest new + ^ ITFileRequest new ] { #category : 'user interaction' }