diff --git a/src/BaselineOfNewTools/BaselineOfNewTools.class.st b/src/BaselineOfNewTools/BaselineOfNewTools.class.st index 2758bff08..45190df9a 100644 --- a/src/BaselineOfNewTools/BaselineOfNewTools.class.st +++ b/src/BaselineOfNewTools/BaselineOfNewTools.class.st @@ -156,8 +156,9 @@ BaselineOfNewTools >> baseline: spec [ 'FontChooser' 'Methods' 'Spotter' - 'RewriterTools' - 'ScopesEditor') ] + 'RewriterTools' + 'ScopesEditor' + 'FileBrowser') ] ] { #category : 'external projects' } diff --git a/src/NewTools-FileBrowser-Tests/StFBAbstractFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StAbstractFilterTest.class.st similarity index 61% rename from src/NewTools-FileBrowser-Tests/StFBAbstractFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StAbstractFilterTest.class.st index eb2756ad8..a68183278 100644 --- a/src/NewTools-FileBrowser-Tests/StFBAbstractFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StAbstractFilterTest.class.st @@ -2,8 +2,8 @@ A FDAbstractFilterTest is a test class for testing the behavior of FDAbstractFilter " Class { - #name : 'StFBAbstractFilterTest', - #superclass : 'StFBTestCase', + #name : 'StAbstractFilterTest', + #superclass : 'StFileBrowserTestCase', #instVars : [ 'filter' ], @@ -13,67 +13,67 @@ Class { } { #category : 'testing' } -StFBAbstractFilterTest class >> isAbstract [ - ^ self = StFBAbstractFilterTest +StAbstractFilterTest class >> isAbstract [ + ^ self = StAbstractFilterTest ] { #category : 'accessing' } -StFBAbstractFilterTest >> actualClass [ +StAbstractFilterTest >> actualClass [ ^ self subclassResponsibility ] { #category : 'accessing' } -StFBAbstractFilterTest >> bananaJpg [ +StAbstractFilterTest >> bananaJpg [ ^ root / 'banana.jpg' ] { #category : 'accessing' } -StFBAbstractFilterTest >> dir [ +StAbstractFilterTest >> dir [ ^ root / 'dir' ] { #category : 'accessing' } -StFBAbstractFilterTest >> dirExt [ +StAbstractFilterTest >> dirExt [ ^ root / 'dir.ext' ] { #category : 'instance creation' } -StFBAbstractFilterTest >> fileNamed: aString [ +StAbstractFilterTest >> fileNamed: aString [ ^ FileSystem memory / aString ] { #category : 'accessing' } -StFBAbstractFilterTest >> hidden [ +StAbstractFilterTest >> hidden [ ^ root / '.hidden' ] { #category : 'accessing' } -StFBAbstractFilterTest >> hiddenDir [ +StAbstractFilterTest >> hiddenDir [ ^ root / '.hidden-dir' ] { #category : 'accessing' } -StFBAbstractFilterTest >> patatePng [ +StAbstractFilterTest >> patatePng [ ^ root / 'patate.png' ] { #category : 'running' } -StFBAbstractFilterTest >> setUp [ +StAbstractFilterTest >> setUp [ super setUp. filter := self actualClass new ] { #category : 'accessing' } -StFBAbstractFilterTest >> sthAaa [ +StAbstractFilterTest >> sthAaa [ ^ root / 'sth.aaa' ] { #category : 'accessing' } -StFBAbstractFilterTest >> sthExt [ +StAbstractFilterTest >> sthExt [ ^ root / 'sth.ext' ] { #category : 'tests' } -StFBAbstractFilterTest >> testPredicate [ +StAbstractFilterTest >> testPredicate [ self subclassResponsibility ] diff --git a/src/NewTools-FileBrowser-Tests/StFBBitmapFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StBitmapFilterTest.class.st similarity index 72% rename from src/NewTools-FileBrowser-Tests/StFBBitmapFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StBitmapFilterTest.class.st index 4c325285d..68dc75c3e 100644 --- a/src/NewTools-FileBrowser-Tests/StFBBitmapFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StBitmapFilterTest.class.st @@ -2,20 +2,20 @@ A FDBitmapFilterTest is a test class for testing the behavior of FDBitmapFilter " Class { - #name : 'StFBBitmapFilterTest', - #superclass : 'StFBExtensionsFilterTest', + #name : 'StBitmapFilterTest', + #superclass : 'StExtensionsFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBBitmapFilterTest >> actualClass [ - ^ StFBBitmapFilter +StBitmapFilterTest >> actualClass [ + ^ StBitmapFilter ] { #category : 'tests' } -StFBBitmapFilterTest >> testPredicate [ +StBitmapFilterTest >> testPredicate [ self assert: (filter predicate: (self fileNamed: 'bitmap.bmp')). self assert: (filter predicate: (self fileNamed: 'bitmap.dib')). self deny: (filter predicate: (self fileNamed: 'bitmap.png')) diff --git a/src/NewTools-FileBrowser-Tests/StFBWindowPathPresenterTest.class.st b/src/NewTools-FileBrowser-Tests/StBreadcrumbPresenterTest.class.st similarity index 60% rename from src/NewTools-FileBrowser-Tests/StFBWindowPathPresenterTest.class.st rename to src/NewTools-FileBrowser-Tests/StBreadcrumbPresenterTest.class.st index 1003f11a3..ce7994ccd 100644 --- a/src/NewTools-FileBrowser-Tests/StFBWindowPathPresenterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StBreadcrumbPresenterTest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'StFBWindowPathPresenterTest', - #superclass : 'StFBTestCase', + #name : 'StBreadcrumbPresenterTest', + #superclass : 'StFileBrowserTestCase', #instVars : [ 'windowPathUI' ], @@ -10,19 +10,21 @@ Class { } { #category : 'running' } -StFBWindowPathPresenterTest >> setUp [ +StBreadcrumbPresenterTest >> setUp [ super setUp. - windowPathUI := StFBWindowPathPresenter new + windowPathUI := StPathBreadcrumbPresenter + owner: fileSystemPresenter + on: fileSystemModel ] { #category : 'running' } -StFBWindowPathPresenterTest >> tearDown [ +StBreadcrumbPresenterTest >> tearDown [ windowPathUI withWindowDo: [ :window | window close ]. super tearDown ] { #category : 'tests' } -StFBWindowPathPresenterTest >> testRoot [ +StBreadcrumbPresenterTest >> testRoot [ windowPathUI currentDirectory: FileLocator root. windowPathUI open. diff --git a/src/NewTools-FileBrowser-Tests/StFBDirectoryFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StDirectoryFilterTest.class.st similarity index 67% rename from src/NewTools-FileBrowser-Tests/StFBDirectoryFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StDirectoryFilterTest.class.st index 9650f7c59..06491feb1 100644 --- a/src/NewTools-FileBrowser-Tests/StFBDirectoryFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StDirectoryFilterTest.class.st @@ -2,19 +2,20 @@ A FDDirectoryFilterTest is a test class for testing the behavior of FDDirectoryFilter " Class { - #name : 'StFBDirectoryFilterTest', - #superclass : 'StFBAbstractFilterTest', + #name : 'StDirectoryFilterTest', + #superclass : 'StAbstractFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBDirectoryFilterTest >> actualClass [ - ^ StFBDirectoryFilter +StDirectoryFilterTest >> actualClass [ + + ^ StDirectoryFilter ] { #category : 'tests' } -StFBDirectoryFilterTest >> testPredicate [ +StDirectoryFilterTest >> testPredicate [ self assertCollection: (filter applyOn: root children) hasSameElements: {self dir . self dirExt . self hiddenDir} ] diff --git a/src/NewTools-FileBrowser-Tests/StFBExtensionsFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StExtensionsFilterTest.class.st similarity index 60% rename from src/NewTools-FileBrowser-Tests/StFBExtensionsFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StExtensionsFilterTest.class.st index 7f2743d78..74533a28d 100644 --- a/src/NewTools-FileBrowser-Tests/StFBExtensionsFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StExtensionsFilterTest.class.st @@ -2,14 +2,14 @@ A FDExtensionsFilterTest is a test class for testing the behavior of FDExtensionsFilter " Class { - #name : 'StFBExtensionsFilterTest', - #superclass : 'StFBAbstractFilterTest', + #name : 'StExtensionsFilterTest', + #superclass : 'StAbstractFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'testing' } -StFBExtensionsFilterTest class >> isAbstract [ - ^ self = StFBExtensionsFilterTest +StExtensionsFilterTest class >> isAbstract [ + ^ self = StExtensionsFilterTest ] diff --git a/src/NewTools-FileBrowser-Tests/StFBTestCase.class.st b/src/NewTools-FileBrowser-Tests/StFBTestCase.class.st deleted file mode 100644 index 0dd5ffdd7..000000000 --- a/src/NewTools-FileBrowser-Tests/StFBTestCase.class.st +++ /dev/null @@ -1,37 +0,0 @@ -Class { - #name : 'StFBTestCase', - #superclass : 'TestCase', - #instVars : [ - 'root' - ], - #category : 'NewTools-FileBrowser-Tests-UI', - #package : 'NewTools-FileBrowser-Tests', - #tag : 'UI' -} - -{ #category : 'testing' } -StFBTestCase class >> isAbstract [ - ^ self = StFBTestCase -] - -{ #category : 'accessing' } -StFBTestCase class >> resources [ - ^ {StFBFileSystemResource} -] - -{ #category : 'testing' } -StFBTestCase class >> shouldInheritSelectors [ - ^ true -] - -{ #category : 'instance creation' } -StFBTestCase >> inspectRoot [ - - -] - -{ #category : 'running' } -StFBTestCase >> setUp [ - super setUp. - root := StFBFileSystemResource current root -] diff --git a/src/NewTools-FileBrowser-Tests/StFileBrowserTestCase.class.st b/src/NewTools-FileBrowser-Tests/StFileBrowserTestCase.class.st new file mode 100644 index 000000000..37feda1e0 --- /dev/null +++ b/src/NewTools-FileBrowser-Tests/StFileBrowserTestCase.class.st @@ -0,0 +1,42 @@ +Class { + #name : 'StFileBrowserTestCase', + #superclass : 'TestCase', + #instVars : [ + 'root', + 'fileSystemModel', + 'fileSystemPresenter' + ], + #category : 'NewTools-FileBrowser-Tests-UI', + #package : 'NewTools-FileBrowser-Tests', + #tag : 'UI' +} + +{ #category : 'testing' } +StFileBrowserTestCase class >> isAbstract [ + ^ self = StFileBrowserTestCase +] + +{ #category : 'accessing' } +StFileBrowserTestCase class >> resources [ + ^ {StFileSystemResource} +] + +{ #category : 'testing' } +StFileBrowserTestCase class >> shouldInheritSelectors [ + ^ true +] + +{ #category : 'instance creation' } +StFileBrowserTestCase >> inspectRoot [ + + +] + +{ #category : 'running' } +StFileBrowserTestCase >> setUp [ + + super setUp. + fileSystemModel := StFileSystemModel new. + fileSystemPresenter := StFileSystemPresenter on: fileSystemModel. + root := StFileSystemResource current root +] diff --git a/src/NewTools-FileBrowser-Tests/StFBFileDialogTest.class.st b/src/NewTools-FileBrowser-Tests/StFileDialogTest.class.st similarity index 61% rename from src/NewTools-FileBrowser-Tests/StFBFileDialogTest.class.st rename to src/NewTools-FileBrowser-Tests/StFileDialogTest.class.st index d91942fcc..789b56657 100644 --- a/src/NewTools-FileBrowser-Tests/StFBFileDialogTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StFileDialogTest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'StFBFileDialogTest', - #superclass : 'StFBTestCase', + #name : 'StFileDialogTest', + #superclass : 'StFileBrowserTestCase', #instVars : [ 'dialog', 'window' @@ -11,17 +11,17 @@ Class { } { #category : 'testing' } -StFBFileDialogTest class >> isAbstract [ - ^ self = StFBFileDialogTest +StFileDialogTest class >> isAbstract [ + ^ self = StFileDialogTest ] { #category : 'accessing' } -StFBFileDialogTest >> dialogClass [ +StFileDialogTest >> dialogClass [ ^ self subclassResponsibility ] { #category : 'tests' } -StFBFileDialogTest >> fileListAllMustBeFilterByPNGFIlter [ +StFileDialogTest >> fileListAllMustBeFilterByPNGFIlter [ self assert: (dialog fileReferenceTable items @@ -31,32 +31,33 @@ StFBFileDialogTest >> fileListAllMustBeFilterByPNGFIlter [ ] { #category : 'running' } -StFBFileDialogTest >> setUp [ +StFileDialogTest >> setUp [ super setUp. - (dialog := self dialogClass new) defaultFolder: root + (dialog := self dialogClass owner: fileSystemPresenter on: fileSystemModel) defaultFolder: root ] { #category : 'running' } -StFBFileDialogTest >> tearDown [ +StFileDialogTest >> tearDown [ + dialog class initialize. - window ifNotNil: #delete. + window ifNotNil: [ : w | w delete ]. super tearDown ] { #category : 'tests' } -StFBFileDialogTest >> testIsRootDirectory [ +StFileDialogTest >> testIsRootDirectory [ self assert: (dialog isRootDirectory: FileLocator root) ] { #category : 'tests' } -StFBFileDialogTest >> testIsRootDirectoryWindowsDrive [ +StFileDialogTest >> testIsRootDirectoryWindowsDrive [ OSPlatform current isWindows ifFalse: [ ^ self ]. self assert: (dialog isRootDirectory: FileLocator C) ] { #category : 'tests' } -StFBFileDialogTest >> testOpen [ +StFileDialogTest >> testOpen [ "will it even open?" @@ -64,7 +65,7 @@ StFBFileDialogTest >> testOpen [ ] { #category : 'tests' } -StFBFileDialogTest >> testOpenFolder [ +StFileDialogTest >> testOpenFolder [ window := dialog open. self assert: dialog currentDirectory equals: root. dialog showDirectory: root / 'dir'. @@ -72,18 +73,15 @@ StFBFileDialogTest >> testOpenFolder [ ] { #category : 'tests' } -StFBFileDialogTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAddedToBookmarkTreeTable [ +StFileDialogTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAddedToBookmarkTreeTable [ | aCollectionOfBookmark | aCollectionOfBookmark := {(root / 'dir') asFileReference. (root / 'dir.ext') asFileReference} - collect: - [ :eachItem | StFBBookmark name: eachItem basename location: eachItem path icon: nil ]. - dialog - bookmarks: - {(StFBGroupBookmark + collect: [ :eachItem | StFileBrowserBookmark name: eachItem basename location: eachItem path icon: nil ]. + dialog bookmarks: { (StFileBrowserGroupBookmark name: 'aTestBookmark' collection: aCollectionOfBookmark - iconName: '')}. + iconName: '') }. self assertCollection: (dialog bookmarksTreeTable roots at: 1) collection hasSameElements: aCollectionOfBookmark. @@ -91,13 +89,13 @@ StFBFileDialogTest >> testWhenAddACollectionOfBookmarkToCustomBookmarkShouldBeAd ] { #category : 'tests' } -StFBFileDialogTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllInstance [ +StFileDialogTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllInstance [ | anOtherInstance addCommand | - anOtherInstance := StFBOpenDirectoryDialog new. + anOtherInstance := StOpenDirectoryDialog new. self assertCollection: anOtherInstance bookmarks hasSameElements: dialog bookmarks. - addCommand := StFBAddBookmarkCommand new. + addCommand := StFileBrowserAddBookmarkCommand new. addCommand context: dialog fileNavigationSystem. dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). @@ -111,24 +109,24 @@ StFBFileDialogTest >> testWhenAddingBookmarkOnDefaultBookmarksShouldBeAddToAllIn ] { #category : 'tests' } -StFBFileDialogTest >> testWhenAddingBookmarkOnIsolateBookmarksShouldBeAddToAllInstance [ +StFileDialogTest >> testWhenAddingBookmarkOnIsolateBookmarksShouldBeAddToAllInstance [ | anOtherInstance addCommand | dialog isolate. - addCommand := StFBAddBookmarkCommand new. + addCommand := StFileBrowserAddBookmarkCommand new. addCommand context: dialog fileNavigationSystem. - dialog fileReferenceTable - selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). + dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). addCommand execute. - anOtherInstance := StFBOpenDirectoryDialog new. - self flag: #issue4162. - self deny: anOtherInstance bookmarks equals: dialog bookmarks. + anOtherInstance := StOpenDirectoryDialog new. + self + assert: anOtherInstance bookmarks + equals: dialog bookmarks. self - deny: dialog bookmarksTreeTable roots + assert: dialog bookmarksTreeTable roots equals: anOtherInstance bookmarksTreeTable roots ] { #category : 'tests' } -StFBFileDialogTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [ +StFileDialogTest >> testWhenChangeDirectoryShouldFilesListContainsHisChildren [ | newDirectory | newDirectory := (root / 'dir') asFileReference. dialog defaultFolder: newDirectory. diff --git a/src/NewTools-FileBrowser-Tests/StFBFileFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StFileFilterTest.class.st similarity index 77% rename from src/NewTools-FileBrowser-Tests/StFBFileFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StFileFilterTest.class.st index 3b038ce47..ede954337 100644 --- a/src/NewTools-FileBrowser-Tests/StFBFileFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StFileFilterTest.class.st @@ -1,18 +1,18 @@ Class { - #name : 'StFBFileFilterTest', - #superclass : 'StFBAbstractFilterTest', + #name : 'StFileFilterTest', + #superclass : 'StAbstractFilterTest', #category : 'NewTools-FileBrowser-Tests-UI', #package : 'NewTools-FileBrowser-Tests', #tag : 'UI' } { #category : 'accessing' } -StFBFileFilterTest >> actualClass [ - ^ StFBFileFilter +StFileFilterTest >> actualClass [ + ^ StFileFilter ] { #category : 'tests' } -StFBFileFilterTest >> testFilterExtensions [ +StFileFilterTest >> testFilterExtensions [ self assert: ((filter files: root children withExtensions: #(aaa)) collect: #basename) asSet equals: @@ -24,7 +24,7 @@ StFBFileFilterTest >> testFilterExtensions [ ] { #category : 'tests' } -StFBFileFilterTest >> testFilterMatching [ +StFileFilterTest >> testFilterMatching [ self assert: ((filter files: root children matching: #('*th.e*' '*dd*')) collect: #basename) asSet equals: @@ -37,14 +37,14 @@ StFBFileFilterTest >> testFilterMatching [ ] { #category : 'tests' } -StFBFileFilterTest >> testFoldersOnly [ +StFileFilterTest >> testFoldersOnly [ self assert: ((filter directoriesOnly: root children) collect: #basename) asSet equals: (Set with: 'dir' with: 'dir.ext' with: '.hidden-dir') ] { #category : 'tests' } -StFBFileFilterTest >> testHiddenFiles [ +StFileFilterTest >> testHiddenFiles [ self assert: @@ -59,6 +59,6 @@ StFBFileFilterTest >> testHiddenFiles [ ] { #category : 'tests' } -StFBFileFilterTest >> testPredicate [ +StFileFilterTest >> testPredicate [ self assertCollection: (filter applyOn: root children) hasSameElements: (root children select: #isFile) ] diff --git a/src/NewTools-FileBrowser-Tests/StFBFileSystemResource.class.st b/src/NewTools-FileBrowser-Tests/StFileSystemResource.class.st similarity index 92% rename from src/NewTools-FileBrowser-Tests/StFBFileSystemResource.class.st rename to src/NewTools-FileBrowser-Tests/StFileSystemResource.class.st index ac954b07d..c11cda0e1 100644 --- a/src/NewTools-FileBrowser-Tests/StFBFileSystemResource.class.st +++ b/src/NewTools-FileBrowser-Tests/StFileSystemResource.class.st @@ -1,5 +1,5 @@ Class { - #name : 'StFBFileSystemResource', + #name : 'StFileSystemResource', #superclass : 'TestResource', #instVars : [ 'root' @@ -10,24 +10,24 @@ Class { } { #category : 'accessing' } -StFBFileSystemResource >> bananaJpg [ +StFileSystemResource >> bananaJpg [ ^ '/9j/4AAQSkZJRgABAQEAYABgAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOw1ESAAQAAAABAAAOwwAAAAAAAYagAACxj//bAEMAAgEBAgEBAgICAgICAgIDBQMDAwMDBgQEAwUHBgcHBwYHBwgJCwkICAoIBwcKDQoKCwwMDAwHCQ4PDQwOCwwMDP/bAEMBAgICAwMDBgMDBgwIBwgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIABAAEAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP38rmfGGs3MvirRNKsLya0nkuFurkxhCJIFDExNvRuHwfu4YbR8wzmofEVj4m0u7uZdJnS+t7jO2GYqHt2PdScAgdsnvjHGaTwN4EutP1ebV9Xljn1KcEKF5EQIGecdeMccAZ5OePx3OOLM/wAxzGjkOV4CvQftYutXnGKpxowleXs6iclOVVR5UkrxUm5KLWnq0cPRpwdepOMtHZdbtdV5fof/2Q==' ] { #category : 'accessing' } -StFBFileSystemResource >> patatePng [ +StFileSystemResource >> patatePng [ ^ 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAECSURBVDhPY/z//z8DKYAJShMNaK8Bnx927fVkY+WXFHZU106HCuHScHhP4r9/v998PaUgEfLl80MJaTu4HixOAqv++fbbOWZGTqBqoMiLp4cgUkCArgGs+tfbbxdYmDgEuXSAIowMjExMLBBZIEDR8OfPN7Dq83/+ffv55yMHpyhQ8D/DfyYmNogCIIBr+AvEF0+3gFj/vjL8/y/GY8HCwgWWYrB2mg1hAAFcAzMQA1387vtFYCgwMoLcAPEAXBsEYHr6HxDLifoyMoKkgKqRjQcCJA3/PwKlhTgNgUwg4///f8zMHNZOUyCScIAeD0f3pb74eFCC3x7NYDigdWplYAAAtuxmjgEpJ3EAAAAASUVORK5CYII=' ] { #category : 'accessing' } -StFBFileSystemResource >> root [ +StFileSystemResource >> root [ ^ root ] { #category : 'running' } -StFBFileSystemResource >> setUp [ +StFileSystemResource >> setUp [ super setUp. { @@ -55,7 +55,7 @@ StFBFileSystemResource >> setUp [ ] { #category : 'running' } -StFBFileSystemResource >> tearDown [ +StFileSystemResource >> tearDown [ root ensureDeleteAll. super tearDown ] diff --git a/src/NewTools-FileBrowser-Tests/StFBGIFFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StGIFFilterTest.class.st similarity index 70% rename from src/NewTools-FileBrowser-Tests/StFBGIFFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StGIFFilterTest.class.st index 91d594afe..3db1edd0a 100644 --- a/src/NewTools-FileBrowser-Tests/StFBGIFFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StGIFFilterTest.class.st @@ -2,20 +2,20 @@ A FDGIFFilterTest is a test class for testing the behavior of FDGIFFilter " Class { - #name : 'StFBGIFFilterTest', - #superclass : 'StFBExtensionsFilterTest', + #name : 'StGIFFilterTest', + #superclass : 'StExtensionsFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBGIFFilterTest >> actualClass [ - ^ StFBGIFFilter +StGIFFilterTest >> actualClass [ + ^ StGIFFilter ] { #category : 'tests' } -StFBGIFFilterTest >> testPredicate [ +StGIFFilterTest >> testPredicate [ self assert: (filter predicate: (self fileNamed: 'gif.gif')). self deny: (filter predicate: (self fileNamed: 'bitmap.png')) ] diff --git a/src/NewTools-FileBrowser-Tests/StFBJPEGFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StJPEGFilterTest.class.st similarity index 73% rename from src/NewTools-FileBrowser-Tests/StFBJPEGFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StJPEGFilterTest.class.st index fb843e399..1baaa7fd6 100644 --- a/src/NewTools-FileBrowser-Tests/StFBJPEGFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StJPEGFilterTest.class.st @@ -2,20 +2,20 @@ A FDJPEGFilterTest is a test class for testing the behavior of FDJPEGFilter " Class { - #name : 'StFBJPEGFilterTest', - #superclass : 'StFBExtensionsFilterTest', + #name : 'StJPEGFilterTest', + #superclass : 'StExtensionsFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBJPEGFilterTest >> actualClass [ - ^ StFBJPEGFilter +StJPEGFilterTest >> actualClass [ + ^ StJPEGFilter ] { #category : 'tests' } -StFBJPEGFilterTest >> testPredicate [ +StJPEGFilterTest >> testPredicate [ self assert: (filter predicate: (self fileNamed: 'image.jpeg')). self assert: (filter predicate: (self fileNamed: 'image.jpg')). self deny: (filter predicate: (self fileNamed: 'bitmap.png')) diff --git a/src/NewTools-FileBrowser-Tests/StFBNavigationSystemTest.class.st b/src/NewTools-FileBrowser-Tests/StNavigationSystemTest.class.st similarity index 66% rename from src/NewTools-FileBrowser-Tests/StFBNavigationSystemTest.class.st rename to src/NewTools-FileBrowser-Tests/StNavigationSystemTest.class.st index 0aaa9b9ff..e84922219 100644 --- a/src/NewTools-FileBrowser-Tests/StFBNavigationSystemTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StNavigationSystemTest.class.st @@ -1,6 +1,6 @@ Class { - #name : 'StFBNavigationSystemTest', - #superclass : 'StFBTestCase', + #name : 'StNavigationSystemTest', + #superclass : 'StFileBrowserTestCase', #instVars : [ 'dialog' ], @@ -10,7 +10,7 @@ Class { } { #category : 'tests' } -StFBNavigationSystemTest >> fileListAllMustBeFilterByPNGFIlter [ +StNavigationSystemTest >> fileListAllMustBeFilterByPNGFIlter [ self assert: (dialog fileReferenceTable items @@ -20,32 +20,38 @@ StFBNavigationSystemTest >> fileListAllMustBeFilterByPNGFIlter [ ] { #category : 'running' } -StFBNavigationSystemTest >> setUp [ +StNavigationSystemTest >> setUp [ + super setUp. - dialog := StFBFileNavigationSystemPresenter new. + dialog := StFileNavigationSystemPresenter + owner: fileSystemPresenter + on: fileSystemModel. dialog defaultFolder: root + ] { #category : 'tests' } -StFBNavigationSystemTest >> testCustomizationWhenChangeCollectionOfPreviewerShouldBeSet [ +StNavigationSystemTest >> testCustomizationWhenChangeCollectionOfPreviewerShouldBeSet [ | previewerUtil | - previewerUtil := StFBPNGPreviewer new. + previewerUtil := StFileBrowserPNGPreviewer new. dialog previewer: previewerUtil. self assert: dialog previewer equals: previewerUtil ] { #category : 'tests' } -StFBNavigationSystemTest >> testInitializeCurrentPathTextInputShouldSet [ +StNavigationSystemTest >> testInitializeCurrentPathTextInputShouldSet [ self assert: dialog currentDirectory fullName equals: dialog currentPathTextInputPresenter entityText text ] { #category : 'tests' } -StFBNavigationSystemTest >> testInitializeFilterDropListSelectedItemShouldBeDefaultFilter [ - self assert: dialog filtersDropList selectedItem name equals: StFBVisibleFilter new name +StNavigationSystemTest >> testInitializeFilterDropListSelectedItemShouldBeDefaultFilter [ + self + assert: dialog filtersDropList selectedItem name + equals: StVisibleFilter new name ] { #category : 'tests' } -StFBNavigationSystemTest >> testInitializeShouldOnlySeeNotHiddenFile [ +StNavigationSystemTest >> testInitializeShouldOnlySeeNotHiddenFile [ Smalltalk os isWindows ifTrue: [ self skip: @@ -59,14 +65,14 @@ StFBNavigationSystemTest >> testInitializeShouldOnlySeeNotHiddenFile [ ] { #category : 'tests' } -StFBNavigationSystemTest >> testOpenFolder [ +StNavigationSystemTest >> testOpenFolder [ self assert: dialog currentDirectory equals: root. dialog openFolder: root / 'dir'. self assert: dialog currentDirectory equals: root / 'dir' ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenClickAnAfterHistoryButtonIfThereAreHistoryShouldComeBackTheGoodDirectory [ +StNavigationSystemTest >> testWhenClickAnAfterHistoryButtonIfThereAreHistoryShouldComeBackTheGoodDirectory [ | itemsBefore | itemsBefore := dialog fileReferenceTable items. dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). @@ -79,7 +85,7 @@ StFBNavigationSystemTest >> testWhenClickAnAfterHistoryButtonIfThereAreHistorySh ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenClickAnBeforeHistoryButtonIfThereAreHistoryShouldComeBackToTheLastDirectoryVisited [ +StNavigationSystemTest >> testWhenClickAnBeforeHistoryButtonIfThereAreHistoryShouldComeBackToTheLastDirectoryVisited [ | itemsBefore | itemsBefore := dialog fileReferenceTable items. dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). @@ -90,49 +96,50 @@ StFBNavigationSystemTest >> testWhenClickAnBeforeHistoryButtonIfThereAreHistoryS ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenCurrentDirectoryChangeshouldNewFileDialogOpenOnTheNewDirectory [ +StNavigationSystemTest >> testWhenCurrentDirectoryChangeshouldNewFileDialogOpenOnTheNewDirectory [ + | dirIndex newFileDialog | dirIndex := (dialog fileReferenceTable items collect: #basename) indexOf: 'dir'. dialog fileReferenceTable selectIndex: dirIndex. dialog fileReferenceTable doubleClickAtIndex: dirIndex. - newFileDialog := StFBFileNavigationSystemPresenter new. - self assert: newFileDialog currentDirectory equals: (root / 'dir') asFileReference + newFileDialog := StFileNavigationSystemPresenter on: fileSystemModel. + newFileDialog openOnLastDirectory + ifTrue: [ self assert: newFileDialog currentDirectory equals: (root / 'dir') asFileReference ] ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenCustomizeFilterShouldFilterDropListPresenterIncludeIt [ +StNavigationSystemTest >> testWhenCustomizeFilterShouldFilterDropListPresenterIncludeIt [ | aCollectionOfFilter | - aCollectionOfFilter := {StFBAllFilter new . StFBJPEGFilter new}. + aCollectionOfFilter := {StAllFilter new . StJPEGFilter new}. dialog filtersCustomization: aCollectionOfFilter. - self assert: dialog filtersDropList selectedItem name equals: StFBAllFilter new name. + self assert: dialog filtersDropList selectedItem name equals: StAllFilter new name. self assert: (dialog filtersDropList listItems includesAll: aCollectionOfFilter) ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenCustomizeFilterWithoutDefaultFilterShouldFilterDropListPresenterIncludeDefaultFilterAndSelectIt [ +StNavigationSystemTest >> testWhenCustomizeFilterWithoutDefaultFilterShouldFilterDropListPresenterIncludeDefaultFilterAndSelectIt [ | aCollectionOfFilter | - aCollectionOfFilter := {StFBJPEGFilter new}. + aCollectionOfFilter := {StJPEGFilter new}. dialog filtersCustomization: aCollectionOfFilter. - self assert: dialog filtersDropList selectedItem name equals: StFBAllFilter new name. + self assert: dialog filtersDropList selectedItem name equals: StAllFilter new name. self assert: (dialog filtersDropList listItems includesAll: aCollectionOfFilter) ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenFilesListSelectionChangedAndIsAJPGShouldpreviewContentPresenterIsNotNil [ +StNavigationSystemTest >> testWhenFilesListSelectionChangedAndIsAJPGShouldpreviewContentPresenterIsNotNil [ | previewerUtil | - previewerUtil := StFBJPGPreviewer new. + previewerUtil := StFileBrowserJPGPreviewer new. dialog previewer: previewerUtil. dialog fileReferenceTable selectIndex: - ((dialog fileReferenceTable items collect: #basename) indexOf: - 'banana.jpg'). + ((dialog fileReferenceTable items collect: #basename) indexOf: 'banana.jpg'). self assert: dialog selectedEntry basename equals: 'banana.jpg' ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenOpenADirectoryShouldDisplayHisChildrenFilterByCurrentFilter [ - dialog filtersDropList selectIndex: ((dialog filtersDropList listItems collect: #name) indexOf: StFBPNGFilter new name). +StNavigationSystemTest >> testWhenOpenADirectoryShouldDisplayHisChildrenFilterByCurrentFilter [ + dialog filtersDropList selectIndex: ((dialog filtersDropList listItems collect: #name) indexOf: StPNGFilter new name). self fileListAllMustBeFilterByPNGFIlter. dialog fileReferenceTable selectIndex: ((dialog fileReferenceTable items collect: #basename) indexOf: 'dir'). dialog fileReferenceTable selectIndex: dialog fileReferenceTable selection selectedIndex. @@ -141,7 +148,7 @@ StFBNavigationSystemTest >> testWhenOpenADirectoryShouldDisplayHisChildrenFilter ] { #category : 'tests' } -StFBNavigationSystemTest >> testWhenPathTextInputPresenterAcceptShouldChangeFileListWithTheGoodContent [ +StNavigationSystemTest >> testWhenPathTextInputPresenterAcceptShouldChangeFileListWithTheGoodContent [ dialog currentPathTextInputPresenter pathTextChangedTo: (dialog currentPathTextInputPresenter entityText text asPath / 'dir') diff --git a/src/NewTools-FileBrowser-Tests/StFBNilFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StNilFilterTest.class.st similarity index 68% rename from src/NewTools-FileBrowser-Tests/StFBNilFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StNilFilterTest.class.st index 3f5ca9e27..072d85842 100644 --- a/src/NewTools-FileBrowser-Tests/StFBNilFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StNilFilterTest.class.st @@ -2,19 +2,20 @@ A FDNilFilterTest is a test class for testing the behavior of FDNilFilter " Class { - #name : 'StFBNilFilterTest', - #superclass : 'StFBAbstractFilterTest', + #name : 'StNilFilterTest', + #superclass : 'StAbstractFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBNilFilterTest >> actualClass [ - ^ StFBAllFilter +StNilFilterTest >> actualClass [ + + ^ StAllFilter ] { #category : 'tests' } -StFBNilFilterTest >> testPredicate [ +StNilFilterTest >> testPredicate [ self assertCollection: (filter applyOn: root children) hasSameElements: root children ] diff --git a/src/NewTools-FileBrowser-Tests/StFBOpenDirectoryDialogTest.class.st b/src/NewTools-FileBrowser-Tests/StOpenDirectoryDialogTest.class.st similarity index 74% rename from src/NewTools-FileBrowser-Tests/StFBOpenDirectoryDialogTest.class.st rename to src/NewTools-FileBrowser-Tests/StOpenDirectoryDialogTest.class.st index fd64cdc73..96c1a47d3 100644 --- a/src/NewTools-FileBrowser-Tests/StFBOpenDirectoryDialogTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StOpenDirectoryDialogTest.class.st @@ -1,25 +1,26 @@ Class { - #name : 'StFBOpenDirectoryDialogTest', - #superclass : 'StFBFileDialogTest', + #name : 'StOpenDirectoryDialogTest', + #superclass : 'StFileDialogTest', #category : 'NewTools-FileBrowser-Tests-UI', #package : 'NewTools-FileBrowser-Tests', #tag : 'UI' } { #category : 'accessing' } -StFBOpenDirectoryDialogTest >> dialogClass [ - ^ StFBOpenDirectoryDialog +StOpenDirectoryDialogTest >> dialogClass [ + + ^ StOpenDirectoryDialog ] { #category : 'tests' } -StFBOpenDirectoryDialogTest >> testDefaultDirectory [ +StOpenDirectoryDialogTest >> testDefaultDirectory [ self assert: dialog selectedEntry equals: root. dialog defaultFolder: root / 'dir'. self assert: dialog selectedEntry equals: root / 'dir' ] { #category : 'tests' } -StFBOpenDirectoryDialogTest >> testSelectDirectory [ +StOpenDirectoryDialogTest >> testSelectDirectory [ | selectedDirectory | dialog okAction: [ :dir | selectedDirectory := dir ]. @@ -36,7 +37,7 @@ StFBOpenDirectoryDialogTest >> testSelectDirectory [ ] { #category : 'tests' } -StFBOpenDirectoryDialogTest >> testSelectNonexistingDirectory [ +StOpenDirectoryDialogTest >> testSelectNonexistingDirectory [ self should: [ dialog defaultFolder: root / 'idontexist' ] diff --git a/src/NewTools-FileBrowser-Tests/StFBOpenFileDialogTest.class.st b/src/NewTools-FileBrowser-Tests/StOpenFileDialogTest.class.st similarity index 80% rename from src/NewTools-FileBrowser-Tests/StFBOpenFileDialogTest.class.st rename to src/NewTools-FileBrowser-Tests/StOpenFileDialogTest.class.st index 657fbb607..cd15d9ee1 100644 --- a/src/NewTools-FileBrowser-Tests/StFBOpenFileDialogTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StOpenFileDialogTest.class.st @@ -1,18 +1,19 @@ Class { - #name : 'StFBOpenFileDialogTest', - #superclass : 'StFBFileDialogTest', + #name : 'StOpenFileDialogTest', + #superclass : 'StFileDialogTest', #category : 'NewTools-FileBrowser-Tests-UI', #package : 'NewTools-FileBrowser-Tests', #tag : 'UI' } { #category : 'accessing' } -StFBOpenFileDialogTest >> dialogClass [ - ^ StFBOpenFileDialog +StOpenFileDialogTest >> dialogClass [ + + ^ StOpenFileDialog ] { #category : 'tests' } -StFBOpenFileDialogTest >> testExtensions [ +StOpenFileDialogTest >> testExtensions [ dialog extensions: #( ext ) named: 'Ext files'. self @@ -26,7 +27,7 @@ StFBOpenFileDialogTest >> testExtensions [ ] { #category : 'tests' } -StFBOpenFileDialogTest >> testMultipleExtensions [ +StOpenFileDialogTest >> testMultipleExtensions [ dialog extensions: #( image changes sources ) named: 'Src files'. self @@ -40,7 +41,7 @@ StFBOpenFileDialogTest >> testMultipleExtensions [ ] { #category : 'tests' } -StFBOpenFileDialogTest >> testSelectFile [ +StOpenFileDialogTest >> testSelectFile [ | selectedFile | dialog okAction: [ :file | selectedFile := file ]. diff --git a/src/NewTools-FileBrowser-Tests/StFBPNGFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StPNGFilterTest.class.st similarity index 70% rename from src/NewTools-FileBrowser-Tests/StFBPNGFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StPNGFilterTest.class.st index f93583bd6..1c0dd7e33 100644 --- a/src/NewTools-FileBrowser-Tests/StFBPNGFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StPNGFilterTest.class.st @@ -2,20 +2,20 @@ A FDPNGFilterTest is a test class for testing the behavior of FDPNGFilter " Class { - #name : 'StFBPNGFilterTest', - #superclass : 'StFBExtensionsFilterTest', + #name : 'StPNGFilterTest', + #superclass : 'StExtensionsFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBPNGFilterTest >> actualClass [ - ^ StFBPNGFilter +StPNGFilterTest >> actualClass [ + ^ StPNGFilter ] { #category : 'tests' } -StFBPNGFilterTest >> testPredicate [ +StPNGFilterTest >> testPredicate [ self assert: (filter predicate: (self fileNamed: 'image.png')). self deny: (filter predicate: (self fileNamed: 'bitmap.bmp')) ] diff --git a/src/NewTools-FileBrowser-Tests/StFBVisibleFilterTest.class.st b/src/NewTools-FileBrowser-Tests/StVisibleFilterTest.class.st similarity index 57% rename from src/NewTools-FileBrowser-Tests/StFBVisibleFilterTest.class.st rename to src/NewTools-FileBrowser-Tests/StVisibleFilterTest.class.st index b40aad6da..586fceda5 100644 --- a/src/NewTools-FileBrowser-Tests/StFBVisibleFilterTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StVisibleFilterTest.class.st @@ -2,24 +2,23 @@ A FDHidenFilterTest is a test class for testing the behavior of FDHidenFilter " Class { - #name : 'StFBVisibleFilterTest', - #superclass : 'StFBAbstractFilterTest', + #name : 'StVisibleFilterTest', + #superclass : 'StAbstractFilterTest', #category : 'NewTools-FileBrowser-Tests-Filtering', #package : 'NewTools-FileBrowser-Tests', #tag : 'Filtering' } { #category : 'accessing' } -StFBVisibleFilterTest >> actualClass [ - ^ StFBVisibleFilter +StVisibleFilterTest >> actualClass [ + ^ StVisibleFilter ] { #category : 'tests' } -StFBVisibleFilterTest >> testPredicate [ +StVisibleFilterTest >> testPredicate [ - Smalltalk os isWindows ifTrue: [ - self skip: - 'Too hard to make file hidden in Windows, do not test for it' ]. + Smalltalk os isWindows + ifTrue: [ self skip: 'Too hard to make file hidden in Windows, do not test for it' ]. self assertCollection: (filter applyOn: root children) diff --git a/src/NewTools-FileBrowser-Tests/StFBWindowsExtensionsTest.class.st b/src/NewTools-FileBrowser-Tests/StWindowsExtensionsTest.class.st similarity index 60% rename from src/NewTools-FileBrowser-Tests/StFBWindowsExtensionsTest.class.st rename to src/NewTools-FileBrowser-Tests/StWindowsExtensionsTest.class.st index 1040abc8e..906eff84b 100644 --- a/src/NewTools-FileBrowser-Tests/StFBWindowsExtensionsTest.class.st +++ b/src/NewTools-FileBrowser-Tests/StWindowsExtensionsTest.class.st @@ -2,7 +2,7 @@ A test specific to extensions for Windows OS platform " Class { - #name : 'StFBWindowsExtensionsTest', + #name : 'StWindowsExtensionsTest', #superclass : 'TestCase', #category : 'NewTools-FileBrowser-Tests-OS-Specific', #package : 'NewTools-FileBrowser-Tests', @@ -10,19 +10,19 @@ Class { } { #category : 'tests' } -StFBWindowsExtensionsTest >> testWindowsAttributes [ +StWindowsExtensionsTest >> testWindowsAttributes [ "Calling the native API should not give an error on windows" Smalltalk os isWindows ifFalse: [ ^self ]. - self assert: FileSystem workingDirectory windowsAttributes ~= -1 + self assert: (FileSystem workingDirectory perform: #windowsAttributes) ~= -1 ] { #category : 'tests' } -StFBWindowsExtensionsTest >> testWindowsAttributesForMemoryFileSystem [ +StWindowsExtensionsTest >> testWindowsAttributesForMemoryFileSystem [ "Calling the native API should not give an error on windows" Smalltalk os isWindows ifFalse: [ ^self ]. - self assert: FileSystem memory root windowsAttributes equals: 22 + self assert: (FileSystem memory root perform: #windowsAttributes) equals: 22 ] diff --git a/src/NewTools-FileBrowser/SpSelectEntity.extension.st b/src/NewTools-FileBrowser/SpSelectEntity.extension.st deleted file mode 100644 index 389cc19ba..000000000 --- a/src/NewTools-FileBrowser/SpSelectEntity.extension.st +++ /dev/null @@ -1,8 +0,0 @@ -Extension { #name : 'SpSelectEntity' } - -{ #category : '*NewTools-FileBrowser' } -SpSelectEntity class >> fDLayoutFileDialog [ - ^ SpBoxLayout newVertical - add: #entityText; - yourself -] diff --git a/src/NewTools-FileBrowser/StFBAllFilter.class.st b/src/NewTools-FileBrowser/StAllFilter.class.st similarity index 64% rename from src/NewTools-FileBrowser/StFBAllFilter.class.st rename to src/NewTools-FileBrowser/StAllFilter.class.st index cfd1a3b39..8b0e06324 100644 --- a/src/NewTools-FileBrowser/StFBAllFilter.class.st +++ b/src/NewTools-FileBrowser/StAllFilter.class.st @@ -2,24 +2,24 @@ I am a filter that will select anything (does not reject any item). " Class { - #name : 'StFBAllFilter', - #superclass : 'StFBAbstractFilter', + #name : 'StAllFilter', + #superclass : 'StFileBrowserAbstractFilter', #category : 'NewTools-FileBrowser-Filtering', #package : 'NewTools-FileBrowser', #tag : 'Filtering' } { #category : 'accessing' } -StFBAllFilter class >> priority [ +StAllFilter class >> priority [ ^ 150 ] { #category : 'accessing' } -StFBAllFilter >> name [ +StAllFilter >> name [ ^ 'All' ] { #category : 'accessing' } -StFBAllFilter >> predicate: aFileReference [ +StAllFilter >> predicate: aFileReference [ ^ true ] diff --git a/src/NewTools-FileBrowser/StFBBitmapFilter.class.st b/src/NewTools-FileBrowser/StBitmapFilter.class.st similarity index 66% rename from src/NewTools-FileBrowser/StFBBitmapFilter.class.st rename to src/NewTools-FileBrowser/StBitmapFilter.class.st index cc6c936c8..0395aeacb 100644 --- a/src/NewTools-FileBrowser/StFBBitmapFilter.class.st +++ b/src/NewTools-FileBrowser/StBitmapFilter.class.st @@ -2,19 +2,19 @@ I am a filter selecting files with a bitmap extension. " Class { - #name : 'StFBBitmapFilter', - #superclass : 'StFBExtensionsFilter', + #name : 'StBitmapFilter', + #superclass : 'StExtensionsFilter', #category : 'NewTools-FileBrowser-Filtering', #package : 'NewTools-FileBrowser', #tag : 'Filtering' } { #category : 'accessing' } -StFBBitmapFilter >> basename [ +StBitmapFilter >> basename [ ^ 'Bitmap' ] { #category : 'accessing' } -StFBBitmapFilter >> extensions [ +StBitmapFilter >> extensions [ ^ #('bmp' 'dib') ] diff --git a/src/NewTools-FileBrowser/StFBCustomExtensionsFilter.class.st b/src/NewTools-FileBrowser/StCustomExtensionsFilter.class.st similarity index 59% rename from src/NewTools-FileBrowser/StFBCustomExtensionsFilter.class.st rename to src/NewTools-FileBrowser/StCustomExtensionsFilter.class.st index ceab17756..b94d00378 100644 --- a/src/NewTools-FileBrowser/StFBCustomExtensionsFilter.class.st +++ b/src/NewTools-FileBrowser/StCustomExtensionsFilter.class.st @@ -1,6 +1,6 @@ Class { - #name : 'StFBCustomExtensionsFilter', - #superclass : 'StFBExtensionsFilter', + #name : 'StCustomExtensionsFilter', + #superclass : 'StExtensionsFilter', #instVars : [ 'extensions', 'basename' @@ -11,13 +11,13 @@ Class { } { #category : 'testing' } -StFBCustomExtensionsFilter class >> canBeDefault [ +StCustomExtensionsFilter class >> canBeDefault [ ^ false ] { #category : 'accessing - Class' } -StFBCustomExtensionsFilter class >> extensions: aCollection [ +StCustomExtensionsFilter class >> extensions: aCollection [ ^ self new extensions: aCollection; @@ -25,7 +25,7 @@ StFBCustomExtensionsFilter class >> extensions: aCollection [ ] { #category : 'accessing - Class' } -StFBCustomExtensionsFilter class >> extensions: aCollection basename: aString [ +StCustomExtensionsFilter class >> extensions: aCollection basename: aString [ ^ self new basename: aString; @@ -34,37 +34,37 @@ StFBCustomExtensionsFilter class >> extensions: aCollection basename: aString [ ] { #category : 'accessing' } -StFBCustomExtensionsFilter class >> priority [ +StCustomExtensionsFilter class >> priority [ ^ 20 ] { #category : 'accessing' } -StFBCustomExtensionsFilter >> basename [ +StCustomExtensionsFilter >> basename [ ^ basename ifNil: [ '-' ] ] { #category : 'accessing' } -StFBCustomExtensionsFilter >> basename: aString [ +StCustomExtensionsFilter >> basename: aString [ basename := aString ] { #category : 'accessing' } -StFBCustomExtensionsFilter >> extensions [ +StCustomExtensionsFilter >> extensions [ ^ extensions ] { #category : 'accessing' } -StFBCustomExtensionsFilter >> extensions: aCollection [ +StCustomExtensionsFilter >> extensions: aCollection [ extensions := aCollection. basename ifNil: [ basename := extensions asCommaString ] ] { #category : 'initialization' } -StFBCustomExtensionsFilter >> initialize [ +StCustomExtensionsFilter >> initialize [ super initialize. extensions := #( ) diff --git a/src/NewTools-FileBrowser/StFBDirectoryFilter.class.st b/src/NewTools-FileBrowser/StDirectoryFilter.class.st similarity index 65% rename from src/NewTools-FileBrowser/StFBDirectoryFilter.class.st rename to src/NewTools-FileBrowser/StDirectoryFilter.class.st index 67a90cc60..c8c9eca32 100644 --- a/src/NewTools-FileBrowser/StFBDirectoryFilter.class.st +++ b/src/NewTools-FileBrowser/StDirectoryFilter.class.st @@ -2,25 +2,25 @@ I am a filter that will only select directories. I will reject all the files of the FileDialog. " Class { - #name : 'StFBDirectoryFilter', - #superclass : 'StFBAbstractFilter', + #name : 'StDirectoryFilter', + #superclass : 'StFileBrowserAbstractFilter', #category : 'NewTools-FileBrowser-Filtering', #package : 'NewTools-FileBrowser', #tag : 'Filtering' } { #category : 'accessing' } -StFBDirectoryFilter class >> priority [ +StDirectoryFilter class >> priority [ ^ 130 ] { #category : 'accessing' } -StFBDirectoryFilter >> name [ +StDirectoryFilter >> name [ ^ 'Folders' ] { #category : 'accessing' } -StFBDirectoryFilter >> predicate: aFileReference [ +StDirectoryFilter >> predicate: aFileReference [ ^ aFileReference isDirectory ] diff --git a/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st b/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st new file mode 100644 index 000000000..047036691 --- /dev/null +++ b/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st @@ -0,0 +1,115 @@ +" +Implements a basic Spec presenter to display a directory tree. +" +Class { + #name : 'StDirectoryTreePresenter', + #superclass : 'StFileBrowserAbstractPresenter', + #instVars : [ + 'directoryTreePresenter' + ], + #category : 'NewTools-FileBrowser-UI', + #package : 'NewTools-FileBrowser', + #tag : 'UI' +} + +{ #category : 'commander2' } +StDirectoryTreePresenter class >> buildCommandsGroupWith: presenterInstance forRoot: rootCommandGroup [ + + rootCommandGroup + register: ( + (CmCommandGroup named: 'StFBDirectoryContextualMenu') asSpecGroup + register: StFileBrowserNewDirectoryCommand forSpec; + register: StFileBrowserRenameCommand forSpec; + register: StFileBrowserRemoveCommand forSpec; + register: StFileBrowserOpenTerminalCommand forSpec; + yourself) +] + +{ #category : 'layout' } +StDirectoryTreePresenter >> defaultLayout [ + + ^ SpBoxLayout newVertical + add: directoryTreePresenter; + yourself +] + +{ #category : 'ports' } +StDirectoryTreePresenter >> defaultOutputPort [ + + ^ directoryTreePresenter defaultOutputPort +] + +{ #category : 'accessing' } +StDirectoryTreePresenter >> expandPath: aFileLocator [ + "Expand the receiver's tree to aFileLocator reference" + + | path aPathForSpec currentNode | + + path := aFileLocator asPath segments asOrderedCollection. + aPathForSpec := OrderedCollection new. + aPathForSpec add: 1. + + currentNode := directoryTreePresenter roots anyOne. + + path do: [ :aPart | | found | + found := currentNode directories detect: [ :e | e basename = aPart ] ifNone: [ ^self ]. + aPathForSpec add: (currentNode directories indexOf: found). + currentNode := found ]. + + directoryTreePresenter + selectPath: aPathForSpec scrollToSelection: false +] + +{ #category : 'initialization' } +StDirectoryTreePresenter >> initializePresenters [ + + directoryTreePresenter := self newTreeTable. + directoryTreePresenter + addColumn: + (SpCompositeTableColumn new + title: 'Directories'; + addColumn: + (SpImageTableColumn new + width: 20; + evaluated: #icon; + yourself); + addColumn: + (SpStringTableColumn new + evaluated: #label; + yourself); + yourself); + roots: StFileSystemItemWrapper roots; + children: [ :aClass | aClass subdirectories ]; + beResizable; + contextMenu: [ (self rootCommandsGroup / 'StFBDirectoryContextualMenu') beRoot asMenuPresenter ]. +] + +{ #category : 'utilities' } +StDirectoryTreePresenter >> openFolder: aFileReference [ + + model openFolder: aFileReference. + self owner updateWidgetWithFileReference: aFileReference. + self expandPath: aFileReference. +] + +{ #category : 'accessing' } +StDirectoryTreePresenter >> selectedEntry [ + "Answer a representing the currently selected directory item" + + ^ directoryTreePresenter selectedItem fileReference +] + +{ #category : 'asserting' } +StDirectoryTreePresenter >> shouldReparent [ + "A removal was requested from the directory tree, which has the item to be removed as current selection, so we should move to the parent" + + ^ true +] + +{ #category : 'utilities' } +StDirectoryTreePresenter >> updateFileSystemContents [ + + super updateFileSystemContents. + directoryTreePresenter roots: StFileSystemItemWrapper roots. + self expandPath: self currentDirectory. +] diff --git a/src/NewTools-FileBrowser/StDirectoryWrapper.class.st b/src/NewTools-FileBrowser/StDirectoryWrapper.class.st new file mode 100644 index 000000000..8d2c7bdbd --- /dev/null +++ b/src/NewTools-FileBrowser/StDirectoryWrapper.class.st @@ -0,0 +1,16 @@ +" +A wrapper for a regular directory +" +Class { + #name : 'StDirectoryWrapper', + #superclass : 'StFileSystemItemWrapper', + #category : 'NewTools-FileBrowser-Wrappers', + #package : 'NewTools-FileBrowser', + #tag : 'Wrappers' +} + +{ #category : 'testing' } +StDirectoryWrapper >> isDirectory [ + + ^true +] diff --git a/src/NewTools-FileBrowser/StFBExtensionsFilter.class.st b/src/NewTools-FileBrowser/StExtensionsFilter.class.st similarity index 75% rename from src/NewTools-FileBrowser/StFBExtensionsFilter.class.st rename to src/NewTools-FileBrowser/StExtensionsFilter.class.st index 05ceb3a64..f48d95c43 100644 --- a/src/NewTools-FileBrowser/StFBExtensionsFilter.class.st +++ b/src/NewTools-FileBrowser/StExtensionsFilter.class.st @@ -10,25 +10,25 @@ Public API and Key Messages - #extensions Return the collection of extensions we should keep with this filter. " Class { - #name : 'StFBExtensionsFilter', - #superclass : 'StFBAbstractFilter', + #name : 'StExtensionsFilter', + #superclass : 'StFileBrowserAbstractFilter', #category : 'NewTools-FileBrowser-Filtering', #package : 'NewTools-FileBrowser', #tag : 'Filtering' } { #category : 'testing' } -StFBExtensionsFilter class >> isAbstract [ - ^ self = StFBExtensionsFilter +StExtensionsFilter class >> isAbstract [ + ^ self = StExtensionsFilter ] { #category : 'accessing' } -StFBExtensionsFilter class >> priority [ +StExtensionsFilter class >> priority [ ^ 50 ] { #category : 'comparing' } -StFBExtensionsFilter >> = aComparable [ +StExtensionsFilter >> = aComparable [ "Double dispatch" @@ -36,7 +36,7 @@ StFBExtensionsFilter >> = aComparable [ ] { #category : 'adding' } -StFBExtensionsFilter >> addExtensionTo: aFileReference [ +StExtensionsFilter >> addExtensionTo: aFileReference [ (self predicate: aFileReference) ifTrue: [ ^ aFileReference ]. self extensions ifEmpty: [ ^ aFileReference ]. @@ -44,12 +44,12 @@ StFBExtensionsFilter >> addExtensionTo: aFileReference [ ] { #category : 'accessing' } -StFBExtensionsFilter >> basename [ +StExtensionsFilter >> basename [ ^ self subclassResponsibility ] { #category : 'comparing' } -StFBExtensionsFilter >> equalsToExtensionFilter: aExtensionFilter [ +StExtensionsFilter >> equalsToExtensionFilter: aExtensionFilter [ "Compare the receiver with the argument and answer with true if the receiver is equal to the argument. Otherwise answer false." @@ -58,14 +58,14 @@ StFBExtensionsFilter >> equalsToExtensionFilter: aExtensionFilter [ ] { #category : 'accessing' } -StFBExtensionsFilter >> extensions [ +StExtensionsFilter >> extensions [ "Should return sequenceable collection of extensions" ^ self subclassResponsibility ] -{ #category : 'as yet unclassified' } -StFBExtensionsFilter >> extensionsWithDots [ +{ #category : 'accessing' } +StExtensionsFilter >> extensionsWithDots [ ^ self extensions collect: [ :each | each first = $. @@ -74,7 +74,7 @@ StFBExtensionsFilter >> extensionsWithDots [ ] { #category : 'comparing' } -StFBExtensionsFilter >> hash [ +StExtensionsFilter >> hash [ "Hash must be redefined whenever = is redefined." @@ -82,7 +82,7 @@ StFBExtensionsFilter >> hash [ ] { #category : 'accessing' } -StFBExtensionsFilter >> name [ +StExtensionsFilter >> name [ ^ String streamContents: [ :s | s @@ -99,11 +99,11 @@ StFBExtensionsFilter >> name [ ] { #category : 'accessing' } -StFBExtensionsFilter >> predicate: aFileReference [ +StExtensionsFilter >> predicate: aFileReference [ aFileReference isDirectory ifTrue: [ ^ true ]. ^ (self extensionsWithDots anySatisfy: [ :extension | aFileReference basename asLowercase endsWith: extension ]) and: [ - StFBVisibleFilter new predicate: aFileReference ] + StVisibleFilter new predicate: aFileReference ] ] diff --git a/src/NewTools-FileBrowser/StFBAbstractBookMark.class.st b/src/NewTools-FileBrowser/StFBAbstractBookMark.class.st deleted file mode 100644 index b40125c47..000000000 --- a/src/NewTools-FileBrowser/StFBAbstractBookMark.class.st +++ /dev/null @@ -1,53 +0,0 @@ -" -i'm an Abstract class to - -my subclass must define: - -isComposite : return Boolean - -IV : - -icon
-name -" -Class { - #name : 'StFBAbstractBookMark', - #superclass : 'Object', - #instVars : [ - 'name', - 'icon' - ], - #category : 'NewTools-FileBrowser-Bookmark', - #package : 'NewTools-FileBrowser', - #tag : 'Bookmark' -} - -{ #category : 'accessing' } -StFBAbstractBookMark >> children [ - ^ self subclassResponsibility -] - -{ #category : 'accessing' } -StFBAbstractBookMark >> icon [ - ^ icon -] - -{ #category : 'accessing' } -StFBAbstractBookMark >> icon: anObject [ - icon := anObject -] - -{ #category : 'testing' } -StFBAbstractBookMark >> isComposite [ - ^ self subclassResponsibility. -] - -{ #category : 'accessing' } -StFBAbstractBookMark >> name [ - ^ name -] - -{ #category : 'accessing' } -StFBAbstractBookMark >> name: anObject [ - name := anObject -] diff --git a/src/NewTools-FileBrowser/StFBFileDialogPresenter.class.st b/src/NewTools-FileBrowser/StFBFileDialogPresenter.class.st deleted file mode 100644 index 71724d51a..000000000 --- a/src/NewTools-FileBrowser/StFBFileDialogPresenter.class.st +++ /dev/null @@ -1,468 +0,0 @@ -" -I am an abstract base class for different styles of opening/saving. - - - - -## author - -main Author : peteruhnak -Migrator Spec 1 to Spec 2 : CafeKrem (github pseudo) -if you have question please send me a mail : dutriezcle@gmail.com - -## Examples - -|------------------------------------------| - look at this method -|---> FDFileDialogPresenter fullExample <--| -|------------------------------------------| - -see class-side - -## Website - -https://github.com/peteruhnak/file-dialog - -## HOW TO RUN - -FDOpenFileDialog open -open is define in FDFileDialogPresenter class side -Don't use me directly -- instead use one of my children. - -## CUSTOMIZATION - -I define some method to customize your son of FileDialogPresenter - -whenSelected: aBlock - this method is use to define the action of the accept button - -filtersCustomization: aCollection - this method is use to define a set of Filter (choose one or more among FDAbstractPredicate son or creat a new predicate) - THERE IS ALWAYS THE DEFAULT FILTER (this filter filterNothing) - example: - - (FDOpenFileDialog new filtersCustomization: { FDJPGAndPNGPredicate new }) openDialogWithSpec - -bookmarks: aCollection Of FDAbstractBookMark - this method will set bookmarks use the class FDAbstractBookMark - you can create group with FDGroupBookMark or use FDBookMark to create bookmark - example : - - class side method defaultBookmarks - -defaultFolder: aPath - this method will open tou fileDialog on a aPath , this path must exist and be a directory - example - - (FDOpenFileDialog new defaultFolder: '/home/cdutriez/' asFileReference) openDialogWithSpec - -icons ------ - if you want to add icons you just have to create a method with pragma and this method have to return an array of association - example: - - see FDFileDialogPresenter textIcons method - -" -Class { - #name : 'StFBFileDialogPresenter', - #superclass : 'StPresenter', - #instVars : [ - 'bookmarksTreeTable', - 'bookmarks', - 'fileNavigationSystem', - 'okAction', - 'title', - 'filter' - ], - #classVars : [ - 'Bookmarks', - 'OkAction' - ], - #category : 'NewTools-FileBrowser-UI', - #package : 'NewTools-FileBrowser', - #tag : 'UI' -} - -{ #category : 'icons' } -StFBFileDialogPresenter class >> allIcons [ - - ^ (Pragma allNamed: 'icons' in: StFBFileDialogPresenter class) - flatCollect: - [ :pragma | pragma methodClass instanceSide perform: pragma methodSelector ] -] - -{ #category : 'commander2' } -StFBFileDialogPresenter class >> buildCommandsGroupWith: presenter forRoot: rootCommandGroup [ - rootCommandGroup - register: - ((CmCommandGroup named: 'Menu') asSpecGroup - register: StFBRemoveBookmarkCommand forSpec; - yourself) -] - -{ #category : 'examples' } -StFBFileDialogPresenter class >> chooseModal [ - - "Return selected item immediately (blocking/modal). Returns nil if no valid item selected" - - ^ self new openModal -] - -{ #category : 'examples' } -StFBFileDialogPresenter class >> chooseModalAndInspect [ - - ^ self chooseModal inspect -] - -{ #category : 'examples' } -StFBFileDialogPresenter class >> chooseModalIfNone: aBlock [ - - "Return selected item immediately (blocking/modal). Returns nil if no valid item selected" - - ^ self chooseModal ifNil: aBlock -] - -{ #category : 'examples' } -StFBFileDialogPresenter class >> chooseThenDo: aBlock [ - - "Return selected item immediately (blocking/modal). Returns nil if no valid item selected" - - - ^ self new - okAction: aBlock; - open -] - -{ #category : 'examples' } -StFBFileDialogPresenter class >> chooseThenInspect [ - - ^ self chooseThenDo: [ :file | file inspect ] -] - -{ #category : 'specs' } -StFBFileDialogPresenter class >> defaultLayout [ - - ^ SpPanedLayout newLeftToRight - positionOfSlider: 200; - add: #bookmarksTreeTable; - add: #fileNavigationSystem; - yourself -] - -{ #category : 'defaultClassVariable' } -StFBFileDialogPresenter class >> defaultOkActionBlock [ - ^ [ :fileReference | fileReference ] -] - -{ #category : 'accessing - Class' } -StFBFileDialogPresenter class >> extensions: aCollectionOfExtensions [ - - ^ self new - extensions: aCollectionOfExtensions; - openDialog; - yourself -] - -{ #category : 'accessing - Class' } -StFBFileDialogPresenter class >> extensions: aCollectionOfExtensions named: aString [ - - ^ self new - extensions: aCollectionOfExtensions named: aString; - openDialog; - yourself -] - -{ #category : 'class initialization' } -StFBFileDialogPresenter class >> initialize [ - OkAction := self defaultOkActionBlock. - Bookmarks := StFBBookmark defaultBookmarks -] - -{ #category : 'icons' } -StFBFileDialogPresenter class >> textIcons [ - - ^ {(#st -> (self iconNamed: #smallLeftFlush)). - (#txt -> (self iconNamed: #smallLeftFlush))} -] - -{ #category : 'hooks' } -StFBFileDialogPresenter >> allowsChooseDirectoryIfNoFilename [ - - ^ false -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> bookmarks [ - ^ bookmarks -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> bookmarks: aCollectionOfFDGroupBookMark [ - bookmarks := aCollectionOfFDGroupBookMark asOrderedCollection. - bookmarksTreeTable roots: bookmarks -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> bookmarksTreeTable [ - ^ bookmarksTreeTable -] - -{ #category : 'accessing - ui' } -StFBFileDialogPresenter >> cancelLabel [ - - ^ 'Cancel' -] - -{ #category : 'testing' } -StFBFileDialogPresenter >> cancelled [ - - ^ self withWindowDo: [ :w | w cancelled ] -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> columns: aCollectionOfColumns [ - fileNavigationSystem columns: aCollectionOfColumns -] - -{ #category : 'actions' } -StFBFileDialogPresenter >> confirm [ - - self withWindowDo: #triggerOkAction -] - -{ #category : 'accessing - ui' } -StFBFileDialogPresenter >> confirmLabel [ - - ^ 'Accept' -] - -{ #category : 'actions' } -StFBFileDialogPresenter >> confirmed [ - - okAction cull: self selectedEntry -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> connectPresenters [ - - bookmarksTreeTable whenSelectionChangedDo: [ :selection | - selection selectedItem ifNotNil: [ :selectedItem | - selectedItem isComposite ifFalse: [ - fileNavigationSystem openFolder: selectedItem location ] ] ] -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> currentDirectory [ - ^ fileNavigationSystem currentDirectory -] - -{ #category : 'utilities' } -StFBFileDialogPresenter >> defaultFolder [ - - ^ FileLocator imageDirectory asFileReference -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> defaultFolder: aPath [ - fileNavigationSystem defaultFolder: aPath -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> extensions: aCollectionOfExtensions [ - - self filter: - (StFBCustomExtensionsFilter extensions: aCollectionOfExtensions) -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> extensions: aCollectionOfExtensions named: aString [ - - self filter: (StFBCustomExtensionsFilter - extensions: aCollectionOfExtensions - basename: aString) -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> fileNavigationSystem [ - ^ fileNavigationSystem -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> fileReferenceTable [ - ^ fileNavigationSystem fileReferenceTable -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> filter: aStFBFilter [ - - filter := aStFBFilter. - fileNavigationSystem ifNotNil: [ fileNavigationSystem filter: filter ] -] - -{ #category : 'utilities' } -StFBFileDialogPresenter >> iconFor: anEntry [ - - | ext | - anEntry isDirectory ifTrue: [ ^ self iconNamed: #open ]. - ext := anEntry extension. - ^ self class allIcons asDictionary - at: ext - ifPresent: [ :icon | icon ] - ifAbsent: [ self iconNamed: #page ] -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initialize [ - - bookmarks := Bookmarks. - okAction := OkAction. - - filter := StFBVisibleFilter new. - super initialize -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initializeBookmarksTreeTable [ - - bookmarksTreeTable - hideColumnHeaders; - addColumn: (SpCompositeTableColumn new - addColumn: - (SpImageTableColumn evaluated: [ :each | each icon ]) - beNotExpandable; - addColumn: - (SpStringTableColumn evaluated: [ :groupBookMark | - groupBookMark name ]); - yourself); - roots: bookmarks; - children: #children; - contextMenuFromCommandsGroup: [ self rootCommandsGroup / 'Menu' ]; - expandRoots -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initializeConfirmButton: aButton [ - - | buttonEnableBlock | - self allowsChooseDirectoryIfNoFilename ifTrue: [ ^ self ]. - buttonEnableBlock := [ :newText | - aButton enabled: newText trimmed isNotEmpty ]. - fileNavigationSystem nameText whenTextChangedDo: buttonEnableBlock. - buttonEnableBlock value: fileNavigationSystem nameText text -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initializeDialogWindow: aDialogWindowPresenter [ - - | confirmButton | - aDialogWindowPresenter - okAction: [ - self selectedEntry ifNotNil: [ :entry | - aDialogWindowPresenter beOk. - aDialogWindowPresenter close. - self confirmed ] ]; - cancelAction: #close; - addButton: self cancelLabel do: #triggerCancelAction. - confirmButton := aDialogWindowPresenter - addButton: self confirmLabel - do: #triggerOkAction. - self initializeConfirmButton: confirmButton -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initializePresenters [ - - bookmarksTreeTable := self newTreeTable. - fileNavigationSystem := self instantiate: - StFBFileNavigationSystemPresenter. - fileNavigationSystem filter: filter. - - self initializeBookmarksTreeTable -] - -{ #category : 'initialization' } -StFBFileDialogPresenter >> initializeWindow: aWindowPresenter [ - - aWindowPresenter - title: self title; - initialExtent: 1050 @ 750 -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> isRootDirectory: aDirectory [ - ^ aDirectory isRoot or: [ OSPlatform current isWindows and: [ aDirectory parent isRoot ] ] -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> isolate [ - bookmarks := bookmarks copy. - -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> okAction: aOneArgBlock [ - okAction := aOneArgBlock -] - -{ #category : 'opening' } -StFBFileDialogPresenter >> open [ - - ^ self openDialog -] - -{ #category : 'opening' } -StFBFileDialogPresenter >> openModal [ - - super openModal cancelled ifTrue: [ ^ nil ]. - ^ self selectedEntry -] - -{ #category : 'api - customization' } -StFBFileDialogPresenter >> previewer: aPreviewer [ - fileNavigationSystem previewer: aPreviewer -] - -{ #category : 'utilities' } -StFBFileDialogPresenter >> selectFile: aFile [ - - fileNavigationSystem selectedEntry = aFile ifFalse: [ - fileNavigationSystem fileReferenceTable selectIndex: - (fileNavigationSystem fileReferenceTable items indexOf: aFile) ]. - fileNavigationSystem nameText text: aFile basename -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> selectedBookMark [ - ^ bookmarksTreeTable selection selectedItem -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> selectedEntry [ - - | entry | - entry := fileNavigationSystem selectedEntry. - (self allowsChooseDirectoryIfNoFilename not and: [ - entry exists and: [ entry isDirectory ] ]) ifTrue: [ - self inform: 'Only files could be selected (no directories)'. - ^ nil ]. - ^ entry -] - -{ #category : 'accessing' } -StFBFileDialogPresenter >> showDirectory: aFileReference [ - - fileNavigationSystem currentDirectory: aFileReference -] - -{ #category : 'accessing - ui' } -StFBFileDialogPresenter >> title [ - - ^ title ifNil: [ self initialTitle ] -] - -{ #category : 'accessing - ui' } -StFBFileDialogPresenter >> title: aString [ - - title := aString -] diff --git a/src/NewTools-FileBrowser/StFBOpenFileOrDirectoryDialog.class.st b/src/NewTools-FileBrowser/StFBOpenFileOrDirectoryDialog.class.st deleted file mode 100644 index 7965b5aa6..000000000 --- a/src/NewTools-FileBrowser/StFBOpenFileOrDirectoryDialog.class.st +++ /dev/null @@ -1,25 +0,0 @@ -Class { - #name : 'StFBOpenFileOrDirectoryDialog', - #superclass : 'StFBFileDialogPresenter', - #category : 'NewTools-FileBrowser-UI', - #package : 'NewTools-FileBrowser', - #tag : 'UI' -} - -{ #category : 'accessing - ui' } -StFBOpenFileOrDirectoryDialog >> confirmLabel [ - - ^ 'Open' -] - -{ #category : 'hooks' } -StFBOpenFileOrDirectoryDialog >> initialTitle [ - ^ self subclassResponsibility -] - -{ #category : 'initialization' } -StFBOpenFileOrDirectoryDialog >> initializePresenters [ - - super initializePresenters. - fileNavigationSystem nameText disable -] diff --git a/src/NewTools-FileBrowser/StFBRemoveBookmarkCommand.class.st b/src/NewTools-FileBrowser/StFBRemoveBookmarkCommand.class.st deleted file mode 100644 index 63b29bda6..000000000 --- a/src/NewTools-FileBrowser/StFBRemoveBookmarkCommand.class.st +++ /dev/null @@ -1,38 +0,0 @@ -" -I'm a command use to remove bookmark - - -" -Class { - #name : 'StFBRemoveBookmarkCommand', - #superclass : 'CmCommand', - #category : 'NewTools-FileBrowser-Commands', - #package : 'NewTools-FileBrowser', - #tag : 'Commands' -} - -{ #category : 'converting' } -StFBRemoveBookmarkCommand >> asSpecCommand [ - ^ super asSpecCommand - iconName: #remotesManagerRemoveRemote; - yourself -] - -{ #category : 'hooks' } -StFBRemoveBookmarkCommand >> execute [ - | collection tmpBookmark collectionSize | - collection := self context bookmarksTreeTable selection selectedPath. - collectionSize := collection size."teta(N)" - tmpBookmark := self context bookmarks. - [collectionSize = 1 ] whileFalse: [ tmpBookmark := tmpBookmark at: (collection at: 1).collectionSize := collectionSize -1 ]. - tmpBookmark removeAt: (collection at: 1). - self context bookmarksTreeTable roots: self context bookmarks -] - -{ #category : 'initialization' } -StFBRemoveBookmarkCommand >> initialize [ - super initialize. - self - name: 'Remove'; - description: 'Remove the selected bookmark' -] diff --git a/src/NewTools-FileBrowser/StFileBrowserAbstractBookMark.class.st b/src/NewTools-FileBrowser/StFileBrowserAbstractBookMark.class.st new file mode 100644 index 000000000..2f1179f6f --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserAbstractBookMark.class.st @@ -0,0 +1,53 @@ +" +i'm an Abstract class to group common file browser bookmarks behavior and state. + +Subclasses must define: + +- `isComposite` : Answer a `Boolean` + +## Instance variables + +- `icon`: `Form` +- `name`: `String` +" +Class { + #name : 'StFileBrowserAbstractBookMark', + #superclass : 'Object', + #instVars : [ + 'name', + 'icon' + ], + #category : 'NewTools-FileBrowser-Bookmark', + #package : 'NewTools-FileBrowser', + #tag : 'Bookmark' +} + +{ #category : 'accessing' } +StFileBrowserAbstractBookMark >> children [ + ^ self subclassResponsibility +] + +{ #category : 'accessing' } +StFileBrowserAbstractBookMark >> icon [ + ^ icon +] + +{ #category : 'accessing' } +StFileBrowserAbstractBookMark >> icon: anObject [ + icon := anObject +] + +{ #category : 'testing' } +StFileBrowserAbstractBookMark >> isComposite [ + ^ self subclassResponsibility. +] + +{ #category : 'accessing' } +StFileBrowserAbstractBookMark >> name [ + ^ name +] + +{ #category : 'accessing' } +StFileBrowserAbstractBookMark >> name: anObject [ + name := anObject +] diff --git a/src/NewTools-FileBrowser/StFBAbstractColumn.class.st b/src/NewTools-FileBrowser/StFileBrowserAbstractColumn.class.st similarity index 70% rename from src/NewTools-FileBrowser/StFBAbstractColumn.class.st rename to src/NewTools-FileBrowser/StFileBrowserAbstractColumn.class.st index 8bbe89bf2..7931e35d6 100644 --- a/src/NewTools-FileBrowser/StFBAbstractColumn.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserAbstractColumn.class.st @@ -10,7 +10,7 @@ My subclasses will each represent a concrete column and define: - Optionally, how to customize the column " Class { - #name : 'StFBAbstractColumn', + #name : 'StFileBrowserAbstractColumn', #superclass : 'Object', #category : 'NewTools-FileBrowser-Columns', #package : 'NewTools-FileBrowser', @@ -18,7 +18,7 @@ Class { } { #category : 'adding' } -StFBAbstractColumn class >> addContraintTo: aTableColumn [ +StFileBrowserAbstractColumn class >> addContraintTo: aTableColumn [ "I'm use to add option to column like width ... look at class SpTableColumn" @@ -26,7 +26,7 @@ StFBAbstractColumn class >> addContraintTo: aTableColumn [ ] { #category : 'accessing' } -StFBAbstractColumn class >> column [ +StFileBrowserAbstractColumn class >> column [ "I'm returning a SpTreeTableColumn" | column | @@ -36,37 +36,37 @@ StFBAbstractColumn class >> column [ ] { #category : 'accessing' } -StFBAbstractColumn class >> columns [ +StFileBrowserAbstractColumn class >> columns [ ^ ((self allSubclasses reject: #isAbstract) sort: #priority ascending) collect: #column ] { #category : 'templateMethod' } -StFBAbstractColumn class >> contentValuable [ +StFileBrowserAbstractColumn class >> contentValuable [ ^ [ :selectedFileReference | self evaluateOn: selectedFileReference ] ] { #category : 'templateMethod' } -StFBAbstractColumn class >> evaluateOn: aFileReference [ +StFileBrowserAbstractColumn class >> evaluateOn: aFileReference [ ^ self subclassResponsibility ] { #category : 'testing' } -StFBAbstractColumn class >> isAbstract [ - ^ self = StFBAbstractColumn +StFileBrowserAbstractColumn class >> isAbstract [ + ^ self = StFileBrowserAbstractColumn ] { #category : 'sorting' } -StFBAbstractColumn class >> priority [ +StFileBrowserAbstractColumn class >> priority [ ^ self subclassResponsibility ] { #category : 'class' } -StFBAbstractColumn class >> tableColumnClass [ +StFileBrowserAbstractColumn class >> tableColumnClass [ ^ SpStringTableColumn ] { #category : 'templateMethod' } -StFBAbstractColumn class >> title [ +StFileBrowserAbstractColumn class >> title [ "I'm returning a String" ^ self subclassResponsibility ] diff --git a/src/NewTools-FileBrowser/StFBAbstractFilter.class.st b/src/NewTools-FileBrowser/StFileBrowserAbstractFilter.class.st similarity index 72% rename from src/NewTools-FileBrowser/StFBAbstractFilter.class.st rename to src/NewTools-FileBrowser/StFileBrowserAbstractFilter.class.st index 18bae7074..bc6545d1d 100644 --- a/src/NewTools-FileBrowser/StFBAbstractFilter.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserAbstractFilter.class.st @@ -11,7 +11,7 @@ Public API and Key Messages " Class { - #name : 'StFBAbstractFilter', + #name : 'StFileBrowserAbstractFilter', #superclass : 'Object', #traits : 'TComparable', #classTraits : 'TComparable classTrait', @@ -21,19 +21,19 @@ Class { } { #category : 'testing' } -StFBAbstractFilter class >> canBeDefault [ +StFileBrowserAbstractFilter class >> canBeDefault [ ^ self isAbstract not ] { #category : 'actions' } -StFBAbstractFilter class >> defaultFilters [ +StFileBrowserAbstractFilter class >> defaultFilters [ ^ ((self allSubclasses select: #canBeDefault) sorted: #priority descending) collect: #new ] { #category : 'actions' } -StFBAbstractFilter class >> defaultFiltersWith: aFilter [ +StFileBrowserAbstractFilter class >> defaultFiltersWith: aFilter [ | defaultFilters | defaultFilters := self defaultFilters. @@ -42,17 +42,17 @@ StFBAbstractFilter class >> defaultFiltersWith: aFilter [ ] { #category : 'testing' } -StFBAbstractFilter class >> isAbstract [ - ^ self = StFBAbstractFilter +StFileBrowserAbstractFilter class >> isAbstract [ + ^ self = StFileBrowserAbstractFilter ] { #category : 'accessing' } -StFBAbstractFilter class >> priority [ +StFileBrowserAbstractFilter class >> priority [ ^ 1 ] { #category : 'comparing' } -StFBAbstractFilter >> < aComparable [ +StFileBrowserAbstractFilter >> < aComparable [ "Answer whether the receiver is less than the argument." @@ -60,7 +60,7 @@ StFBAbstractFilter >> < aComparable [ ] { #category : 'comparing' } -StFBAbstractFilter >> = aComparable [ +StFileBrowserAbstractFilter >> = aComparable [ "Double dispatch" @@ -68,18 +68,18 @@ StFBAbstractFilter >> = aComparable [ ] { #category : 'adding' } -StFBAbstractFilter >> addExtensionTo: aFileReference [ +StFileBrowserAbstractFilter >> addExtensionTo: aFileReference [ ^ aFileReference ] { #category : 'applying' } -StFBAbstractFilter >> applyOn: aCollectionOfFileReference [ +StFileBrowserAbstractFilter >> applyOn: aCollectionOfFileReference [ ^ aCollectionOfFileReference select: [ :eachFileReference | self predicate: eachFileReference ] ] { #category : 'comparing' } -StFBAbstractFilter >> equalsToExtensionFilter: aExtensionFilter [ +StFileBrowserAbstractFilter >> equalsToExtensionFilter: aExtensionFilter [ "Compare the receiver with the argument and answer with true if the receiver is equal to the argument. Otherwise answer false." @@ -88,7 +88,7 @@ StFBAbstractFilter >> equalsToExtensionFilter: aExtensionFilter [ ] { #category : 'comparing' } -StFBAbstractFilter >> equalsToNonExtensionFilter: aFilter [ +StFileBrowserAbstractFilter >> equalsToNonExtensionFilter: aFilter [ "Compare the receiver with the argument and answer with true if the receiver is equal to the argument. Otherwise answer false." @@ -97,7 +97,7 @@ StFBAbstractFilter >> equalsToNonExtensionFilter: aFilter [ ] { #category : 'comparing' } -StFBAbstractFilter >> hash [ +StFileBrowserAbstractFilter >> hash [ "Hash must be redefined whenever = is redefined." @@ -105,14 +105,14 @@ StFBAbstractFilter >> hash [ ] { #category : 'accessing' } -StFBAbstractFilter >> name [ +StFileBrowserAbstractFilter >> name [ "Name of the filter to display in the UI." ^ self subclassResponsibility ] { #category : 'accessing' } -StFBAbstractFilter >> predicate: aFileReference [ +StFileBrowserAbstractFilter >> predicate: aFileReference [ "I should answer true if the filter should display the file reference as parameter and false if it should filter it." ^ self subclassResponsibility diff --git a/src/NewTools-FileBrowser/StFileBrowserAbstractPresenter.class.st b/src/NewTools-FileBrowser/StFileBrowserAbstractPresenter.class.st new file mode 100644 index 000000000..ecbcfec29 --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserAbstractPresenter.class.st @@ -0,0 +1,216 @@ +Class { + #name : 'StFileBrowserAbstractPresenter', + #superclass : 'StPresenter', + #classTraits : 'TraitedClass', + #instVars : [ + 'bookmarksTreeTable', + 'model' + ], + #classVars : [ + 'Bookmarks', + 'LastVisitedDirectory' + ], + #category : 'NewTools-FileBrowser-UI', + #package : 'NewTools-FileBrowser', + #tag : 'UI' +} + +{ #category : 'accessing' } +StFileBrowserAbstractPresenter class >> defaultDirectory [ + "Answer a with the default directory for opening the file browser and dialogs" + + ^ StFileBrowserSettings defaultDirectory +] + +{ #category : 'class initialization' } +StFileBrowserAbstractPresenter class >> initialize [ + + self initializeBookmarks. +] + +{ #category : 'class initialization' } +StFileBrowserAbstractPresenter class >> initializeBookmarks [ + + Bookmarks := StFileBrowserBookmark defaultBookmarks +] + +{ #category : 'accessing' } +StFileBrowserAbstractPresenter class >> lastVisitedDirectory [ + + (LastVisitedDirectory isNotNil and: [ + [ LastVisitedDirectory exists ] + on: ResolutionRequest + do: [ false ] ]) ifFalse: [ + LastVisitedDirectory := self defaultDirectory ]. + ^ LastVisitedDirectory +] + +{ #category : 'instance creation' } +StFileBrowserAbstractPresenter class >> open [ + + ^ (self on: StFileSystemModel new) open +] + +{ #category : 'adding' } +StFileBrowserAbstractPresenter >> addBookmark: aFileReference [ + + self bookmarks add: (StFileBrowserBookmark + name: aFileReference basename + location: aFileReference + icon: (self iconNamed: #book)). +] + +{ #category : 'accessing - bookmarks' } +StFileBrowserAbstractPresenter >> bookmarks [ + + Bookmarks + ifNil: [ self class initialize ]. + ^ Bookmarks +] + +{ #category : 'accessing - bookmarks' } +StFileBrowserAbstractPresenter >> bookmarks: aCollectionOfFDGroupBookMark [ + + Bookmarks := aCollectionOfFDGroupBookMark asOrderedCollection. + bookmarksTreeTable roots: Bookmarks +] + +{ #category : 'accessing - bookmarks' } +StFileBrowserAbstractPresenter >> bookmarksTreeTable [ + ^ bookmarksTreeTable +] + +{ #category : 'accessing - bookmarks' } +StFileBrowserAbstractPresenter >> bookmarksTreeTableItems: aCollection [ + "Convenience method to set the receiver's bookmarks table items to aCollection" + + bookmarksTreeTable roots: aCollection +] + +{ #category : 'utilities' } +StFileBrowserAbstractPresenter >> createDirectory [ + + self model createDirectory. + self updateFileSystemContents. +] + +{ #category : 'accessing' } +StFileBrowserAbstractPresenter >> currentDirectory [ + "Answer a representing the current working directory" + + ^ self model currentDirectory +] + +{ #category : 'accessing' } +StFileBrowserAbstractPresenter >> currentDirectory: aFileReference [ + + self model currentDirectory: aFileReference. +] + +{ #category : 'defaults' } +StFileBrowserAbstractPresenter >> defaultDirectory [ + "See class side comment" + + ^ self class defaultDirectory. +] + +{ #category : 'accessing - history' } +StFileBrowserAbstractPresenter >> history [ + + ^ self model history +] + +{ #category : 'accessing - history' } +StFileBrowserAbstractPresenter >> history: aConfigurableHistoryIterator [ + + self model history: aConfigurableHistoryIterator. +] + +{ #category : 'initialization' } +StFileBrowserAbstractPresenter >> initialize [ + + super initialize. + (StFileBrowserSettings showAlwaysDefaultBookmarks and: [ self bookmarks isEmpty ]) + ifTrue: [ self class initializeBookmarks ] +] + +{ #category : 'initialization' } +StFileBrowserAbstractPresenter >> initializeBookmarksTreeTable [ + + bookmarksTreeTable := self newTreeTable. + bookmarksTreeTable + hideColumnHeaders; + addColumn: (SpCompositeTableColumn new + addColumn: + (SpImageTableColumn evaluated: [ :each | each icon ]) + beNotExpandable; + addColumn: + (SpStringTableColumn evaluated: [ :groupBookMark | + groupBookMark name ]); + yourself); + roots: self bookmarks; + children: #children; + contextMenuFromCommandsGroup: [ self rootCommandsGroup / 'Menu' ]; + expandRoots +] + +{ #category : 'accessing - history' } +StFileBrowserAbstractPresenter >> initializeHistoryIteratorWith: aDirectory [ + + self history: (ConfigurableHistoryIterator + undo: [ :folder | self history hasPrevious + ifTrue: [ self updateWidgetWithFileReference: self history current ] + ifFalse: [ self inform: 'Nothing to undo' ] ] + redo: [ :folder | self updateWidgetWithFileReference: folder ]). + self history register: aDirectory +] + +{ #category : 'initialization' } +StFileBrowserAbstractPresenter >> initializePresenters [ + + super initializePresenters. + self initializeBookmarksTreeTable +] + +{ #category : 'accessing - history' } +StFileBrowserAbstractPresenter >> lastVisitedDirectory [ + ^ self class lastVisitedDirectory. +] + +{ #category : 'accessing' } +StFileBrowserAbstractPresenter >> model [ + "Answer the receiver's " + + ^ model +] + +{ #category : 'utilities' } +StFileBrowserAbstractPresenter >> openOnLastDirectory [ + "Answer if receiver should open in the last used directory" + + ^ StFileBrowserSettings openOnLastDirectory +] + +{ #category : 'initialization' } +StFileBrowserAbstractPresenter >> resetBookmarks [ + "Reset bookmarks to their defaults" + + self class initializeBookmarks +] + +{ #category : 'accessing - bookmarks' } +StFileBrowserAbstractPresenter >> selectedBookMark [ + ^ bookmarksTreeTable selection selectedItem +] + +{ #category : 'accessing - model' } +StFileBrowserAbstractPresenter >> setModelBeforeInitialization: aStFBFileSystemModel [ + + model := aStFBFileSystemModel +] + +{ #category : 'utilities' } +StFileBrowserAbstractPresenter >> updateFileSystemContents [ + + self owner updateFileSystemContents +] diff --git a/src/NewTools-FileBrowser/StFBAbstractPreviewer.class.st b/src/NewTools-FileBrowser/StFileBrowserAbstractPreviewer.class.st similarity index 68% rename from src/NewTools-FileBrowser/StFBAbstractPreviewer.class.st rename to src/NewTools-FileBrowser/StFileBrowserAbstractPreviewer.class.st index 9ae487e7c..c754aaa6f 100644 --- a/src/NewTools-FileBrowser/StFBAbstractPreviewer.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserAbstractPreviewer.class.st @@ -10,7 +10,7 @@ my subclasses have to define : return a Presenter (son of SpPresenter) " Class { - #name : 'StFBAbstractPreviewer', + #name : 'StFileBrowserAbstractPreviewer', #superclass : 'Object', #category : 'NewTools-FileBrowser-Previewers', #package : 'NewTools-FileBrowser', @@ -18,12 +18,12 @@ Class { } { #category : 'testing' } -StFBAbstractPreviewer class >> isAbstract [ - ^ self = StFBAbstractPreviewer +StFileBrowserAbstractPreviewer class >> isAbstract [ + ^ self = StFileBrowserAbstractPreviewer ] { #category : 'testing' } -StFBAbstractPreviewer >> canBeUsedOn: aFileReference [ +StFileBrowserAbstractPreviewer >> canBeUsedOn: aFileReference [ aFileReference ifNil: [ ^ false ]. aFileReference mimeTypes ifNil: [ ^ false ] ifNotNil: [ :items | @@ -32,18 +32,18 @@ StFBAbstractPreviewer >> canBeUsedOn: aFileReference [ ] { #category : 'testing' } -StFBAbstractPreviewer >> matchingMimeType: aZnMimeType [ +StFileBrowserAbstractPreviewer >> matchingMimeType: aZnMimeType [ "return a Boolean to indicate if element matches" ^ self subclassResponsibility ] { #category : 'templateMethod' } -StFBAbstractPreviewer >> previewActionOn: aFileReference [ +StFileBrowserAbstractPreviewer >> previewActionOn: aFileReference [ ^ self subclassResponsibility ] -{ #category : 'utils' } -StFBAbstractPreviewer >> previewOn: aFileReference [ +{ #category : 'utilities' } +StFileBrowserAbstractPreviewer >> previewOn: aFileReference [ (self canBeUsedOn: aFileReference) ifTrue: [ ^ self previewActionOn: aFileReference ]. ^ SpNullPresenter new diff --git a/src/NewTools-FileBrowser/StFBAddBookmarkCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserAddBookmarkCommand.class.st similarity index 54% rename from src/NewTools-FileBrowser/StFBAddBookmarkCommand.class.st rename to src/NewTools-FileBrowser/StFileBrowserAddBookmarkCommand.class.st index 42f80bc4a..11499eb82 100644 --- a/src/NewTools-FileBrowser/StFBAddBookmarkCommand.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserAddBookmarkCommand.class.st @@ -2,36 +2,36 @@ I'm a command use to add bookmark " Class { - #name : 'StFBAddBookmarkCommand', - #superclass : 'CmCommand', + #name : 'StFileBrowserAddBookmarkCommand', + #superclass : 'StFileBrowserBookmarkCommand', #category : 'NewTools-FileBrowser-Commands', #package : 'NewTools-FileBrowser', #tag : 'Commands' } { #category : 'converting' } -StFBAddBookmarkCommand >> asSpecCommand [ +StFileBrowserAddBookmarkCommand >> asSpecCommand [ ^ super asSpecCommand iconName: #add; yourself ] { #category : 'testing' } -StFBAddBookmarkCommand >> canBeExecuted [ +StFileBrowserAddBookmarkCommand >> canBeExecuted [ ^ self context selectedEntry isDirectory ] { #category : 'executing' } -StFBAddBookmarkCommand >> execute [ +StFileBrowserAddBookmarkCommand >> execute [ | fileReference | + fileReference := self context selectedEntry. - self context owner bookmarks add: (StFBBookmark name: fileReference basename location: fileReference icon: nil). - self flag: #todo. "We can do better here." - self context owner bookmarksTreeTable roots: self context owner bookmarks + self context addBookmark: fileReference. + self context bookmarksTreeTableItems: self context bookmarks ] { #category : 'initialization' } -StFBAddBookmarkCommand >> initialize [ +StFileBrowserAddBookmarkCommand >> initialize [ super initialize. self name: 'Add to bookmarks'; diff --git a/src/NewTools-FileBrowser/StFBBookmark.class.st b/src/NewTools-FileBrowser/StFileBrowserBookmark.class.st similarity index 70% rename from src/NewTools-FileBrowser/StFBBookmark.class.st rename to src/NewTools-FileBrowser/StFileBrowserBookmark.class.st index f2dd759ad..2448725d6 100644 --- a/src/NewTools-FileBrowser/StFBBookmark.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserBookmark.class.st @@ -2,8 +2,8 @@ I represent a bookmark having location, icon, and a name. " Class { - #name : 'StFBBookmark', - #superclass : 'StFBAbstractBookMark', + #name : 'StFileBrowserBookmark', + #superclass : 'StFileBrowserAbstractBookMark', #instVars : [ 'location' ], @@ -13,30 +13,29 @@ Class { } { #category : 'defaultClassVariable' } -StFBBookmark class >> defaultBookmarks [ +StFileBrowserBookmark class >> defaultBookmarks [ | presets | + presets := (Smalltalk os isWindows ifTrue: [ self windowsDrives ] ifFalse: [ { self root } ]) asOrderedCollection. - self flag: - 'desktop disabled until https://github.com/pharo-project/pharo/issues/9682 is fixed'. presets addAll: { self home. self workingDirectory. - "self desktop." + self desktop. self documents. self downloads }. ^ OrderedCollection with: - (StFBGroupBookmark + (StFileBrowserGroupBookmark name: 'Favourites' collection: presets - iconName: '') + iconName: #book) ] { #category : 'default bookmarks' } -StFBBookmark class >> desktop [ +StFileBrowserBookmark class >> desktop [ ^ self name: 'Desktop' location: FileLocator desktop @@ -44,7 +43,7 @@ StFBBookmark class >> desktop [ ] { #category : 'default bookmarks' } -StFBBookmark class >> documents [ +StFileBrowserBookmark class >> documents [ ^ self name: 'Documents' location: FileLocator documents @@ -52,7 +51,7 @@ StFBBookmark class >> documents [ ] { #category : 'default bookmarks' } -StFBBookmark class >> downloads [ +StFileBrowserBookmark class >> downloads [ ^ self name: 'Downloads' location: FileLocator downloads @@ -60,7 +59,7 @@ StFBBookmark class >> downloads [ ] { #category : 'default bookmarks' } -StFBBookmark class >> home [ +StFileBrowserBookmark class >> home [ ^ self name: 'Home' location: FileLocator home @@ -68,7 +67,7 @@ StFBBookmark class >> home [ ] { #category : 'default bookmarks' } -StFBBookmark class >> image [ +StFileBrowserBookmark class >> image [ ^ self name: 'Image directory' location: FileLocator imageDirectory @@ -76,7 +75,7 @@ StFBBookmark class >> image [ ] { #category : 'instance creation' } -StFBBookmark class >> name: aName location: aLocation icon: anIcon [ +StFileBrowserBookmark class >> name: aName location: aLocation icon: anIcon [ ^ self new name: aName; location: aLocation; @@ -85,7 +84,7 @@ StFBBookmark class >> name: aName location: aLocation icon: anIcon [ ] { #category : 'default bookmarks' } -StFBBookmark class >> root [ +StFileBrowserBookmark class >> root [ ^ self name: '/' @@ -94,25 +93,25 @@ StFBBookmark class >> root [ ] { #category : 'default bookmarks' } -StFBBookmark class >> tmp [ - ^ StFBBookmark +StFileBrowserBookmark class >> tmp [ + ^ StFileBrowserBookmark name: 'tmp' location: FileLocator temp asFileReference - icon: Smalltalk ui icons open + icon: (self iconNamed: #book) ] { #category : 'default bookmarks' } -StFBBookmark class >> windowsDrives [ +StFileBrowserBookmark class >> windowsDrives [ ^ FileLocator root asFileReference directories collect: [ :each | self name: each basename location: each - icon: Smalltalk ui icons smallWindow ] + icon: (self iconNamed: #smallWindow) ] ] { #category : 'default bookmarks' } -StFBBookmark class >> workingDirectory [ +StFileBrowserBookmark class >> workingDirectory [ ^ self name: 'Working directory' location: FileLocator workingDirectory @@ -120,7 +119,7 @@ StFBBookmark class >> workingDirectory [ ] { #category : 'comparing' } -StFBBookmark >> = aBookmark [ +StFileBrowserBookmark >> = aBookmark [ self species = aBookmark species ifFalse: [ ^ false ]. ^ self icon = aBookmark icon & (self location = aBookmark location) @@ -128,52 +127,42 @@ StFBBookmark >> = aBookmark [ ] { #category : 'accessing' } -StFBBookmark >> children [ +StFileBrowserBookmark >> children [ ^ { } ] { #category : 'comparing' } -StFBBookmark >> hash [ +StFileBrowserBookmark >> hash [ ^ (self icon hash bitXor: self location hash) bitXor: self name hash ] { #category : 'accessing' } -StFBBookmark >> icon [ - ^ icon -] - -{ #category : 'accessing' } -StFBBookmark >> icon: anIcon [ +StFileBrowserBookmark >> icon: anIcon [ icon := anIcon ] { #category : 'testing' } -StFBBookmark >> isComposite [ +StFileBrowserBookmark >> isComposite [ ^ false ] { #category : 'accessing' } -StFBBookmark >> location [ +StFileBrowserBookmark >> location [ ^ location ] { #category : 'accessing' } -StFBBookmark >> location: aFileReference [ +StFileBrowserBookmark >> location: aFileReference [ location := aFileReference ] { #category : 'accessing' } -StFBBookmark >> name [ - ^ name -] - -{ #category : 'accessing' } -StFBBookmark >> name: aString [ +StFileBrowserBookmark >> name: aString [ name := aString ] { #category : 'printing' } -StFBBookmark >> printOn: aStream [ +StFileBrowserBookmark >> printOn: aStream [ super printOn: aStream. aStream << '('''; diff --git a/src/NewTools-FileBrowser/StFileBrowserBookmarkCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserBookmarkCommand.class.st new file mode 100644 index 000000000..33b801cfd --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserBookmarkCommand.class.st @@ -0,0 +1,17 @@ +" +Abstract class to group behavior related with the file browser bookmarks. + +" +Class { + #name : 'StFileBrowserBookmarkCommand', + #superclass : 'StFileBrowserCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'accessing' } +StFileBrowserBookmarkCommand >> bookmarksTreeTable [ + + ^ self context bookmarksTreeTable +] diff --git a/src/NewTools-FileBrowser/StFileBrowserChangeListCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserChangeListCommand.class.st new file mode 100644 index 000000000..bf12cee5b --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserChangeListCommand.class.st @@ -0,0 +1,43 @@ +" +Implements an action to file in the selected file (representing a Pharo source code) into the current system +" +Class { + #name : 'StFileBrowserChangeListCommand', + #superclass : 'StFileBrowserSelectionCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'converting' } +StFileBrowserChangeListCommand >> asSpecCommand [ + + ^ super asSpecCommand + iconName: #changeSorter; + shortcutKey: $b meta; + beHiddenWhenCantBeRun; + yourself +] + +{ #category : 'testing' } +StFileBrowserChangeListCommand >> canBeExecuted [ + + ^ self selectedEntry isFile and: [ self selectedEntryBasename endsWith: '.st' ] +] + +{ #category : 'executing' } +StFileBrowserChangeListCommand >> execute [ + "Execute the actions that should be done by the command. + This method expect that the context has been put in #context inst. var. if any context is relevant." + + self application tools changeList openOnStream: self selectedEntry asFileReference readStream +] + +{ #category : 'initialization' } +StFileBrowserChangeListCommand >> initialize [ + + super initialize. + self + name: 'Changes Browser'; + description: 'Open a Changes Browser on the selected entry' +] diff --git a/src/NewTools-FileBrowser/StFileBrowserCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserCommand.class.st new file mode 100644 index 000000000..10d25ef2f --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserCommand.class.st @@ -0,0 +1,13 @@ +Class { + #name : 'StFileBrowserCommand', + #superclass : 'CmCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'accessing' } +StFileBrowserCommand >> iconProvider [ + + ^ StFileBrowserIconCache +] diff --git a/src/NewTools-FileBrowser/StFileBrowserCompressCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserCompressCommand.class.st new file mode 100644 index 000000000..9582d4b46 --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserCompressCommand.class.st @@ -0,0 +1,51 @@ +" +Provides a command to compress the selected entry in the File Browser tool. + +" +Class { + #name : 'StFileBrowserCompressCommand', + #superclass : 'StFileBrowserSelectionCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'converting' } +StFileBrowserCompressCommand >> asSpecCommand [ + + ^ super asSpecCommand + iconName: #smallForward; + shortcutKey: $z meta; + yourself +] + +{ #category : 'executing' } +StFileBrowserCompressCommand >> compressorExtension [ + + ^ '.zip' +] + +{ #category : 'executing' } +StFileBrowserCompressCommand >> execute [ + "Execute the actions that should be done by the command. + This method expect that the context has been put in #context inst. var. if any context is relevant." + + | zip newZipName | + + (newZipName := self selectedEntry withoutExtension basename , self compressorExtension) asFileReference exists + ifTrue: [ self error: 'Compressed file already exists' ]. + zip := ZipArchive new. + zip addFile: self selectedEntry. + zip writeToFile: self selectedEntry parent / newZipName. + zip close. + self updateFileSystemContents +] + +{ #category : 'initialization' } +StFileBrowserCompressCommand >> initialize [ + + super initialize. + self + name: 'Compress'; + description: 'Compresss the selected file' +] diff --git a/src/NewTools-FileBrowser/StFBContentPreviewer.class.st b/src/NewTools-FileBrowser/StFileBrowserContentPreviewer.class.st similarity index 69% rename from src/NewTools-FileBrowser/StFBContentPreviewer.class.st rename to src/NewTools-FileBrowser/StFileBrowserContentPreviewer.class.st index 933940ea0..6e563845c 100644 --- a/src/NewTools-FileBrowser/StFBContentPreviewer.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserContentPreviewer.class.st @@ -2,26 +2,26 @@ I'm a previewer use to display the text content of a file " Class { - #name : 'StFBContentPreviewer', - #superclass : 'StFBAbstractPreviewer', + #name : 'StFileBrowserContentPreviewer', + #superclass : 'StFileBrowserAbstractPreviewer', #category : 'NewTools-FileBrowser-Previewers', #package : 'NewTools-FileBrowser', #tag : 'Previewers' } { #category : 'testing' } -StFBContentPreviewer >> canBeUsedOn: aFileReference [ +StFileBrowserContentPreviewer >> canBeUsedOn: aFileReference [ ^ aFileReference isFile ] { #category : 'testing' } -StFBContentPreviewer >> matchingMimeType: aZnMimeType [ +StFileBrowserContentPreviewer >> matchingMimeType: aZnMimeType [ "return a Boolean to indicate if element matches" ^ true ] { #category : 'templateMethod' } -StFBContentPreviewer >> previewActionOn: aFileReference [ +StFileBrowserContentPreviewer >> previewActionOn: aFileReference [ ^ SpTextPresenter new text: ([ aFileReference readStreamDo: [ :s | diff --git a/src/NewTools-FileBrowser/StFileBrowserCopyBasenameCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserCopyBasenameCommand.class.st new file mode 100644 index 000000000..943c67cf3 --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserCopyBasenameCommand.class.st @@ -0,0 +1,33 @@ +Class { + #name : 'StFileBrowserCopyBasenameCommand', + #superclass : 'StFileBrowserSelectionCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'converting' } +StFileBrowserCopyBasenameCommand >> asSpecCommand [ + + ^ super asSpecCommand + iconName: #smallCopy; + shortcutKey: $c meta; + yourself +] + +{ #category : 'executing' } +StFileBrowserCopyBasenameCommand >> execute [ + "Execute the actions that should be done by the command. + This method expect that the context has been put in #context inst. var. if any context is relevant." + + Clipboard clipboardText: self selectedEntry basename +] + +{ #category : 'initialization' } +StFileBrowserCopyBasenameCommand >> initialize [ + + super initialize. + self + name: 'Copy name'; + description: 'Copy the selected file name' +] diff --git a/src/NewTools-FileBrowser/StFileBrowserCopyFullnameCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserCopyFullnameCommand.class.st new file mode 100644 index 000000000..4bc8aba8e --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserCopyFullnameCommand.class.st @@ -0,0 +1,33 @@ +Class { + #name : 'StFileBrowserCopyFullnameCommand', + #superclass : 'StFileBrowserSelectionCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'converting' } +StFileBrowserCopyFullnameCommand >> asSpecCommand [ + + ^ super asSpecCommand + iconName: #smallCopy; + shortcutKey: $f meta; + yourself +] + +{ #category : 'executing' } +StFileBrowserCopyFullnameCommand >> execute [ + "Execute the actions that should be done by the command. + This method expect that the context has been put in #context inst. var. if any context is relevant." + + Clipboard clipboardText: self selectedEntry fullName +] + +{ #category : 'initialization' } +StFileBrowserCopyFullnameCommand >> initialize [ + + super initialize. + self + name: 'Copy full path'; + description: 'Copy the selected file full path name' +] diff --git a/src/NewTools-FileBrowser/StFBCreationDateColumn.class.st b/src/NewTools-FileBrowser/StFileBrowserCreationDateColumn.class.st similarity index 55% rename from src/NewTools-FileBrowser/StFBCreationDateColumn.class.st rename to src/NewTools-FileBrowser/StFileBrowserCreationDateColumn.class.st index 1b1580376..3d568b97b 100644 --- a/src/NewTools-FileBrowser/StFBCreationDateColumn.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserCreationDateColumn.class.st @@ -2,29 +2,29 @@ I'm a column use to display the creation date of a file in a File dialog. " Class { - #name : 'StFBCreationDateColumn', - #superclass : 'StFBAbstractColumn', + #name : 'StFileBrowserCreationDateColumn', + #superclass : 'StFileBrowserAbstractColumn', #category : 'NewTools-FileBrowser-Columns', #package : 'NewTools-FileBrowser', #tag : 'Columns' } { #category : 'adding' } -StFBCreationDateColumn class >> addContraintTo: aTableColumn [ +StFileBrowserCreationDateColumn class >> addContraintTo: aTableColumn [ aTableColumn width: 150 ] { #category : 'templateMethod' } -StFBCreationDateColumn class >> evaluateOn: aFileReference [ +StFileBrowserCreationDateColumn class >> evaluateOn: aFileReference [ ^ aFileReference creationTime fileDialogFormat ] { #category : 'sorting' } -StFBCreationDateColumn class >> priority [ +StFileBrowserCreationDateColumn class >> priority [ ^ 60 ] { #category : 'templateMethod' } -StFBCreationDateColumn class >> title [ +StFileBrowserCreationDateColumn class >> title [ ^ 'Date Created' ] diff --git a/src/NewTools-FileBrowser/StFileBrowserFileInCommand.class.st b/src/NewTools-FileBrowser/StFileBrowserFileInCommand.class.st new file mode 100644 index 000000000..57d48b0ae --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserFileInCommand.class.st @@ -0,0 +1,43 @@ +" +Implements an action to file in the selected file (representing a Pharo source code) into the current system +" +Class { + #name : 'StFileBrowserFileInCommand', + #superclass : 'StFileBrowserSelectionCommand', + #category : 'NewTools-FileBrowser-Commands', + #package : 'NewTools-FileBrowser', + #tag : 'Commands' +} + +{ #category : 'converting' } +StFileBrowserFileInCommand >> asSpecCommand [ + + ^ super asSpecCommand + iconName: #up; + shortcutKey: $f meta; + beHiddenWhenCantBeRun; + yourself +] + +{ #category : 'testing' } +StFileBrowserFileInCommand >> canBeExecuted [ + + ^ self selectedEntry isFile and: [ self selectedEntryBasename endsWith: '.st' ] +] + +{ #category : 'executing' } +StFileBrowserFileInCommand >> execute [ + "Execute the actions that should be done by the command. + This method expect that the context has been put in #context inst. var. if any context is relevant." + + self selectedEntry fileIn +] + +{ #category : 'initialization' } +StFileBrowserFileInCommand >> initialize [ + + super initialize. + self + name: 'File in'; + description: 'File in the selected source file' +] diff --git a/src/NewTools-FileBrowser/StFBGroupBookmark.class.st b/src/NewTools-FileBrowser/StFileBrowserGroupBookmark.class.st similarity index 57% rename from src/NewTools-FileBrowser/StFBGroupBookmark.class.st rename to src/NewTools-FileBrowser/StFileBrowserGroupBookmark.class.st index 885ed0b4b..5df3b9303 100644 --- a/src/NewTools-FileBrowser/StFBGroupBookmark.class.st +++ b/src/NewTools-FileBrowser/StFileBrowserGroupBookmark.class.st @@ -2,8 +2,8 @@ i'm use to dispay group of bookmark " Class { - #name : 'StFBGroupBookmark', - #superclass : 'StFBAbstractBookMark', + #name : 'StFileBrowserGroupBookmark', + #superclass : 'StFileBrowserAbstractBookMark', #instVars : [ 'collection' ], @@ -13,7 +13,7 @@ Class { } { #category : 'instance creation' } -StFBGroupBookmark class >> name: aName collection: aCollection iconName: icon [ +StFileBrowserGroupBookmark class >> name: aName collection: aCollection iconName: icon [ ^ self new name: aName; collection: aCollection; @@ -22,26 +22,26 @@ StFBGroupBookmark class >> name: aName collection: aCollection iconName: icon [ ] { #category : 'accessing' } -StFBGroupBookmark >> children [ +StFileBrowserGroupBookmark >> children [ ^ collection ] { #category : 'accessing' } -StFBGroupBookmark >> collection [ +StFileBrowserGroupBookmark >> collection [ ^ collection ] { #category : 'accessing' } -StFBGroupBookmark >> collection: anObject [ +StFileBrowserGroupBookmark >> collection: anObject [ collection := anObject ] { #category : 'testing' } -StFBGroupBookmark >> isComposite [ +StFileBrowserGroupBookmark >> isComposite [ ^ true ] { #category : 'accessing' } -StFBGroupBookmark >> removeAt: anInteger [ +StFileBrowserGroupBookmark >> removeAt: anInteger [ self collection removeAt: anInteger. ] diff --git a/src/NewTools-FileBrowser/StFileBrowserIconCache.class.st b/src/NewTools-FileBrowser/StFileBrowserIconCache.class.st new file mode 100644 index 000000000..b6a753c61 --- /dev/null +++ b/src/NewTools-FileBrowser/StFileBrowserIconCache.class.st @@ -0,0 +1,124 @@ +" +An icon cache +" +Class { + #name : 'StFileBrowserIconCache', + #superclass : 'Object', + #classVars : [ + 'IconCache' + ], + #category : 'NewTools-FileBrowser-Wrappers', + #package : 'NewTools-FileBrowser', + #tag : 'Wrappers' +} + +{ #category : 'icons' } +StFileBrowserIconCache class >> driveIcon [ + + + ^self iconNamed: #driveIcon +] + +{ #category : 'private - icons' } +StFileBrowserIconCache class >> driveIconContents [ + + ^'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA/0lEQVQ4je2RPUoDcRDFf7tI +mjSbE5gUYhoFjSvYSI5i4QFSWHgYIQewELyFX4mF4BfqqmhlSJotdve/8yySbEwhrq34YJjH +K2bem4F//AF4U/IYvdYl9c0UmAwzw0zIZvyL3thsrUYA/myU1wWCkou7U+IDRC9vHQ/av3De +Pjm/3Cki9K9uh3c314GZTWwKyZCETOOOkAAEgqXl5mh7a6O2ADAYfATHR4ckSUKapkVlWYZz +DucceZ4Tr8VUTitIorO3H8zf4Af4LZ/wICQO43m97AC7MHq7Papn1TndA7h/fh9GTw9B8TZZ +kd007kzugEASi/XGaH2lWStr4Ft8AlWZooQwDP14AAAAAElFTkSuQmCC' +] + +{ #category : 'icons' } +StFileBrowserIconCache class >> fileIcon [ + + + ^self iconNamed: #fileIcon +] + +{ #category : 'private - icons' } +StFileBrowserIconCache class >> fileIconContents [ + + ^'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACjElEQVR42o2SW0hUURSG/32O +hnhAqJDCzF6kN0lLGtJCtLQyKIMotRjBy1sqVEZS9mKZBdKFHBJpJEKD0urBvAchhqY5kp6M +HkRlMhpHR2fOHuZybu3KxhEr+/fL3g/rWx9rL4Kl1La+ta0XwiNUTVf9sgJF0yB5FVCfAqt9 +Lnx8yt7Ph4Qc6btVtIigkN+XJ28s9MTeHQLPETipF3aXB7NOJ2wLXnyamYVlwgq/jN5Fj+9Q +X3WhZxXg8ethmpMSzwA666rDxSBOKsHhViBa7XC5ndgWuRH1PSP9XlnJZJDFFYBHXe/p6bQE +IanoGTZECJDhh98jg6gc5ue+oqwkBXlp8TB3WfBiYLx3yuYwiqbS6QDA3DVEjWk7BZ7n8Kc0 +9IzAEBsFm+RG6+BndFsmhsdMxYkBwIO2d7QwI1HIrmgH0XmEMo7MA5qiQ9PZQF0SrDNOpBq2 +YPPWcLT0i+KYqTQuALjzvJeePZr8V4Nf0fHF4cD49DzKHnaKo7Uly4Cqpg568WS6kH21GxpR +EIZQEKKxEo4ZaXDJfrgWJBwwxGBPfDTONbxigOJlQLm5jVYaD65hAHgUP77ZKY5fbxI/BAPO +m9vpTWOGkH2lExzHIKwrYYcnPNQwnhnpkKjGukciddcm5N9tFkdNJasBaxnouo5J2wKOVTaK +YjDggrmDVhvThVOX2S9wPOu8tGnk5+zAMRPqk7HfEI2kuEjk32tmvxAEKK1rpTUFh9c00JjB +FDPIYgYrAAW3W2hdcZaQU9GGdWwJOMIFCnRNxY+X5FaxLyEK6ckxOFPzdCUg90YjbbyUK+A/ +Mk89yCyvFwfvBy1SbF6VLWF7TIRPUdV/FRNNh6qowsDHyaG5l9d2fwfyXD4gAGnljAAAAABJ +RU5ErkJggg==' +] + +{ #category : 'icons' } +StFileBrowserIconCache class >> folderIcon [ + + + ^self iconNamed: #folderIcon +] + +{ #category : 'private - icons' } +StFileBrowserIconCache class >> folderIconContents [ + + ^'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABdElEQVR42mNkoBAwwhhdbT7Z +xvqa4b9/fmT+++sT45vXz3+XNB3qfP36/3ag9H+8BvT1xCdkJljN5WD4z8TwGyjwC6gDiDfs +OfgpumhF/Pfv/zfiMoQxNibQua0lfPvv729Z///+w/Dvzx8Gpn8MDOysrAyM//4z7D1x9dOr +D99WiYvyfv737zfDv79ANUD6z68fDMvXn9rIuGBBZ018NH8zw1+gcUCNcJogm5EhrnbyZMZ5 +81prEqOFm4nXCGMzMsTWTpjMOHdOU01StFgzabZDXBBT2zeZcc6suprkGKlmkImkGhJd1z2Z +cdaM6prUGNlmkImkhkNUXcdkxpnTymvSYhSbMRQR4YXIurbJjNOnFtdkxKhiD0QCsRBR3zyZ +cdrkgprMGI1m0myHxEJ4fcNkxikTc2qyY3TJ8AIDQ1h97WRGaysdM011qeh///8w/v8HSmV/ +GP7/+8sA5DOg8EH0fxD/L1z87OW3W+GZieLcSC4AAOV6G9lUA/2gAAAAAElFTkSuQmCC' +] + +{ #category : 'private - accessing' } +StFileBrowserIconCache class >> iconCache [ + + ^ IconCache ifNil: [ IconCache := Dictionary new ] +] + +{ #category : 'accessing' } +StFileBrowserIconCache class >> iconNamed: aSymbol [ + "Returns the icon with the given name" + + | selector | + selector := (aSymbol , 'Contents') asSymbol. + (self class canUnderstand: selector) ifFalse: [ ^super iconNamed: aSymbol ]. + ^ self iconCache + at: aSymbol + ifAbsentPut: [ + Form + fromBinaryStream: (self perform: selector) base64Decoded readStream ] +] + +{ #category : 'initialization-release' } +StFileBrowserIconCache class >> reset [ + "Reset the icon cache" +