A simple replacement for Pharo's native file/folder selection dialog.
Basic file preview
Bookmark groups
Save As
Filters
Add bookmarks
- ContextMenu to add/remove bookmark
- Toggle hidden files (right-click on file listing)
- Preset file name
- Filtering files by subclass FDAbstractSelect
- TextInputField like window path text input
- Preview system
- Change the column of the table presenter
Metacello new
baseline: 'FileDialog';
repository: 'github://hernanmd/file-dialog/repository';
load.
If you feel brave, you can replace the native dialogs everywhere in the system by running:
FDMorphicUIManager new beDefault
Of course you can switch back anytime you want.
MorphicUIManager new beDefault
FDSaveFileDialog
- saving a fileFDOpenFileDialog
- selecting a fileFDOpenDirectoryDialog
- selecting a directory
The user-facing API is in the api-customization
protocol of FDFileDialogPresenter
defaultFolder: aPath
— where should the dialog open, the default is the imageDirectoryfiltersCustomization: aCollectionOfFDAbstractPredicate
— a collection of FDAbstractPredicatebookmarks: aCollectionOfBookmark
_ see bookmark example class side of FileDialogokActionBlock: aBlock
— a one arg block executed when a file was selectedpreviewer: aPreviewer
_ a son of FDAbstractPreviewer that returning a Spec widgetcolumns: aCollectionOfColumns
_ you have to give a collection of subclass of FDAbstractFileReferenceColumn
Open a file with previewer:
FDOpenFileDialog new
previewer: FDInspectPreviewer new;
openDialog.
Save a file
FDSaveFileDialog new openDialog
Adding bookmarks
FDOpenFileDialog new
bookmarks: {
FDBookmark home.
FDBookmark root.
FDBookmark tmp.
(FDBookmark
name: 'Image location'
location: FileLocator imageDirectory
icon: nil) .
(FDGroupBookMark
name: 'exampleGroup'
collection:
{FDBookmark image.
FDBookmark home}
iconName: 'group') };
openDialog
Multiple options
FDOpenFileDialog new
previewer: FDContentPreviewer new;
"with this when you select a png file it will display it"
filtersCustomization: { FDJPGOrPNGFilter new };
"with you add filter and there always the 'no filter'"
defaultFolder: FileLocator home asFileReference;
"it's open the FileDialog on this file"
okActionBlock: [ :selectedFileReference | selectedFileReference inspect ];
openDialog