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

Align suffixes of FileBrowser #706

Merged
merged 1 commit into from
Feb 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/NewTools-Compression-Utils/ZipArchive.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ZipArchive class >> extractAllIn: aFileReferenceOrFileName [
"
| directory |

directory := (StOpenDirectoryDialog new
directory := (StOpenDirectoryPresenter new
currentDirectory: FileSystem workingDirectory;
openModal) ifNil: [ ^ self ].

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : 'StFileDialogTest',
#name : 'StFilePresenterTest',
#superclass : 'StFileBrowserTestCase',
#instVars : [
'dialog',
Expand All @@ -11,17 +11,17 @@ Class {
}

{ #category : 'testing' }
StFileDialogTest class >> isAbstract [
^ self = StFileDialogTest
StFilePresenterTest class >> isAbstract [
^ self = StFilePresenterTest
]

{ #category : 'accessing' }
StFileDialogTest >> dialogClass [
StFilePresenterTest >> dialogClass [
^ self subclassResponsibility
]

{ #category : 'tests' }
StFileDialogTest >> fileListAllMustBeFilterByPNGFIlter [
StFilePresenterTest >> fileListAllMustBeFilterByPNGFIlter [
self
assert:
(dialog fileReferenceTable items
Expand All @@ -31,50 +31,50 @@ StFileDialogTest >> fileListAllMustBeFilterByPNGFIlter [
]

{ #category : 'running' }
StFileDialogTest >> setUp [
StFilePresenterTest >> setUp [

super setUp.
(dialog := self dialogClass owner: fileSystemPresenter on: fileSystemModel) defaultFolder: root
]

{ #category : 'running' }
StFileDialogTest >> tearDown [
StFilePresenterTest >> tearDown [

dialog class initialize.
window ifNotNil: [ : w | w delete ].
super tearDown
]

{ #category : 'tests' }
StFileDialogTest >> testIsRootDirectory [
StFilePresenterTest >> testIsRootDirectory [
self assert: (dialog isRootDirectory: FileLocator root)
]

{ #category : 'tests' }
StFileDialogTest >> testIsRootDirectoryWindowsDrive [
StFilePresenterTest >> testIsRootDirectoryWindowsDrive [
OSPlatform current isWindows
ifFalse: [ ^ self ].
self assert: (dialog isRootDirectory: FileLocator C)
]

{ #category : 'tests' }
StFileDialogTest >> testOpen [
StFilePresenterTest >> testOpen [

"will it even open?"

window := dialog openDialog
]

{ #category : 'tests' }
StFileDialogTest >> testOpenFolder [
StFilePresenterTest >> testOpenFolder [
window := dialog open.
self assert: dialog currentDirectory equals: root.
dialog showDirectory: root / 'dir'.
self assert: dialog currentDirectory equals: root / 'dir'
]

{ #category : 'tests' }
StFileDialogTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAddedToBookmarkTreeTable [
StFilePresenterTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAddedToBookmarkTreeTable [
| aCollectionOfBookmark |

aCollectionOfBookmark := {
Expand All @@ -93,9 +93,9 @@ StFileDialogTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAdde
]

{ #category : 'tests' }
StFileDialogTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllInstance [
StFilePresenterTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllInstance [
| anOtherInstance addCommand |
anOtherInstance := StOpenDirectoryDialog new.
anOtherInstance := StOpenDirectoryPresenter new.
self
assertCollection: anOtherInstance bookmarks
hasSameElements: dialog bookmarks.
Expand All @@ -113,14 +113,14 @@ StFileDialogTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllInst
]

{ #category : 'tests' }
StFileDialogTest >> testWhenAddingBookmarkOnIsolateBookmarksShouldBeAddToAllInstance [
StFilePresenterTest >> testWhenAddingBookmarkOnIsolateBookmarksShouldBeAddToAllInstance [
| anOtherInstance addCommand |
dialog isolate.
addCommand := StFileBrowserAddBookmarkCommand new.
addCommand context: dialog fileNavigationSystem.
dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir').
addCommand execute.
anOtherInstance := StOpenDirectoryDialog new.
anOtherInstance := StOpenDirectoryPresenter new.
self
assert: anOtherInstance bookmarks
equals: dialog bookmarks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
Class {
#name : 'StOpenDirectoryDialogTest',
#superclass : 'StFileDialogTest',
#name : 'StOpenDirectoryPresenterTest',
#superclass : 'StFilePresenterTest',
#category : 'NewTools-FileBrowser-Tests-UI',
#package : 'NewTools-FileBrowser-Tests',
#tag : 'UI'
}

{ #category : 'accessing' }
StOpenDirectoryDialogTest >> dialogClass [
StOpenDirectoryPresenterTest >> dialogClass [

^ StOpenDirectoryDialog
^ StOpenDirectoryPresenter
]

{ #category : 'tests' }
StOpenDirectoryDialogTest >> testDefaultDirectory [
StOpenDirectoryPresenterTest >> testDefaultDirectory [
self assert: dialog selectedEntry equals: root.
dialog defaultFolder: root / 'dir'.
self assert: dialog selectedEntry equals: root / 'dir'
]

{ #category : 'tests' }
StOpenDirectoryDialogTest >> testSelectDirectory [
StOpenDirectoryPresenterTest >> testSelectDirectory [

| selectedDirectory |
dialog okAction: [ :dir | selectedDirectory := dir ].
Expand All @@ -37,7 +37,7 @@ StOpenDirectoryDialogTest >> testSelectDirectory [
]

{ #category : 'tests' }
StOpenDirectoryDialogTest >> testSelectNonexistingDirectory [
StOpenDirectoryPresenterTest >> testSelectNonexistingDirectory [

self
should: [ dialog defaultFolder: root / 'idontexist' ]
Expand All @@ -46,7 +46,7 @@ StOpenDirectoryDialogTest >> testSelectNonexistingDirectory [
]

{ #category : 'tests' }
StOpenDirectoryDialogTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [
StOpenDirectoryPresenterTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [
| newDirectory |
newDirectory := (root / 'dir') asFileReference.
dialog defaultFolder: newDirectory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Class {
#name : 'StOpenFileDialogTest',
#superclass : 'StFileDialogTest',
#name : 'StOpenFilePresenterTest',
#superclass : 'StFilePresenterTest',
#category : 'NewTools-FileBrowser-Tests-UI',
#package : 'NewTools-FileBrowser-Tests',
#tag : 'UI'
}

{ #category : 'accessing' }
StOpenFileDialogTest >> dialogClass [
StOpenFilePresenterTest >> dialogClass [

^ StOpenFileDialog
^ StOpenFilePresenter
]

{ #category : 'tests' }
StOpenFileDialogTest >> testExtensions [
StOpenFilePresenterTest >> testExtensions [

dialog extensions: #( ext ) named: 'Ext files'.
self
Expand All @@ -27,7 +27,7 @@ StOpenFileDialogTest >> testExtensions [
]

{ #category : 'tests' }
StOpenFileDialogTest >> testMultipleExtensions [
StOpenFilePresenterTest >> testMultipleExtensions [

dialog extensions: #( image changes sources ) named: 'Src files'.
self
Expand All @@ -41,7 +41,7 @@ StOpenFileDialogTest >> testMultipleExtensions [
]

{ #category : 'tests' }
StOpenFileDialogTest >> testSelectFile [
StOpenFilePresenterTest >> testSelectFile [

| selectedFile |
dialog okAction: [ :file | selectedFile := file ].
Expand All @@ -54,7 +54,7 @@ StOpenFileDialogTest >> testSelectFile [
]

{ #category : 'tests' }
StOpenFileDialogTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [
StOpenFilePresenterTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [
| newDirectory |
newDirectory := (root / 'dir') asFileReference.
dialog defaultFolder: newDirectory.
Expand Down
63 changes: 3 additions & 60 deletions src/NewTools-FileBrowser/StMorphicUIManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ StMorphicUIManager class >> isValidForCurrentSystemConfiguration [
StMorphicUIManager >> chooseDirectory: label from: dir [
self flag: #ToDoWhenIntegration.
self flag: 'use chooseDirectory:path: instead of this'.
^ StOpenDirectoryDialog new
^ StOpenDirectoryPresenter new
defaultFolder: dir;
title: (label ifNil: [ 'Choose Directory' translated ]);
open
Expand All @@ -45,77 +45,20 @@ StMorphicUIManager >> chooseDirectory: label from: dir [
{ #category : 'ui requests' }
StMorphicUIManager >> chooseDirectory: label path: path [

^ StOpenDirectoryDialog new
^ StOpenDirectoryPresenter new
defaultFolder: (path ifNil: [ StFileSystemModel defaultDirectory ]);
title: (label ifNil: [ 'Choose Directory' translated ]);
openModal;
selectedEntry
]

{ #category : 'ui requests' }
StMorphicUIManager >> chooseFileMatching: patterns label: label [
self deprecated: 'now you have to give a filter see NewTools-FileBrowser-Filtering'.
^ StOpenFileDialog new
title: (label ifNil: [ 'Choose File' translated ]);
"fileFilters: pattern ;"
open
]

{ #category : 'ui requests' }
StMorphicUIManager >> chooseFileName: title extensions: exts path: path preview: preview [
self
deprecated: 'now you have to give a filter see FileDialog-filterStrategie'.
^ (StOpenFileDialog new
title: (title ifNil: [ 'Choose File' translated ]);
"fileFilters: (exts ifNil: [ #() ] ifNotNil: [ :e | e collect: [ :each | '*.' , each ] ]);"
defaultFolder: path;
previewer: preview;
open) ifNotNil: #basename
]

{ #category : 'ui requests' }
StMorphicUIManager >> chooseFullFileName: title extensions: exts path: path preview: preview [
self
deprecated: 'now you have to give a filter see FileDialog-filterStrategie'.
^ (StOpenFileDialog new
title: (title ifNil: [ 'Choose File' translated ]);
"fileFilters: (exts ifNil: [ #() ] ifNotNil: [ :e | e collect: [ :each | '*.' , each ] ]);"
defaultFolder: path;
previewer: preview;
open) ifNotNil: #fullName
]

{ #category : 'ui requests' }
StMorphicUIManager >> chooseFullFileNameMatching: patterns label: title [
self
deprecated: 'now you have to give a filter see FileDialog-filterStrategie'.
^ StOpenFileDialog new
^ StOpenFilePresenter new
title: (title ifNil: [ 'Choose File' translated ]);
"fileFilters: (patterns ifNil: [ #() ] ifNotNil: [ :e | e collect: [ :each | '*.' , each ] ]);
"
open
]

{ #category : 'ui requests' }
StMorphicUIManager >> fileOpen: title extensions: exts path: path preview: preview [
self
deprecated: 'now you have to give a filter see FileDialog-filterStrategie'.
^ (StOpenFileDialog new
title: (title ifNil: [ 'Choose File' translated ]);
"fileFilters: (exts ifNil: [ #() ] ifNotNil: [ :e | e collect: [ :each | '*.' , each ] ]);
"defaultFolder: path;
previewer: preview;
openModal) ifNotNil: #readStream
]

{ #category : 'ui requests' }
StMorphicUIManager >> fileSave: title extensions: exts path: path [
self
deprecated: 'now you have to give a filter see FileDialog-filterStrategie'.
^ StSaveFileDialog new
title: (title ifNil: [ 'Choose File' translated ]);
"fileFilters: (exts ifNil: [ #() ] ifNotNil: [ :e | e collect: [ :each | '*.' , each ] ]);
"
defaultFolder: path;
open
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,52 @@ So no files will be shown in the file/folder listings.
see my super for more information about customization
"
Class {
#name : 'StOpenDirectoryDialog',
#superclass : 'StOpenFileOrDirectoryDialog',
#name : 'StOpenDirectoryPresenter',
#superclass : 'StOpenFileOrDirectoryPresenter',
#category : 'NewTools-FileBrowser-UI',
#package : 'NewTools-FileBrowser',
#tag : 'UI'
}

{ #category : 'examples' }
StOpenDirectoryDialog class >> example [
StOpenDirectoryPresenter class >> example [

<example>
^ self chooseThenInspect
]

{ #category : 'examples' }
StOpenDirectoryDialog class >> exampleModal [
StOpenDirectoryPresenter class >> exampleModal [

<example>
^ self chooseModalAndInspect
]

{ #category : 'hooks' }
StOpenDirectoryDialog class >> navigationSystemClass [
StOpenDirectoryPresenter class >> navigationSystemClass [

^ StDirectoryNavigationSystemPresenter
]

{ #category : 'hooks' }
StOpenDirectoryDialog >> allowsChooseDirectoryIfNoFilename [
StOpenDirectoryPresenter >> allowsChooseDirectoryIfNoFilename [

^ true
]

{ #category : 'initialization' }
StOpenDirectoryDialog >> initialExtentForWindow [
StOpenDirectoryPresenter >> initialExtentForWindow [

^ (1050 @ 550) scaledByDisplayScaleFactor
]

{ #category : 'hooks' }
StOpenDirectoryDialog >> initialTitle [
StOpenDirectoryPresenter >> initialTitle [
^ 'Select Directory To Open'
]

{ #category : 'actions' }
StOpenDirectoryDialog >> selectedEntry [
StOpenDirectoryPresenter >> selectedEntry [

super selectedEntry ifNotNil: [ :fileReference |
fileReference isDirectory ifTrue: [ ^ fileReference ] ].
Expand Down
Loading
Loading