From 17e6f74015ebb3dcfc5ad709a7f6a975de376968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Thu, 1 Feb 2024 19:33:32 +0100 Subject: [PATCH 1/4] First commit to remove the old morphic-based FileList --- src/BaselineOfBasicTools/BaselineOfBasicTools.class.st | 1 - src/BaselineOfGeneralTests/BaselineOfGeneralTests.class.st | 1 - src/BaselineOfIDE/BaselineOfIDE.class.st | 2 +- .../SystemDependenciesTest.class.st | 4 ++-- src/Tool-Registry/PharoCommonTools.class.st | 6 +++--- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st b/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st index 388f2279e97..43a143dc6ab 100644 --- a/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st +++ b/src/BaselineOfBasicTools/BaselineOfBasicTools.class.st @@ -95,7 +95,6 @@ BaselineOfBasicTools >> baseline: spec [ spec package: 'Tools-CodeNavigation'. spec package: 'Tool-Diff'. - spec package: 'Tool-FileList'. spec package: 'Tool-Finder'. spec package: 'Tool-Finder-UI'. spec package: 'Tool-ImageCleaner'. diff --git a/src/BaselineOfGeneralTests/BaselineOfGeneralTests.class.st b/src/BaselineOfGeneralTests/BaselineOfGeneralTests.class.st index 5268199b8e4..893a5e9b957 100644 --- a/src/BaselineOfGeneralTests/BaselineOfGeneralTests.class.st +++ b/src/BaselineOfGeneralTests/BaselineOfGeneralTests.class.st @@ -55,7 +55,6 @@ BaselineOfGeneralTests >> baseline: spec [ package: 'System-Support-Tests'; package: 'Text-Diff-Tests'; package: 'Tool-ExternalBrowser-Tests'; - package: 'Tool-FileList-Tests'; package: 'Tool-Finder-Tests'; package: 'Tool-Profilers-Tests'; package: 'Tool-ImageCleaner-Tests'; diff --git a/src/BaselineOfIDE/BaselineOfIDE.class.st b/src/BaselineOfIDE/BaselineOfIDE.class.st index 33f899b49c2..8d61c60e975 100644 --- a/src/BaselineOfIDE/BaselineOfIDE.class.st +++ b/src/BaselineOfIDE/BaselineOfIDE.class.st @@ -265,7 +265,7 @@ BaselineOfIDE >> postload: loader package: packageSpec [ EpMonitor current enable. Smalltalk tools register: ExternalChangesBrowser as: #changeList. - Smalltalk tools register: FileList as: #fileList. + Smalltalk tools register: StFileSystemPresenter as: #fileList. Smalltalk tools register: Finder as: #finder. Smalltalk tools register: ProcessBrowser as: #processBrowser. Smalltalk tools register: TimeProfiler as: #timeProfiler. diff --git a/src/System-DependenciesTests/SystemDependenciesTest.class.st b/src/System-DependenciesTests/SystemDependenciesTest.class.st index c3800419f46..6779f517b70 100644 --- a/src/System-DependenciesTests/SystemDependenciesTest.class.st +++ b/src/System-DependenciesTests/SystemDependenciesTest.class.st @@ -94,7 +94,7 @@ SystemDependenciesTest >> knownMorphicCoreDependencies [ SystemDependenciesTest >> knownMorphicDependencies [ "ideally this list should be empty" - ^ #(#'Refactoring-Critics' #'Refactoring-Environment' #'Spec2-Core' #'Tool-FileList' #'Tool-Profilers' + ^ #(#'Refactoring-Critics' #'Refactoring-Environment' #'Spec2-Core' #'Tool-Profilers' #'Athens-Morphic' #'Tools-CodeNavigation' "Rubric has a dependency on It" 'Debugger-Oups') ] @@ -126,7 +126,7 @@ SystemDependenciesTest >> knownUIDependencies [ "ideally this list should be empty" ^ #('AST-Core-Tests' 'Athens-Cairo' 'Athens-Core' - #'Athens-Morphic' #'Refactoring-Critics' #'Refactoring-Environment' 'Reflectivity-Tools' #Shout #'Tool-Diff' #'Tool-FileList' #'Tool-Profilers' #'HeuristicCompletion-Model' 'NECompletion-Morphic' #VariablesLibrary #'Tools-CodeNavigation' #'Spec2-CommonWidgets') + #'Athens-Morphic' #'Refactoring-Critics' #'Refactoring-Environment' 'Reflectivity-Tools' #Shout #'Tool-Diff' #'Tool-Profilers' #'HeuristicCompletion-Model' 'NECompletion-Morphic' #VariablesLibrary #'Tools-CodeNavigation' #'Spec2-CommonWidgets') ] { #category : 'accessing' } diff --git a/src/Tool-Registry/PharoCommonTools.class.st b/src/Tool-Registry/PharoCommonTools.class.st index 4a476cd67b5..fe75330b4c2 100644 --- a/src/Tool-Registry/PharoCommonTools.class.st +++ b/src/Tool-Registry/PharoCommonTools.class.st @@ -80,9 +80,9 @@ PharoCommonTools class >> settingsOn: aBuilder [ (aBuilder pickOne: #fileListTool) target: Smalltalk; targetSelector: #tools; - label: 'Filelist'; - default: (self environment at: #FileList); - domainValues: Smalltalk tools recentFileListTools] + label: 'FileBrowser'; + default: (self environment at: #StFileSystemPresenter); + domainValues: Smalltalk tools recentFileListTools ] ] { #category : 'system startup' } From bf7b97acb73eb23c114534fe1155b7cf523e23cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Thu, 1 Feb 2024 23:04:00 +0100 Subject: [PATCH 2/4] Updating UITheme to use new file dialogs --- src/Polymorph-Widgets/UITheme.class.st | 55 ++++++++++++-------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/Polymorph-Widgets/UITheme.class.st b/src/Polymorph-Widgets/UITheme.class.st index f0ee473878c..171c00b5757 100644 --- a/src/Polymorph-Widgets/UITheme.class.st +++ b/src/Polymorph-Widgets/UITheme.class.st @@ -754,12 +754,12 @@ UITheme >> chooseColorIn: aThemedMorph title: aString color: aColor for: aBlock UITheme >> chooseDirectoryIn: aThemedMorph title: title path: path [ "Answer the result of a file dialog with the given title, choosing directories only." - | dialog | - dialog := (FileDialogWindow newWithTheme: aThemedMorph theme) - title: title; - answerDirectory. - path ifNotNil: [ dialog selectPath: path ]. - ^ dialog openModal answer + ^ StOpenDirectoryDialog new + defaultFolder: path; + title: (title ifNil: [ 'Choose Directory' translated ]); + openModal; + selectedEntry + ] { #category : 'services' } @@ -816,37 +816,34 @@ UITheme >> chooseForSaveFileReferenceIn: aThemedMorph title: title extensions: e path and preview type. Answer nil or a filename." - | dialog pathFileReference | + | pathFileReference | + pathFileReference := path asFileReference. - dialog := (FileDialogWindow newWithTheme: aThemedMorph theme) - title: title; - fileNameText: pathFileReference basename; - answerSaveFile. - exts ifNotNil: [ dialog validExtensions: exts ]. - path ifNotNil: [ dialog selectPath: path ]. - ^ dialog openModal answer + ^ StSaveFileDialog new + setTitle: title; + showDirectory: path parent; + extensions: exts; + selectFile: pathFileReference basename; + openModal; + selectedEntry ] { #category : 'services' } UITheme >> chooseFullFileNameIn: aThemedMorph title: title patterns: patterns path: path preview: preview [ "Answer the result of a file name chooser dialog with the given title, patterns - path and preview type. - Answer nil or a filename." + path and preview type. Answer nil or a filename." | dialog | - dialog := FileDialogWindow basicNew - basicTheme: aThemedMorph theme; - previewType: preview; - initialize; - title: title; - answerPathName. - patterns - ifNotNil: [ dialog - fileSelectionBlock: [ :de | - (dialog defaultFileSelectionBlock value: de) - and: [ de isDirectory or: [ patterns anySatisfy: [ :pat | pat match: de name ] ] ] ] ]. - path ifNotNil: [ dialog selectPath: path ]. - ^ dialog openModal answer + + dialog := StOpenFileDialog new + previewer: StFileBrowserContentPreviewer new; + setTitle: title; + yourself. + path ifNotNil: [ dialog showDirectory: path ]. + patterns ifNotNil: [ dialog extensions: patterns ]. + ^ dialog + openModal; + selectedEntry. ] { #category : 'services' } From 85132a57f1fe29b8e456ab927a486e94257489af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Mon, 5 Feb 2024 10:29:56 +0100 Subject: [PATCH 3/4] Two more UITheme methods to check against new File Dialogs --- src/Polymorph-Widgets/UITheme.class.st | 46 +++++++++++++++----------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/Polymorph-Widgets/UITheme.class.st b/src/Polymorph-Widgets/UITheme.class.st index 171c00b5757..5eccfab2136 100644 --- a/src/Polymorph-Widgets/UITheme.class.st +++ b/src/Polymorph-Widgets/UITheme.class.st @@ -779,18 +779,21 @@ UITheme >> chooseExistingFileReferenceIn: aThemedMorph title: title extensions: path and preview type. Answer nil or a filename." - | dialog pathFileReference | + | pathFileReference | + + self flag: #ToDo. pathFileReference := path asFileReference. - dialog := FileDialogWindow basicNew - basicTheme: aThemedMorph theme; - previewType: preview; - fileNameText: pathFileReference basename; - initialize; - title: title; - answerPathName. - exts ifNotNil: [ dialog validExtensions: exts ]. + ^ StOpenFileDialog new + showDirectory: path; + selectFile: pathFileReference; + previewer: StFileBrowserContentPreviewer new; + title: (title ifNil: [ 'Choose File' ]); + openModal; + selectedEntry. + + " exts ifNotNil: [ dialog validExtensions: exts ]. path ifNotNil: [ dialog selectPath: pathFileReference pathString ]. - ^ dialog openModal answer ifNotNil: #asFileReference + ^ dialog openModal answer ifNotNil: #asFileReference" ] { #category : 'services' } @@ -798,16 +801,21 @@ UITheme >> chooseFileIn: aThemedMorph title: title extensions: exts path: path p "Answer the result of a file open dialog with the given title, extensions path and preview type. Answer nil or a filename." - | dialog | - dialog := FileDialogWindow basicNew - basicTheme: aThemedMorph theme; - previewType: preview; - initialize; - title: title; - answerFileEntry. - exts ifNotNil: [ dialog validExtensions: exts ]. + | pathFileReference | + + self flag: #ToDo. + pathFileReference := path asFileReference. + ^ StOpenFileDialog new + showDirectory: path; + selectFile: pathFileReference; + previewer: StFileBrowserContentPreviewer new; + title: (title ifNil: [ 'Choose File' ]); + openModal; + selectedEntry. + + "exts ifNotNil: [ dialog validExtensions: exts ]. path ifNotNil: [ dialog selectPath: path ]. - ^ dialog openModal answer + ^ dialog openModal answer" ] { #category : 'services' } From 0837d06b2cb5c98ba59f87cc023b14da5fad12c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Tue, 6 Feb 2024 16:32:03 +0100 Subject: [PATCH 4/4] Adapt remaining use cases of UITheme for file dialogs. This commit uses StFileBrowserTextBasedContentPreviewer new feature which enables to adaptively change previewers. --- src/Polymorph-Widgets/UITheme.class.st | 78 +++++++++++-------- ...s.st => REHierarchyDefinesMethod.class.st} | 0 ...ss.st => REUpToRootDefinesMethod.class.st} | 0 3 files changed, 44 insertions(+), 34 deletions(-) rename src/Refactoring-Core/{ReHierarchyDefinesMethod.class.st => REHierarchyDefinesMethod.class.st} (100%) rename src/Refactoring-Core/{ReUpToRootDefinesMethod.class.st => REUpToRootDefinesMethod.class.st} (100%) diff --git a/src/Polymorph-Widgets/UITheme.class.st b/src/Polymorph-Widgets/UITheme.class.st index 5eccfab2136..5e61c2dabeb 100644 --- a/src/Polymorph-Widgets/UITheme.class.st +++ b/src/Polymorph-Widgets/UITheme.class.st @@ -774,48 +774,58 @@ UITheme >> chooseDropListIn: aThemedMorph text: aStringOrText title: aString lis ] { #category : 'services' } -UITheme >> chooseExistingFileReferenceIn: aThemedMorph title: title extensions: exts path: path preview: preview [ - "Answer the result of a file name chooser dialog with the given title, extensions - path and preview type. - Answer nil or a filename." - - | pathFileReference | +UITheme >> chooseExistingFileReferenceIn: aThemedMorph title: titleString extensions: extensions path: path preview: preview [ + "Answer the result of a file name chooser dialog with the given titleString, extensions, path and preview type. + extensions : of each one representing a file extension. + path : or . It can be a directory or a file. + If it is a directory, the dialog will open showing it. + If it is a file, the directory where the file resides will be selected and displayed. + preview : or . If it's a , try to match with a specific previewer subclass of `StFileBrowserAbstractPreviewer`. + + Answer nil or the selected ." + + | pathFileReference newDialog | - self flag: #ToDo. - pathFileReference := path asFileReference. - ^ StOpenFileDialog new - showDirectory: path; - selectFile: pathFileReference; - previewer: StFileBrowserContentPreviewer new; - title: (title ifNil: [ 'Choose File' ]); + newDialog := StOpenFileDialog new + extensions: (extensions ifNil: [ Array empty ]); + title: (titleString ifNil: [ 'Choose File' ]); + yourself. + (pathFileReference := path asFileReference) isFile + ifTrue: [ + newDialog + showDirectory: pathFileReference parent; + selectFile: pathFileReference ] + ifFalse: [ + newDialog + showDirectory: pathFileReference ]. + ^ newDialog openModal; selectedEntry. - - " exts ifNotNil: [ dialog validExtensions: exts ]. - path ifNotNil: [ dialog selectPath: pathFileReference pathString ]. - ^ dialog openModal answer ifNotNil: #asFileReference" ] { #category : 'services' } -UITheme >> chooseFileIn: aThemedMorph title: title extensions: exts path: path preview: preview [ - "Answer the result of a file open dialog with the given title, extensions path and preview type. - Answer nil or a filename." - - | pathFileReference | +UITheme >> chooseFileIn: aThemedMorph title: titleString extensions: extensions path: path preview: preview [ + "Answer the result of a file name chooser dialog with the given titleString, extensions, path and preview type. + extensions : of each one representing a file extension. + path : or . It can be a directory or a file. + If it is a directory, the dialog will open showing it. + If it is a file, the directory where the file resides will be displayed. + preview : or . If it's a , try to match with a specific previewer subclass of `StFileBrowserAbstractPreviewer`. + + Answer nil or the selected ." + + | pathFileReference newDialog | - self flag: #ToDo. - pathFileReference := path asFileReference. - ^ StOpenFileDialog new - showDirectory: path; - selectFile: pathFileReference; - previewer: StFileBrowserContentPreviewer new; - title: (title ifNil: [ 'Choose File' ]); + newDialog := StOpenFileDialog new + extensions: (extensions ifNil: [ Array empty ]); + title: (titleString ifNil: [ 'Choose File' ]); + yourself. + (pathFileReference := path asFileReference) isFile + ifTrue: [ newDialog showDirectory: pathFileReference parent ] + ifFalse: [ newDialog showDirectory: pathFileReference ]. + ^ newDialog openModal; selectedEntry. - - "exts ifNotNil: [ dialog validExtensions: exts ]. - path ifNotNil: [ dialog selectPath: path ]. - ^ dialog openModal answer" ] { #category : 'services' } @@ -844,7 +854,7 @@ UITheme >> chooseFullFileNameIn: aThemedMorph title: title patterns: patterns pa | dialog | dialog := StOpenFileDialog new - previewer: StFileBrowserContentPreviewer new; + previewer: StFileBrowserTextBasedContentPreviewer new; setTitle: title; yourself. path ifNotNil: [ dialog showDirectory: path ]. diff --git a/src/Refactoring-Core/ReHierarchyDefinesMethod.class.st b/src/Refactoring-Core/REHierarchyDefinesMethod.class.st similarity index 100% rename from src/Refactoring-Core/ReHierarchyDefinesMethod.class.st rename to src/Refactoring-Core/REHierarchyDefinesMethod.class.st diff --git a/src/Refactoring-Core/ReUpToRootDefinesMethod.class.st b/src/Refactoring-Core/REUpToRootDefinesMethod.class.st similarity index 100% rename from src/Refactoring-Core/ReUpToRootDefinesMethod.class.st rename to src/Refactoring-Core/REUpToRootDefinesMethod.class.st