--- a/DirectoryContentsBrowser.st Mon Oct 14 17:30:45 2002 +0200
+++ b/DirectoryContentsBrowser.st Mon Oct 14 18:02:37 2002 +0200
@@ -4,7 +4,7 @@
instanceVariableNames:'readDirectoryTask updateDirectoryContentsTask updateColumnsTask
updateFromSensorTask modificationTime directory columnDescriptors
filterBlock iconIndex fileDescriptionIndex iconExtent
- tableColumns sortBlock currentSortOrder previewIndex allItemsList
+ tableColumns currentSortOrder previewIndex allItemsList
currentItemList wantSelectFiles updateToExternFileHolderLock
updateTaskSema inDropMode draggedItem canDropItem viewBrowserMenu
updateContentsSelection selectionInFileList contentsBrowser
@@ -179,7 +179,7 @@
#id: #filename
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'baseName'
#minWidth: 150
#model: #baseName
@@ -192,7 +192,7 @@
#id: #suffix
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'suffix'
#width: 40
#model: #suffix
@@ -206,7 +206,7 @@
#id: #perm
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'permissions'
#width: 75
#model: #permissions
@@ -220,7 +220,7 @@
#id: #owner
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'owner'
#usePreferredWidth: true
#width: 50
@@ -234,7 +234,7 @@
#id: #group
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'group'
#usePreferredWidth: true
#width: 40
@@ -249,7 +249,7 @@
#translateLabel: true
#labelAlignment: #right
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'fileSize'
#columnAlignment: #right
#usePreferredWidth: true
@@ -263,7 +263,7 @@
#id: #time
#labelAlignment: #right
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'modificationTime'
#columnAlignment: #right
#usePreferredWidth: true
@@ -279,7 +279,7 @@
#id: #fileInfo
#labelAlignment: #left
#labelButtonType: #Button
- #labelActionSelector: #sortList:
+ #labelActionSelector: #sortFileListsBy:
#labelActionArgument: 'fileType'
#width: 250
#model: #fileInfoString
@@ -302,7 +302,6 @@
#showColSeparator: false
)
)
-
!
windowSpec
@@ -835,42 +834,6 @@
filterBlock := something.
!
-makeDirectorySortBlockFor:aSortBlock
- self viewDirectoriesInDirectoryContentsBrowser value ifTrue:[
- ^ [:a :b|
- |aIsDir bIsDir res|
-
- aIsDir := a isDirectory.
- bIsDir := b isDirectory.
- (aIsDir ~~ bIsDir) ifTrue:[
- res := aIsDir
- ] ifFalse:[
- res := aSortBlock value:a value:b.
- ].
- res
- ].
- ].
- ^ aSortBlock
-!
-
-sortBlock
- |nameSortBlock|
-
- nameSortBlock := sortBlock.
- nameSortBlock isNil ifTrue:[
- self sortCaseless ifTrue:[
- nameSortBlock := [ :a :b | a asString asLowercase < b asString asLowercase.].
- ] ifFalse:[
- nameSortBlock := [ :a :b | a asString < b asString.].
- ].
- ].
- ^ self makeDirectorySortBlockFor:nameSortBlock
-!
-
-sortBlock:aSortBlock
- sortBlock := aSortBlock.
-!
-
updateColumnsTask
"return the value of the instance variable 'updateColumnsTask' (automatically generated)"
@@ -1075,6 +1038,7 @@
self directory isNil ifTrue:[^ self].
selection := self selectedFiles.
+ selection remove:('..' asFilename) ifAbsent:[nil].
selection isEmpty ifTrue:[
self currentFileNameHolder value:(OrderedCollection with:self directory) withoutNotifying:self.
] ifFalse:[
@@ -1129,13 +1093,9 @@
^ self.
].
aModel == self sortBlockHolder ifTrue:[
- self sortList:(self sortBlockHolder value) withReverse:false.
+ self evaluateSortBlock.
^ self.
].
- aModel == self sortCaseless ifTrue:[
- self sortList:#baseName withReverse:false.
- ^ self
- ].
aModel == self viewDirectoriesInDirectoryContentsBrowser ifTrue:[
self evaluateFilter.
^ self
@@ -1240,7 +1200,7 @@
| newList|
newList := currentItemList.
- newList sort:self sortBlock.
+ newList sort:self sortBlockHolder value.
self descriptions:newList asList.
!
@@ -1653,48 +1613,6 @@
^ self selectionInFileList value.
! !
-!DirectoryContentsBrowser methodsFor:'sorting'!
-
-sortListChangedWith:currentSortOrder and:instanceName
-
- | aSymbol cmpOp sortCaselessLocal|
-
- aSymbol := instanceName asSymbol.
- sortCaselessLocal := self sortCaseless value.
- (currentSortOrder at:#reverse) ifTrue:[
- cmpOp := #'>'
- ] ifFalse:[
- cmpOp := #'<'
- ].
- self sortBlock: [:a :b |
- |entry1 entry2|
-
- entry1 := (a perform:aSymbol).
- entry2 := (b perform:aSymbol).
- ((entry1 isNil) or:[entry2 isNil]) ifTrue:[
- ((entry1 isNil) and:[entry2 isNil]) ifTrue:[true] ifFalse:[
- ((entry1 notNil) and:[entry2 isNil]) ifTrue:[
- (currentSortOrder at:#reverse)
- ].
- (currentSortOrder at:#reverse) not
- ]
- ] ifFalse:[
- (aSymbol = #baseName) ifTrue:[
- sortCaselessLocal ifTrue:[
- entry1 := entry1 asString asLowercase.
- entry2 := entry2 asString asLowercase.
- ] ifFalse:[
- entry1 := entry1 asString.
- entry2 := entry2 asString.
- ].
- ].
- entry1 perform:cmpOp with:entry2
- ]
- ].
- self sortBlockHolder value:instanceName.
- self evaluateSortBlock.
-! !
-
!DirectoryContentsBrowser methodsFor:'startup / release'!
makeDependent
@@ -1703,7 +1621,7 @@
self viewDirectoriesInDirectoryContentsBrowser addDependent:self.
self filterModel addDependent:self.
self sortBlockHolder addDependent:self.
- self sortCaseless addDependent:self.
+ self sortBlockProperty addDependent:self.
self viewDescription onChangeSend:#viewedColumnsChanged to:self.
self viewDetails onChangeSend:#viewedColumnsChanged to:self.
self viewGroup onChangeSend:#viewedColumnsChanged to:self.
@@ -2701,5 +2619,5 @@
!DirectoryContentsBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.19 2002-10-14 15:17:50 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.20 2002-10-14 16:02:32 penk Exp $'
! !