author | Claus Gittinger <cg@exept.de> |
Tue, 21 Oct 2003 20:21:29 +0200 | |
changeset 5290 | 8aeb40fef0f7 |
parent 5288 | ded5fff91032 |
child 5312 | 63b275aa2c69 |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3906 | 13 |
"{ Package: 'stx:libtool' }" |
3887 | 14 |
|
4713 | 15 |
AbstractDirectoryBrowser subclass:#DirectoryContentsBrowser |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
16 |
instanceVariableNames:'modificationTime directory columnDescriptors iconIndex |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
17 |
fileDescriptionIndex iconExtent tableColumns previewIndex |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
18 |
draggedItem viewBrowserMenu updateContentsSelection |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
19 |
selectionInFileList browserItemList matchBlock updateTask |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
20 |
directoryChangeFlag directoryContentsChangeFlag filterChangeFlag |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
21 |
sortBlockChangeFlag isBusy changeSema filteredItems allItems |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
22 |
diskUsageInfo diskUsageUpdateProcess' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
23 |
classVariableNames:'' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
24 |
poolDictionaries:'' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
25 |
category:'Interface-Tools-File' |
3887 | 26 |
! |
27 |
||
28 |
Object subclass:#DirectoryContentsItem |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
29 |
instanceVariableNames:'fileName fileInfo icon fileType |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
30 |
contentsBrowserChangeModificationTime suffix preview group owner |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
31 |
timeAndDate mimeType iconKey mimeTypeForContents' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
32 |
classVariableNames:'LastUIDToUserNameMapping LastGIDToGroupNameMapping' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
33 |
poolDictionaries:'' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
34 |
privateIn:DirectoryContentsBrowser |
4017 | 35 |
! |
36 |
||
3887 | 37 |
!DirectoryContentsBrowser class methodsFor:'documentation'! |
38 |
||
5140 | 39 |
copyright |
40 |
" |
|
41 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
42 |
All Rights Reserved |
|
43 |
||
44 |
This software is furnished under a license and may be used |
|
45 |
only in accordance with the terms of that license and with the |
|
46 |
inclusion of the above copyright notice. This software may not |
|
47 |
be provided or otherwise made available to, or used by, any |
|
48 |
other person. No title to or ownership of the software is |
|
49 |
hereby transferred. |
|
50 |
" |
|
51 |
! |
|
52 |
||
3887 | 53 |
documentation |
54 |
" |
|
4713 | 55 |
An application for displaying a directories' contents flat (or as a tree, alternatively). |
56 |
To be used as a building block in file browsers and fileSelection dialogs. |
|
57 |
This is used as the top-right component in the new fileBrowser. |
|
58 |
||
59 |
[author:] |
|
60 |
Christian Penk (penk@bierfix) |
|
61 |
||
62 |
[see also:] |
|
63 |
FileBrowserV2 |
|
64 |
" |
|
65 |
! |
|
66 |
||
67 |
examples |
|
68 |
" |
|
69 |
[exBegin] |
|
70 |
DirectoryContentsBrowser openIn:(Filename currentDirectory pathName) |
|
71 |
[exEnd] |
|
3887 | 72 |
" |
73 |
! ! |
|
74 |
||
75 |
!DirectoryContentsBrowser class methodsFor:'instance creation'! |
|
76 |
||
77 |
openIn:aDirectory |
|
78 |
"opens a directory (standalone) for a directory |
|
79 |
" |
|
80 |
self openIn:aDirectory withDirectories:false |
|
81 |
||
82 |
" |
|
83 |
self openIn:(Filename currentDirectory construct:'.cvsignore') |
|
84 |
" |
|
85 |
! |
|
86 |
||
87 |
openIn:aDirectory withDirectories:withDirectoriesBoolean |
|
88 |
"opens a directory (standalone) for a directory |
|
89 |
" |
|
90 |
|browser| |
|
91 |
||
92 |
browser := DirectoryContentsBrowser new. |
|
93 |
browser open. |
|
94 |
aDirectory notNil ifTrue:[ |
|
95 |
browser currentFileNameHolder value:(OrderedCollection with:(aDirectory asFilename)) |
|
96 |
]. |
|
4202 | 97 |
browser viewDirsInContentsBrowser value:withDirectoriesBoolean. |
98 |
^ browser |
|
3887 | 99 |
|
100 |
" |
|
4007 | 101 |
self openIn:(Filename currentDirectory asAbsoluteFilename) withDirectories:true |
3887 | 102 |
" |
103 |
! ! |
|
104 |
||
105 |
!DirectoryContentsBrowser class methodsFor:'classAccess'! |
|
106 |
||
107 |
itemClass |
|
108 |
||
109 |
^ DirectoryContentsItem |
|
110 |
||
111 |
||
112 |
" |
|
113 |
self itemClass |
|
114 |
" |
|
115 |
! ! |
|
116 |
||
117 |
!DirectoryContentsBrowser class methodsFor:'constant'! |
|
118 |
||
4342 | 119 |
debug |
120 |
||
121 |
^ false |
|
122 |
! |
|
123 |
||
124 |
updateTaskCyleTime |
|
125 |
||
126 |
" time for search on changed directories or changed columns in msecs " |
|
127 |
||
4349 | 128 |
^ 4000 |
4342 | 129 |
! |
130 |
||
3887 | 131 |
updateTaskPriority |
132 |
"returns the priority of the update task |
|
133 |
" |
|
134 |
^ 8 |
|
135 |
! ! |
|
136 |
||
3980 | 137 |
!DirectoryContentsBrowser class methodsFor:'image specs'! |
138 |
||
4027 | 139 |
detailsMenuIconDown |
3980 | 140 |
"This resource specification was automatically generated |
141 |
by the ImageEditor of ST/X." |
|
142 |
||
143 |
"Do not manually edit this!! If it is corrupted, |
|
144 |
the ImageEditor may not be able to read the specification." |
|
145 |
||
146 |
" |
|
4027 | 147 |
self detailsMenuIconDown inspect |
148 |
ImageEditor openOnClass:self andSelector:#detailsMenuIconDown |
|
3980 | 149 |
Icon flushCachedIcons |
150 |
" |
|
151 |
||
152 |
<resource: #image> |
|
153 |
||
154 |
^Icon |
|
4027 | 155 |
constantNamed:#'DirectoryContentsBrowser class detailsMenuIconDown' |
156 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 5; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 5; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@A@(UJ(b') ; yourself); yourself] |
|
3980 | 157 |
! |
158 |
||
159 |
detailsMenuIconR |
|
160 |
"This resource specification was automatically generated |
|
161 |
by the ImageEditor of ST/X." |
|
162 |
||
163 |
"Do not manually edit this!! If it is corrupted, |
|
164 |
the ImageEditor may not be able to read the specification." |
|
165 |
||
166 |
" |
|
167 |
self detailsMenuIconR inspect |
|
168 |
ImageEditor openOnClass:self andSelector:#detailsMenuIconR |
|
169 |
Icon flushCachedIcons |
|
170 |
" |
|
171 |
||
172 |
<resource: #image> |
|
173 |
||
174 |
^Icon |
|
175 |
constantNamed:#'DirectoryContentsBrowser class detailsMenuIconR' |
|
176 |
ifAbsentPut:[(Depth1Image new) width: 5; height: 7; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 5; height: 7; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' DB TJA@ @@a') ; yourself); yourself] |
|
4027 | 177 |
! |
178 |
||
179 |
detailsMenuIconUp |
|
3980 | 180 |
"This resource specification was automatically generated |
181 |
by the ImageEditor of ST/X." |
|
182 |
||
183 |
"Do not manually edit this!! If it is corrupted, |
|
184 |
the ImageEditor may not be able to read the specification." |
|
185 |
||
186 |
" |
|
4027 | 187 |
self detailsMenuIconUp inspect |
188 |
ImageEditor openOnClass:self andSelector:#detailsMenuIconUp |
|
3980 | 189 |
Icon flushCachedIcons |
190 |
" |
|
191 |
||
192 |
<resource: #image> |
|
193 |
||
194 |
^Icon |
|
4027 | 195 |
constantNamed:#'DirectoryContentsBrowser class detailsMenuIconUp' |
196 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 5; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 5; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'*%P(D@@b') ; yourself); yourself] |
|
197 |
! ! |
|
198 |
||
199 |
!DirectoryContentsBrowser class methodsFor:'interface specs'! |
|
3980 | 200 |
|
3887 | 201 |
tableColumns |
202 |
"This resource specification was automatically generated |
|
203 |
by the DataSetBuilder of ST/X." |
|
204 |
||
205 |
"Do not manually edit this!! If it is corrupted, |
|
206 |
the DataSetBuilder may not be able to read the specification." |
|
207 |
||
208 |
" |
|
209 |
DataSetBuilder new openOnClass:DirectoryContentsBrowser andSelector:#tableColumns |
|
210 |
" |
|
211 |
||
212 |
<resource: #tableColumns> |
|
213 |
||
214 |
^#( |
|
215 |
#(#DataSetColumnSpec |
|
4027 | 216 |
#label: '' |
3887 | 217 |
#labelButtonType: #Group |
218 |
#width: 22 |
|
219 |
#minWidth: 22 |
|
220 |
#height: 16 |
|
221 |
#model: #icon |
|
222 |
#canSelect: false |
|
223 |
#showRowSeparator: false |
|
224 |
#showColSeparator: false |
|
225 |
) |
|
226 |
#(#DataSetColumnSpec |
|
227 |
#label: 'Filename' |
|
228 |
#labelAlignment: #left |
|
229 |
#labelButtonType: #Button |
|
3989 | 230 |
#labelActionSelector: #sortFileListsBy: |
3887 | 231 |
#labelActionArgument: 'baseName' |
232 |
#minWidth: 150 |
|
233 |
#model: #baseName |
|
234 |
#canSelect: false |
|
235 |
#showRowSeparator: false |
|
236 |
#showColSeparator: false |
|
237 |
) |
|
238 |
#(#DataSetColumnSpec |
|
239 |
#label: 'Suffix' |
|
240 |
#labelAlignment: #left |
|
241 |
#labelButtonType: #Button |
|
3989 | 242 |
#labelActionSelector: #sortFileListsBy: |
3887 | 243 |
#labelActionArgument: 'suffix' |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
244 |
#usePreferredWidth: true |
3887 | 245 |
#width: 40 |
246 |
#model: #suffix |
|
247 |
#canSelect: false |
|
248 |
#isResizeable: false |
|
249 |
#showRowSeparator: false |
|
250 |
#showColSeparator: false |
|
251 |
) |
|
252 |
#(#DataSetColumnSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
253 |
#label: 'Inode' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
254 |
#labelAlignment: #left |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
255 |
#labelButtonType: #Button |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
256 |
#labelActionSelector: #sortFileListsBy: |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
257 |
#labelActionArgument: 'inodeNumber' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
258 |
#usePreferredWidth: true |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
259 |
#width: 75 |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
260 |
#model: #inodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
261 |
#canSelect: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
262 |
#isResizeable: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
263 |
#showRowSeparator: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
264 |
#showColSeparator: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
265 |
) |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
266 |
#(#DataSetColumnSpec |
3887 | 267 |
#label: 'Perm' |
268 |
#labelAlignment: #left |
|
269 |
#labelButtonType: #Button |
|
3989 | 270 |
#labelActionSelector: #sortFileListsBy: |
3887 | 271 |
#labelActionArgument: 'permissions' |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
272 |
#usePreferredWidth: true |
3887 | 273 |
#width: 75 |
274 |
#model: #permissions |
|
275 |
#canSelect: false |
|
276 |
#isResizeable: false |
|
277 |
#showRowSeparator: false |
|
278 |
#showColSeparator: false |
|
279 |
) |
|
280 |
#(#DataSetColumnSpec |
|
281 |
#label: 'Owner' |
|
282 |
#labelAlignment: #left |
|
283 |
#labelButtonType: #Button |
|
3989 | 284 |
#labelActionSelector: #sortFileListsBy: |
3887 | 285 |
#labelActionArgument: 'owner' |
286 |
#usePreferredWidth: true |
|
287 |
#width: 50 |
|
288 |
#model: #owner |
|
289 |
#canSelect: false |
|
290 |
#showRowSeparator: false |
|
291 |
#showColSeparator: false |
|
292 |
) |
|
293 |
#(#DataSetColumnSpec |
|
294 |
#label: 'Group' |
|
295 |
#labelAlignment: #left |
|
296 |
#labelButtonType: #Button |
|
3989 | 297 |
#labelActionSelector: #sortFileListsBy: |
3887 | 298 |
#labelActionArgument: 'group' |
299 |
#usePreferredWidth: true |
|
300 |
#width: 40 |
|
301 |
#model: #group |
|
302 |
#canSelect: false |
|
303 |
#showRowSeparator: false |
|
304 |
#showColSeparator: false |
|
305 |
) |
|
306 |
#(#DataSetColumnSpec |
|
307 |
#label: 'Size' |
|
308 |
#translateLabel: true |
|
309 |
#labelAlignment: #right |
|
310 |
#labelButtonType: #Button |
|
3989 | 311 |
#labelActionSelector: #sortFileListsBy: |
3983 | 312 |
#labelActionArgument: 'fileSize' |
4402
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
313 |
#columnAlignment: #decimal |
3887 | 314 |
#usePreferredWidth: true |
4957 | 315 |
#minWidth: 45 |
3887 | 316 |
#model: #sizeString |
317 |
#canSelect: false |
|
318 |
#showRowSeparator: false |
|
319 |
#showColSeparator: false |
|
320 |
) |
|
321 |
#(#DataSetColumnSpec |
|
4970 | 322 |
#label: 'Bytes' |
323 |
#translateLabel: true |
|
324 |
#labelAlignment: #right |
|
325 |
#labelButtonType: #Button |
|
326 |
#labelActionSelector: #sortFileListsBy: |
|
327 |
#labelActionArgument: 'fileSize' |
|
328 |
#columnAlignment: #right |
|
329 |
#usePreferredWidth: true |
|
330 |
#minWidth: 45 |
|
331 |
#model: #sizeInBytesString |
|
332 |
#canSelect: false |
|
333 |
#showRowSeparator: false |
|
334 |
#showColSeparator: false |
|
335 |
) |
|
336 |
#(#DataSetColumnSpec |
|
3887 | 337 |
#label: 'Date & Time' |
338 |
#labelAlignment: #right |
|
339 |
#labelButtonType: #Button |
|
3989 | 340 |
#labelActionSelector: #sortFileListsBy: |
3887 | 341 |
#labelActionArgument: 'modificationTime' |
342 |
#columnAlignment: #right |
|
343 |
#usePreferredWidth: true |
|
344 |
#width: 140 |
|
345 |
#model: #timeAndDate |
|
346 |
#writeSelector: #date: |
|
347 |
#canSelect: false |
|
348 |
#showRowSeparator: false |
|
349 |
#showColSeparator: false |
|
350 |
) |
|
351 |
#(#DataSetColumnSpec |
|
352 |
#label: 'File Info' |
|
353 |
#labelAlignment: #left |
|
354 |
#labelButtonType: #Button |
|
3989 | 355 |
#labelActionSelector: #sortFileListsBy: |
3887 | 356 |
#labelActionArgument: 'fileType' |
357 |
#width: 250 |
|
358 |
#model: #fileInfoString |
|
359 |
#canSelect: false |
|
360 |
#showRowSeparator: false |
|
361 |
#showColSeparator: false |
|
362 |
) |
|
363 |
#(#DataSetColumnSpec |
|
364 |
#label: 'Pre +/-' |
|
365 |
#labelButtonType: #Button |
|
366 |
#labelActionSelector: #doResizeImage |
|
367 |
#labelActionArgument: '' |
|
368 |
#columnAlignment: #center |
|
369 |
#width: 45 |
|
370 |
#height: 16 |
|
371 |
#model: #preview |
|
372 |
#canSelect: false |
|
373 |
#showRowSeparator: false |
|
374 |
#showColSeparator: false |
|
375 |
) |
|
376 |
) |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
377 |
|
3887 | 378 |
! |
379 |
||
380 |
windowSpec |
|
381 |
"This resource specification was automatically generated |
|
382 |
by the UIPainter of ST/X." |
|
383 |
||
384 |
"Do not manually edit this!! If it is corrupted, |
|
385 |
the UIPainter may not be able to read the specification." |
|
386 |
||
387 |
" |
|
388 |
UIPainter new openOnClass:DirectoryContentsBrowser andSelector:#windowSpec |
|
389 |
DirectoryContentsBrowser new openInterface:#windowSpec |
|
390 |
DirectoryContentsBrowser open |
|
391 |
" |
|
392 |
||
393 |
<resource: #canvas> |
|
394 |
||
395 |
^ |
|
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
396 |
#(FullSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
397 |
name: windowSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
398 |
window: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
399 |
(WindowSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
400 |
label: 'Directory ContentsBrowser' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
401 |
name: 'Directory ContentsBrowser' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
402 |
min: (Point 10 10) |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
403 |
bounds: (Rectangle 14 46 602 524) |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
404 |
menu: menu |
3887 | 405 |
) |
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
406 |
component: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
407 |
(SpecCollection |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
408 |
collection: ( |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
409 |
(DataSetSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
410 |
name: 'browser' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
411 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
412 |
model: selectionInFileList |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
413 |
menu: directoryContentsBrowserMenu |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
414 |
hasHorizontalScrollBar: true |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
415 |
hasVerticalScrollBar: true |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
416 |
miniScrollerHorizontal: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
417 |
miniScrollerVertical: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
418 |
dataList: browserItemList |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
419 |
useIndex: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
420 |
has3Dsepartors: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
421 |
doubleClickSelector: doubleClickedAt: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
422 |
columnHolder: tableColumns |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
423 |
multipleSelectOk: true |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
424 |
verticalSpacing: 0 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
425 |
columns: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
426 |
(OrderedCollection |
3887 | 427 |
|
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
428 |
(DataSetColumnSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
429 |
labelButtonType: Group |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
430 |
width: 22 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
431 |
minWidth: 22 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
432 |
height: 16 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
433 |
model: icon |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
434 |
canSelect: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
435 |
showRowSeparator: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
436 |
showColSeparator: false |
3887 | 437 |
) |
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
438 |
(DataSetColumnSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
439 |
label: 'file name' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
440 |
labelAlignment: left |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
441 |
labelButtonType: Button |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
442 |
model: baseName |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
443 |
canSelect: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
444 |
showRowSeparator: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
445 |
showColSeparator: false |
3887 | 446 |
) |
447 |
||
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
448 |
(DataSetColumnSpec |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
449 |
label: '+/-' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
450 |
labelButtonType: Button |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
451 |
labelActionSelector: doResizeImage |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
452 |
labelActionArgument: '' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
453 |
columnAlignment: center |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
454 |
width: 30 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
455 |
height: 16 |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
456 |
model: preview |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
457 |
canSelect: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
458 |
showRowSeparator: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
459 |
showSelectionHighLighted: false |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
460 |
showColSeparator: false |
3887 | 461 |
) |
462 |
) |
|
5152
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
463 |
viewClassName: 'DirectoryContentsBrowser::Widget' |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
464 |
postBuildCallback: postBuildBrowser: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
465 |
properties: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
466 |
(PropertyListDictionary |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
467 |
overSelector: dropOver: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
468 |
dragArgument: contentsbrowser |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
469 |
startDragSelector: doStartDrag:in: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
470 |
displayObjectSelector: getDisplayObjects: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
471 |
dropObjectSelector: getDropObjects: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
472 |
dropArgument: browser |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
473 |
canDropSelector: canDrop: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
474 |
leaveSelector: dropLeave: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
475 |
enterSelector: dropEnter: |
6c6716dd6642
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
5140
diff
changeset
|
476 |
dropSelector: doDrop: |
3887 | 477 |
) |
478 |
) |
|
479 |
) |
|
480 |
||
481 |
) |
|
482 |
) |
|
483 |
! ! |
|
484 |
||
485 |
!DirectoryContentsBrowser class methodsFor:'menu specs'! |
|
486 |
||
487 |
directoryContentsBrowserMenu |
|
488 |
"This resource specification was automatically generated |
|
489 |
by the MenuEditor of ST/X." |
|
490 |
||
491 |
"Do not manually edit this!! If it is corrupted, |
|
492 |
the MenuEditor may not be able to read the specification." |
|
493 |
||
494 |
" |
|
495 |
MenuEditor new openOnClass:DirectoryContentsBrowser andSelector:#directoryContentsBrowserMenu |
|
496 |
(Menu new fromLiteralArrayEncoding:(DirectoryContentsBrowser directoryContentsBrowserMenu)) startUp |
|
497 |
" |
|
498 |
||
499 |
<resource: #menu> |
|
500 |
||
501 |
^ |
|
502 |
#(#Menu |
|
503 |
#( |
|
504 |
#(#MenuItem |
|
4615
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
505 |
#label: 'Cut' |
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
506 |
#itemValue: #doCut |
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
507 |
#translateLabel: true |
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
508 |
#shortcutKey: #Cut |
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
509 |
) |
cc32f33b6b60
cut-copy-paste is the correct order
Claus Gittinger <cg@exept.de>
parents:
4611
diff
changeset
|
510 |
#(#MenuItem |
3887 | 511 |
#label: 'Copy' |
4376 | 512 |
#itemValue: #doCopy |
3887 | 513 |
#translateLabel: true |
4376 | 514 |
#shortcutKey: #Copy |
3887 | 515 |
) |
516 |
#(#MenuItem |
|
4376 | 517 |
#enabled: #canPaste |
3887 | 518 |
#label: 'Paste' |
4376 | 519 |
#itemValue: #pasteFiles |
3887 | 520 |
#translateLabel: true |
4376 | 521 |
#shortcutKey: #Paste |
3887 | 522 |
) |
523 |
#(#MenuItem |
|
524 |
#label: 'Delete' |
|
4376 | 525 |
#itemValue: #doDelete |
3887 | 526 |
#nameKey: #delete |
527 |
#translateLabel: true |
|
4376 | 528 |
#shortcutKey: #Delete |
3887 | 529 |
) |
530 |
#(#MenuItem |
|
531 |
#label: '-' |
|
532 |
) |
|
533 |
#(#MenuItem |
|
4534 | 534 |
#label: 'New' |
535 |
#translateLabel: true |
|
536 |
#submenuChannel: #newMenu |
|
537 |
) |
|
538 |
#(#MenuItem |
|
539 |
#label: '-' |
|
540 |
) |
|
541 |
#(#MenuItem |
|
4376 | 542 |
#enabled: #hasSelection |
543 |
#label: 'Rename...' |
|
544 |
#itemValue: #renameSelection |
|
3887 | 545 |
#translateLabel: true |
4376 | 546 |
#shortcutKey: #Replace |
3887 | 547 |
) |
548 |
#(#MenuItem |
|
4376 | 549 |
#enabled: #hasSelection |
550 |
#label: 'Properties...' |
|
551 |
#itemValue: #doShowProperties |
|
3887 | 552 |
#translateLabel: true |
4376 | 553 |
) |
554 |
#(#MenuItem |
|
555 |
#label: '-' |
|
556 |
) |
|
557 |
#(#MenuItem |
|
4931 | 558 |
#label: 'Operations' |
559 |
#translateLabel: true |
|
560 |
#submenuChannel: #fileOpMenu |
|
561 |
) |
|
562 |
#(#MenuItem |
|
4376 | 563 |
#enabled: #hasSelection |
4533 | 564 |
#label: 'Edit' |
565 |
#itemValue: #doShowFileContents |
|
566 |
#translateLabel: true |
|
567 |
) |
|
568 |
#(#MenuItem |
|
569 |
#enabled: #hasSelection |
|
4376 | 570 |
#label: 'File In' |
571 |
#itemValue: #fileFileIn |
|
572 |
#translateLabel: true |
|
573 |
#shortcutKey: #Accept |
|
3887 | 574 |
) |
575 |
#(#MenuItem |
|
576 |
#label: '-' |
|
577 |
) |
|
578 |
#(#MenuItem |
|
4376 | 579 |
#label: 'More' |
3887 | 580 |
#translateLabel: true |
3907 | 581 |
#submenu: |
582 |
#(#Menu |
|
583 |
#( |
|
584 |
#(#MenuItem |
|
4477 | 585 |
#label: 'Select All' |
586 |
#itemValue: #selectAll |
|
587 |
#translateLabel: true |
|
588 |
) |
|
589 |
#(#MenuItem |
|
590 |
#label: '-' |
|
591 |
) |
|
592 |
#(#MenuItem |
|
593 |
#enabled: #fileListIsNotEmpty |
|
594 |
#label: 'Copy Filenames' |
|
595 |
#itemValue: #copyFileList |
|
3907 | 596 |
#translateLabel: true |
597 |
) |
|
598 |
#(#MenuItem |
|
3980 | 599 |
#label: '-' |
3907 | 600 |
) |
601 |
#(#MenuItem |
|
4619 | 602 |
#enabled: #hasFileSelection |
4477 | 603 |
#label: 'File InTo Namespace...' |
604 |
#itemValue: #fileFileInToNameSpace |
|
3907 | 605 |
#translateLabel: true |
606 |
) |
|
607 |
#(#MenuItem |
|
3980 | 608 |
#label: '-' |
609 |
) |
|
610 |
#(#MenuItem |
|
4415 | 611 |
#enabled: #hasTwoFilesSelected |
4748 | 612 |
#label: 'Compare with Each Other' |
4415 | 613 |
#itemValue: #doCompareTwoFiles |
614 |
#translateLabel: true |
|
615 |
) |
|
4376 | 616 |
) |
617 |
nil |
|
618 |
nil |
|
619 |
) |
|
620 |
) |
|
621 |
#(#MenuItem |
|
4850 | 622 |
#label: 'Tools' |
623 |
#translateLabel: true |
|
624 |
#submenuChannel: #toolsMenuSpec |
|
625 |
) |
|
626 |
#(#MenuItem |
|
4376 | 627 |
#label: '-' |
628 |
) |
|
629 |
#(#MenuItem |
|
630 |
#label: 'View' |
|
631 |
#translateLabel: true |
|
632 |
#submenu: |
|
633 |
#(#Menu |
|
634 |
#( |
|
635 |
#(#MenuItem |
|
636 |
#label: 'Details' |
|
637 |
#nameKey: #View |
|
638 |
#translateLabel: true |
|
639 |
#submenuChannel: #viewBrowserMenu |
|
640 |
) |
|
641 |
#(#MenuItem |
|
642 |
#label: 'Sort' |
|
643 |
#nameKey: #Sort |
|
644 |
#translateLabel: true |
|
645 |
#submenuChannel: #sortMenu |
|
3907 | 646 |
) |
4410 | 647 |
#(#MenuItem |
648 |
#label: 'Show' |
|
649 |
#translateLabel: true |
|
650 |
#submenu: |
|
651 |
#(#Menu |
|
652 |
#( |
|
4415 | 653 |
#(#MenuItem |
654 |
#label: 'Hidden Files' |
|
655 |
#translateLabel: true |
|
656 |
#indication: #showHiddenFiles |
|
657 |
) |
|
658 |
#(#MenuItem |
|
659 |
#label: 'Directories' |
|
660 |
#translateLabel: true |
|
661 |
#indication: #viewDirsInContentsBrowser |
|
662 |
) |
|
4410 | 663 |
) |
664 |
nil |
|
665 |
nil |
|
666 |
) |
|
667 |
) |
|
3907 | 668 |
) |
669 |
nil |
|
670 |
nil |
|
671 |
) |
|
3887 | 672 |
) |
3980 | 673 |
#(#MenuItem |
674 |
#label: '-' |
|
675 |
) |
|
676 |
#(#MenuItem |
|
677 |
#label: 'Update' |
|
4421 | 678 |
#itemValue: #updateCurrentDirectory |
3980 | 679 |
#translateLabel: true |
680 |
) |
|
3887 | 681 |
) |
682 |
nil |
|
683 |
nil |
|
684 |
) |
|
685 |
! |
|
686 |
||
687 |
viewBrowserMenu |
|
688 |
"This resource specification was automatically generated |
|
689 |
by the MenuEditor of ST/X." |
|
690 |
||
691 |
"Do not manually edit this!! If it is corrupted, |
|
692 |
the MenuEditor may not be able to read the specification." |
|
693 |
||
694 |
" |
|
695 |
MenuEditor new openOnClass:DirectoryContentsBrowser andSelector:#viewBrowserMenu |
|
696 |
(Menu new fromLiteralArrayEncoding:(DirectoryContentsBrowser viewBrowserMenu)) startUp |
|
697 |
" |
|
698 |
||
4415 | 699 |
<resource: #programMenu> |
3887 | 700 |
|
3961 | 701 |
^ Menu new fromLiteralArrayEncoding:self viewBrowserMenuSpec |
702 |
! |
|
703 |
||
704 |
viewBrowserMenuSpec |
|
705 |
"This resource specification was automatically generated |
|
706 |
by the MenuEditor of ST/X." |
|
707 |
||
708 |
"Do not manually edit this!! If it is corrupted, |
|
709 |
the MenuEditor may not be able to read the specification." |
|
710 |
||
711 |
" |
|
4421 | 712 |
MenuEditor new openOnClass:DirectoryContentsBrowser andSelector:#viewBrowserMenuSpec |
713 |
(Menu new fromLiteralArrayEncoding:(DirectoryContentsBrowser viewBrowserMenuSpec)) startUp |
|
3961 | 714 |
" |
715 |
||
716 |
<resource: #menu> |
|
717 |
||
3887 | 718 |
^ |
719 |
#(#Menu |
|
720 |
#( |
|
721 |
#(#MenuItem |
|
4970 | 722 |
#label: 'Show Details' |
3887 | 723 |
#translateLabel: true |
724 |
#hideMenuOnActivated: false |
|
725 |
#indication: #viewDetails |
|
726 |
) |
|
727 |
#(#MenuItem |
|
3984 | 728 |
#label: '-' |
729 |
) |
|
730 |
#(#MenuItem |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
731 |
#enabled: true |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
732 |
#label: 'Icon' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
733 |
#translateLabel: true |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
734 |
#hideMenuOnActivated: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
735 |
#indication: #viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
736 |
) |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
737 |
#(#MenuItem |
4421 | 738 |
#enabled: #viewDetails |
4970 | 739 |
#label: 'Suffix' |
3887 | 740 |
#translateLabel: true |
741 |
#hideMenuOnActivated: false |
|
742 |
#indication: #viewType |
|
743 |
) |
|
744 |
#(#MenuItem |
|
4421 | 745 |
#enabled: #viewDetails |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
746 |
#label: 'Inode' |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
747 |
#translateLabel: true |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
748 |
#hideMenuOnActivated: false |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
749 |
#indication: #viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
750 |
) |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
751 |
#(#MenuItem |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
752 |
#enabled: #viewDetails |
4970 | 753 |
#label: 'Permissions' |
3887 | 754 |
#translateLabel: true |
755 |
#hideMenuOnActivated: false |
|
756 |
#indication: #viewPermissions |
|
757 |
) |
|
758 |
#(#MenuItem |
|
4421 | 759 |
#enabled: #viewDetails |
4970 | 760 |
#label: 'Owner' |
3887 | 761 |
#translateLabel: true |
4648 | 762 |
#isVisible: #userContextAvailable |
3887 | 763 |
#hideMenuOnActivated: false |
764 |
#indication: #viewOwner |
|
765 |
) |
|
766 |
#(#MenuItem |
|
4421 | 767 |
#enabled: #viewDetails |
4970 | 768 |
#label: 'Group' |
3887 | 769 |
#translateLabel: true |
4648 | 770 |
#isVisible: #userContextAvailable |
3887 | 771 |
#hideMenuOnActivated: false |
772 |
#indication: #viewGroup |
|
773 |
) |
|
774 |
#(#MenuItem |
|
4421 | 775 |
#enabled: #viewDetails |
4970 | 776 |
#label: 'Size' |
3887 | 777 |
#translateLabel: true |
778 |
#hideMenuOnActivated: false |
|
779 |
#indication: #viewSize |
|
780 |
) |
|
781 |
#(#MenuItem |
|
4421 | 782 |
#enabled: #viewDetails |
4970 | 783 |
#label: 'Size (Bytes)' |
784 |
#translateLabel: true |
|
785 |
#hideMenuOnActivated: false |
|
786 |
#indication: #viewSizeInBytes |
|
787 |
) |
|
788 |
#(#MenuItem |
|
789 |
#enabled: #viewDetails |
|
790 |
#label: 'Date && Time' |
|
3887 | 791 |
#translateLabel: true |
792 |
#hideMenuOnActivated: false |
|
793 |
#indication: #viewTime |
|
794 |
) |
|
795 |
#(#MenuItem |
|
4421 | 796 |
#enabled: #viewDetails |
4970 | 797 |
#label: 'File Info' |
3887 | 798 |
#translateLabel: true |
799 |
#hideMenuOnActivated: false |
|
800 |
#indication: #viewDescription |
|
801 |
) |
|
802 |
#(#MenuItem |
|
4421 | 803 |
#enabled: #viewDetails |
4970 | 804 |
#label: 'Preview' |
3887 | 805 |
#translateLabel: true |
806 |
#hideMenuOnActivated: false |
|
807 |
#indication: #viewPreview |
|
808 |
) |
|
809 |
#(#MenuItem |
|
810 |
#label: '-' |
|
3980 | 811 |
#isVisible: false |
3887 | 812 |
) |
813 |
#(#MenuItem |
|
814 |
#label: 'Show Hidden Files' |
|
815 |
#translateLabel: true |
|
4421 | 816 |
#isVisible: false |
3887 | 817 |
#indication: #showHiddenFiles |
3980 | 818 |
) |
819 |
#(#MenuItem |
|
820 |
#label: 'Update' |
|
4421 | 821 |
#itemValue: #updateCurrentDirectory |
3980 | 822 |
#translateLabel: true |
823 |
#isVisible: false |
|
824 |
) |
|
825 |
) |
|
826 |
nil |
|
827 |
nil |
|
828 |
) |
|
3887 | 829 |
! ! |
830 |
||
831 |
!DirectoryContentsBrowser methodsFor:'accessing'! |
|
832 |
||
4342 | 833 |
allItems |
834 |
"return the value of the instance variable 'allItems' (automatically generated)" |
|
835 |
||
4916 | 836 |
^ allItems ? #() |
4342 | 837 |
! |
838 |
||
839 |
allItems:something |
|
840 |
"set the value of the instance variable 'allItems' (automatically generated)" |
|
841 |
||
842 |
allItems := something. |
|
843 |
! |
|
844 |
||
5105
849d4430b492
bug fix (copy filenames/selected filenames)
Claus Gittinger <cg@exept.de>
parents:
5010
diff
changeset
|
845 |
browserFileList |
849d4430b492
bug fix (copy filenames/selected filenames)
Claus Gittinger <cg@exept.de>
parents:
5010
diff
changeset
|
846 |
^ self browserItemList collect:[:item | item fileName] |
849d4430b492
bug fix (copy filenames/selected filenames)
Claus Gittinger <cg@exept.de>
parents:
5010
diff
changeset
|
847 |
! |
849d4430b492
bug fix (copy filenames/selected filenames)
Claus Gittinger <cg@exept.de>
parents:
5010
diff
changeset
|
848 |
|
4342 | 849 |
changeSema |
850 |
"return the value of the instance variable 'changeSema' (automatically generated)" |
|
851 |
changeSema isNil ifTrue:[ |
|
852 |
changeSema := Semaphore new. |
|
4017 | 853 |
]. |
4342 | 854 |
^ changeSema |
4017 | 855 |
! |
856 |
||
3887 | 857 |
columnDescriptors |
858 |
"get the column description |
|
859 |
" |
|
860 |
^ columnDescriptors |
|
861 |
! |
|
862 |
||
863 |
columnDescriptors:aListOfColumns |
|
864 |
"set the column description |
|
865 |
" |
|
866 |
columnDescriptors = aListOfColumns ifTrue:[ |
|
867 |
^ self |
|
868 |
]. |
|
869 |
||
870 |
columnDescriptors := OrderedCollection new. |
|
4970 | 871 |
previewIndex := 0. |
3887 | 872 |
iconIndex := 0. |
873 |
fileDescriptionIndex := 0. |
|
874 |
iconExtent := nil. |
|
875 |
||
4970 | 876 |
aListOfColumns keysAndValuesDo:[:anIndex :aDesc| |
877 |
|col readSelector| |
|
878 |
||
879 |
col := aDesc isSequenceable |
|
880 |
ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:aDesc] |
|
881 |
ifFalse:[aDesc]. |
|
3887 | 882 |
columnDescriptors add:col. |
883 |
||
4970 | 884 |
"/ cg: UGLY CODE NOTIFICATION |
885 |
readSelector := col readSelector. |
|
886 |
readSelector == #preview ifTrue:[ |
|
3887 | 887 |
previewIndex := anIndex. |
888 |
iconExtent := Point x:(col width) y:(col height). |
|
889 |
] ifFalse:[ |
|
4970 | 890 |
readSelector == #fileInfoString ifTrue:[ |
3887 | 891 |
fileDescriptionIndex := anIndex. |
892 |
] ifFalse:[ |
|
4970 | 893 |
readSelector == #icon ifTrue:[ |
3887 | 894 |
iconIndex := anIndex. |
895 |
] |
|
896 |
] |
|
897 |
] |
|
898 |
]. |
|
899 |
! |
|
900 |
||
901 |
directory |
|
902 |
"returns the current directory or nil |
|
903 |
" |
|
904 |
^ directory |
|
905 |
||
906 |
! |
|
907 |
||
908 |
directory:aDirectory |
|
909 |
"change the current directory and read the items |
|
910 |
" |
|
911 |
directory := aDirectory. |
|
4342 | 912 |
self wakeUpForDirectoryChanged. |
913 |
! |
|
914 |
||
915 |
directoryChangeFlag |
|
916 |
"return the value of the instance variable 'directoryChangeFlag' (automatically generated)" |
|
917 |
||
918 |
directoryChangeFlag isNil ifTrue:[ |
|
919 |
directoryChangeFlag := false. |
|
920 |
]. |
|
921 |
^ directoryChangeFlag |
|
922 |
! |
|
923 |
||
924 |
directoryChangeFlag:something |
|
925 |
"set the value of the instance variable 'directoryChangeFlag' (automatically generated)" |
|
926 |
||
927 |
directoryChangeFlag := something. |
|
928 |
! |
|
929 |
||
930 |
directoryContentsChangeFlag |
|
931 |
"return the value of the instance variable 'directoryContentsChangeFlag' (automatically generated)" |
|
932 |
||
933 |
directoryContentsChangeFlag isNil ifTrue:[ |
|
934 |
directoryContentsChangeFlag := false. |
|
935 |
]. |
|
936 |
^ directoryContentsChangeFlag |
|
937 |
! |
|
938 |
||
939 |
directoryContentsChangeFlag:something |
|
940 |
"set the value of the instance variable 'directoryContentsChangeFlag' (automatically generated)" |
|
941 |
||
942 |
directoryContentsChangeFlag := something. |
|
943 |
! |
|
944 |
||
945 |
filterChangeFlag |
|
946 |
"return the value of the instance variable 'filterChangeFlag' (automatically generated)" |
|
947 |
||
948 |
filterChangeFlag isNil ifTrue:[ |
|
949 |
filterChangeFlag := false. |
|
950 |
]. |
|
951 |
^ filterChangeFlag |
|
952 |
! |
|
953 |
||
954 |
filterChangeFlag:something |
|
955 |
"set the value of the instance variable 'filterChangeFlag' (automatically generated)" |
|
956 |
||
957 |
filterChangeFlag := something. |
|
958 |
! |
|
959 |
||
960 |
isBusy |
|
961 |
"return the value of the instance variable 'isBusy' (automatically generated)" |
|
962 |
||
963 |
isBusy isNil ifTrue:[ |
|
964 |
isBusy := false. |
|
965 |
]. |
|
966 |
^ isBusy |
|
967 |
! |
|
968 |
||
969 |
isBusy:something |
|
970 |
"set the value of the instance variable 'isBusy' (automatically generated)" |
|
971 |
||
972 |
isBusy := something. |
|
4017 | 973 |
! |
974 |
||
975 |
matchBlock |
|
976 |
"return the value of the instance variable 'matchBlock' (automatically generated)" |
|
977 |
||
978 |
^ matchBlock |
|
979 |
! |
|
980 |
||
981 |
matchBlock:filterBlock |
|
982 |
||
983 |
matchBlock := filterBlock. |
|
3887 | 984 |
! |
985 |
||
4342 | 986 |
sortBlockChangeFlag |
987 |
"return the value of the instance variable 'sortBlockChangeFlag' (automatically generated)" |
|
988 |
||
989 |
sortBlockChangeFlag isNil ifTrue:[ |
|
990 |
sortBlockChangeFlag := false. |
|
991 |
]. |
|
992 |
^ sortBlockChangeFlag |
|
4298 | 993 |
! |
994 |
||
4342 | 995 |
sortBlockChangeFlag:something |
996 |
"set the value of the instance variable 'sortBlockChangeFlag' (automatically generated)" |
|
997 |
||
998 |
sortBlockChangeFlag := something. |
|
3887 | 999 |
! |
1000 |
||
3983 | 1001 |
updateContentsSelection |
1002 |
"return the value of the instance variable 'updateToExternFileHolder' (automatically generated)" |
|
1003 |
||
1004 |
updateContentsSelection isNil ifTrue:[ |
|
1005 |
updateContentsSelection := self class newLock. |
|
1006 |
]. |
|
1007 |
^ updateContentsSelection |
|
3887 | 1008 |
! ! |
1009 |
||
1010 |
!DirectoryContentsBrowser methodsFor:'actions'! |
|
1011 |
||
4342 | 1012 |
browserItemListAdd:addItemCol remove:remItemCol |
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1013 |
| browserList selection| |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1014 |
|
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1015 |
(addItemCol isEmpty and:[remItemCol isEmpty]) ifTrue:[ ^ self]. |
4972 | 1016 |
selection := self selectedItemsWithoutDotDotDirectory. |
4017 | 1017 |
remItemCol notEmpty ifTrue:[ |
4462
b14fcc67ff8e
removeAll: changed to removeAllFoundIn:
Michael Beyl <mb@exept.de>
parents:
4421
diff
changeset
|
1018 |
self browserItemList removeAllFoundIn:remItemCol |
4017 | 1019 |
]. |
1020 |
addItemCol notEmpty ifTrue:[ |
|
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1021 |
browserList := self browserItemList copy. |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1022 |
addItemCol do:[: aNewItem | |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1023 |
(browserList includes:aNewItem) not ifTrue:[ |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1024 |
browserList add:aNewItem. |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1025 |
browserList sort:self sortBlockHolder value. |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1026 |
self browserItemList add:aNewItem beforeIndex:(browserList indexOf:aNewItem). |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1027 |
] |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1028 |
]. |
4017 | 1029 |
]. |
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1030 |
self selectItems:selection. |
4017 | 1031 |
! |
1032 |
||
4027 | 1033 |
currentSortOrderChanged |
1034 |
||
4652 | 1035 |
"/ self wakeUpForSortBlockChanged. |
1036 |
"/ have to reread the columns and set the icon for sort direction |
|
1037 |
"/ very expensive until table label can be changed directly |
|
4027 | 1038 |
self viewedColumnsChanged. |
1039 |
! |
|
1040 |
||
3887 | 1041 |
doResizeImage |
4342 | 1042 |
|column w h selection| |
3887 | 1043 |
|
1044 |
previewIndex == 0 ifTrue:[^ self]. |
|
1045 |
||
1046 |
column := columnDescriptors at:previewIndex. |
|
4342 | 1047 |
w := iconExtent x. |
3887 | 1048 |
h := iconExtent y. |
1049 |
||
1050 |
w == column width ifTrue:[ |
|
1051 |
w := w * 2. |
|
1052 |
h := h * 2. |
|
1053 |
]. |
|
1054 |
column width:w. |
|
1055 |
column height:h. |
|
1056 |
||
3990 | 1057 |
"/Processor activeProcess ~~ self windowGroup process ifTrue:[self halt]. |
4342 | 1058 |
selection := self selectedItems. |
3983 | 1059 |
browserItemList do:[:el| el resetImageFile ]. |
4713 | 1060 |
browser columnDescriptors:(self tableColumns value). |
4342 | 1061 |
self selectItems:selection. |
1062 |
self wakeUp. |
|
3887 | 1063 |
! |
1064 |
||
1065 |
doUpdate |
|
4421 | 1066 |
"/ DirectoryContents flushCache. |
4342 | 1067 |
self wakeUpForDirectoryContentsChanged. |
4782 | 1068 |
|
1069 |
directory notNil ifTrue:[ |
|
1070 |
self flushRememberedDiskUsageInfoFor:directory. |
|
1071 |
] ifFalse:[ |
|
1072 |
self flushRememberedDiskUsageInfo. |
|
1073 |
]. |
|
1074 |
self startDiskUsageInfoProcess. |
|
3887 | 1075 |
! |
1076 |
||
3984 | 1077 |
doubleClickedAt:anItemIndex |
3983 | 1078 |
|
3906 | 1079 |
self withWaitCursorDo:[ |
4013 | 1080 |
self enterActionFor:(self browserItemList at:anItemIndex). "/ anItemIndex. |
3906 | 1081 |
] |
3887 | 1082 |
! |
1083 |
||
1084 |
enterActionFor:anItem |
|
1085 |
| filename| |
|
1086 |
||
1087 |
filename := anItem fileName. |
|
3906 | 1088 |
|
4014 | 1089 |
filename baseName = '..' ifTrue:[ |
3887 | 1090 |
self currentFileNameHolder value:(OrderedCollection with:(self directory directory)). |
1091 |
^ self. |
|
1092 |
]. |
|
5263 | 1093 |
(anItem fileName isDirectory) ifTrue:[ |
3887 | 1094 |
self currentFileNameHolder value:(OrderedCollection with:filename). |
1095 |
^ self. |
|
1096 |
]. |
|
5290 | 1097 |
self withWaitCursorDo:[ |
1098 |
self openApplByFileItem:anItem. |
|
1099 |
] |
|
4017 | 1100 |
! |
1101 |
||
1102 |
noOfAddedFiles:noOfAddedFiles noOfFiles:noOfFiles |
|
1103 |
||
4263 | 1104 |
|info filterBox clr| |
1105 |
||
1106 |
noOfAddedFiles = noOfFiles ifTrue:[ |
|
5120 | 1107 |
info := '%1 file%3'. |
4263 | 1108 |
] ifFalse:[ |
5120 | 1109 |
info := '%1 file%3 shown (out of %2)'. |
4263 | 1110 |
]. |
5120 | 1111 |
self shownFiles |
1112 |
value:(resources |
|
1113 |
string:info |
|
1114 |
with:noOfAddedFiles |
|
1115 |
with:noOfFiles |
|
1116 |
with:(noOfAddedFiles == 1 ifTrue:[''] ifFalse:['s'])). |
|
4263 | 1117 |
|
4017 | 1118 |
filterBox := self filterValueBox value. |
1119 |
filterBox isNil ifTrue:[^ self ]. |
|
1120 |
noOfAddedFiles ~= noOfFiles ifTrue:[ |
|
1121 |
clr := Color red lightened lightened lightened. |
|
4786 | 1122 |
[ View drawingOnClosedDrawableSignal catch:[ filterBox flash ] ] fork. |
4017 | 1123 |
] ifFalse:[ |
1124 |
clr := self filterBackgroundColor value. |
|
1125 |
]. |
|
1126 |
filterBox backgroundColor:clr. |
|
1127 |
! |
|
1128 |
||
4342 | 1129 |
setBrowserItemList:filteredItems |
4017 | 1130 |
|
1131 |
|showDir directoryUpItem locItems| |
|
1132 |
||
4202 | 1133 |
showDir := self viewDirsInContentsBrowser value. |
4017 | 1134 |
(showDir and:[self directory notNil and:[self directory isRootDirectory not]]) ifTrue:[ |
5249 | 1135 |
locItems := OrderedCollection new. |
4017 | 1136 |
directoryUpItem := DirectoryContentsBrowser itemClass fileName:(self directory construct:'..'). |
5249 | 1137 |
directoryUpItem notNil ifTrue:[ |
1138 |
locItems add:directoryUpItem. |
|
1139 |
]. |
|
4662
1351fd934a4a
addFirst on array is slow parse to OrderedCollection in setBrowserItemList:
Michael Beyl <mb@exept.de>
parents:
4652
diff
changeset
|
1140 |
locItems addAll:filteredItems. |
4346 | 1141 |
] ifFalse:[ |
1142 |
locItems := filteredItems. |
|
4017 | 1143 |
]. |
4039 | 1144 |
self updateToExternFileHolderLock doLocked:[ |
1145 |
self browserItemList contents:locItems asList. |
|
1146 |
]. |
|
4342 | 1147 |
"/ Transcript showCR:'after insert list', AbsoluteTime now asString. |
4017 | 1148 |
self selectCurrentFiles. |
3887 | 1149 |
! ! |
1150 |
||
1151 |
!DirectoryContentsBrowser methodsFor:'aspects'! |
|
1152 |
||
3983 | 1153 |
browserItemList |
1154 |
||
1155 |
browserItemList isNil ifTrue:[ |
|
1156 |
browserItemList := List new. |
|
1157 |
]. |
|
1158 |
^ browserItemList |
|
3887 | 1159 |
! |
1160 |
||
3983 | 1161 |
selectionInFileList |
1162 |
||
1163 |
selectionInFileList isNil ifTrue:[ |
|
1164 |
selectionInFileList := ValueHolder new. |
|
1165 |
selectionInFileList addDependent:self. |
|
3887 | 1166 |
]. |
3983 | 1167 |
^ selectionInFileList |
3887 | 1168 |
! |
1169 |
||
1170 |
tableColumns |
|
1171 |
||
1172 |
tableColumns isNil ifTrue:[ |
|
1173 |
tableColumns := self class tableColumns asValue. |
|
1174 |
]. |
|
1175 |
^ tableColumns. |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1176 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1177 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1178 |
valueHolderForColumn:id |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1179 |
"xlate #suffix -> viewType, etc... |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1180 |
i.e. for a columns readSelector, return my valueHolder" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1181 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1182 |
^ self perform:('view' , id asUppercaseFirst) asSymbol |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1183 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1184 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1185 |
viewFileInfoString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1186 |
^ self viewDescription |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1187 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1188 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1189 |
viewSizeInBytesString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1190 |
^ self viewSizeInBytes |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1191 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1192 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1193 |
viewSizeString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1194 |
^ self viewSize |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1195 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1196 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1197 |
viewSuffix |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1198 |
^ self viewType |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1199 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1200 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1201 |
viewTimeAndDate |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1202 |
^ self viewTime |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1203 |
! ! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1204 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1205 |
!DirectoryContentsBrowser methodsFor:'aspects-visibility'! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1206 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1207 |
colVisibilityAspectFor:aKey ifAbsent:absentBlock |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1208 |
"aspect for a columns visibility" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1209 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1210 |
|holder| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1211 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1212 |
holder := self aspectFor:aKey ifAbsent:absentBlock. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1213 |
holder onChangeSend:#viewedColumnsChanged to:self. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1214 |
^ holder |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1215 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1216 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1217 |
viewDescription |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1218 |
"aspect for show file description" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1219 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1220 |
^ self colVisibilityAspectFor:#viewDescription ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1221 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1222 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1223 |
viewDetails |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1224 |
"aspect for show more file properties |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1225 |
" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1226 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1227 |
^ self colVisibilityAspectFor:#viewDetails ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1228 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1229 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1230 |
viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1231 |
" aspect for show group information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1232 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1233 |
^ self colVisibilityAspectFor:#viewGroup ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1234 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1235 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1236 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1237 |
" aspect for show file-type icon" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1238 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1239 |
^ self colVisibilityAspectFor:#viewIcon ifAbsent:[ true asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1240 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1241 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1242 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1243 |
" aspect for show inode number " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1244 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1245 |
^ self colVisibilityAspectFor:#viewInodeNumber ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1246 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1247 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1248 |
viewOwner |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1249 |
" aspect for show owner information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1250 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1251 |
^ self colVisibilityAspectFor:#viewOwner ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1252 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1253 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1254 |
viewPermissions |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1255 |
" aspect for show permission information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1256 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1257 |
^ self colVisibilityAspectFor:#viewPermissions ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1258 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1259 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1260 |
viewPreview |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1261 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1262 |
" aspect for show image previev " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1263 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1264 |
^ self colVisibilityAspectFor:#viewPreview ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1265 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1266 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1267 |
viewSize |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1268 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1269 |
" aspect for show size information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1270 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1271 |
^ self colVisibilityAspectFor:#viewSize ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1272 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1273 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1274 |
viewSizeInBytes |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1275 |
" aspect for show size-in-bytes information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1276 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1277 |
^ self colVisibilityAspectFor:#viewSizeInBytes ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1278 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1279 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1280 |
viewTime |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1281 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1282 |
" aspect for show time information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1283 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1284 |
^ self colVisibilityAspectFor:#viewTime ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1285 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1286 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1287 |
viewType |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1288 |
" aspect for show suffix (type) information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1289 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1290 |
^ self colVisibilityAspectFor:#viewType ifAbsent:[ false asValue ]. |
3887 | 1291 |
! ! |
1292 |
||
1293 |
!DirectoryContentsBrowser methodsFor:'change & update'! |
|
1294 |
||
3983 | 1295 |
currentFileNameHolderChanged |
3887 | 1296 |
"filename changed |
1297 |
" |
|
4889 | 1298 |
|newDir currentDir aColOfFiles| |
3983 | 1299 |
|
1300 |
aColOfFiles := self currentFileNameHolder value. |
|
4978
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1301 |
aColOfFiles isEmpty ifTrue:[ |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1302 |
"/ selection is gone keep the current directory list |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1303 |
^ self |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1304 |
]. |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1305 |
(self currentFilesAreInSameDirectory not) ifTrue:[ |
3887 | 1306 |
self directory:nil. |
1307 |
^ self |
|
1308 |
]. |
|
4889 | 1309 |
self currentDirectories value size > 1 ifTrue:[ |
1310 |
self directory:nil. |
|
1311 |
^ self |
|
1312 |
]. |
|
4536 | 1313 |
aColOfFiles size == 1 ifTrue:[ |
4781 | 1314 |
self startDiskUsageInfoProcess. |
4536 | 1315 |
]. |
4900 | 1316 |
newDir := (self directoriesForFiles:aColOfFiles) first asCanonicalizedFilename. |
4901 | 1317 |
currentDir := self directory. |
4906
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1318 |
(currentDir notNil and:[newDir = currentDir asCanonicalizedFilename]) ifTrue:[ |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1319 |
self selectFiles:aColOfFiles. |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1320 |
^ self. |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1321 |
]. |
4536 | 1322 |
"/ change of the directory filename |
1323 |
self directory:newDir. |
|
3887 | 1324 |
! |
1325 |
||
4071 | 1326 |
filterBlockHolderChanged |
1327 |
||
1328 |
self matchBlock:self filterBlockHolder value. |
|
4342 | 1329 |
self wakeUpForFilterChanged. |
4071 | 1330 |
! |
1331 |
||
3983 | 1332 |
selectionChanged |
1333 |
||
4004 | 1334 |
| selection newCurrentFilename | |
3983 | 1335 |
|
1336 |
self directory isNil ifTrue:[^ self]. |
|
4781 | 1337 |
|
3983 | 1338 |
selection := self selectedFiles. |
1339 |
selection isEmpty ifTrue:[ |
|
4004 | 1340 |
newCurrentFilename := OrderedCollection with:self directory. |
3983 | 1341 |
] ifFalse:[ |
4004 | 1342 |
newCurrentFilename := selection. |
3983 | 1343 |
]. |
4004 | 1344 |
self currentFileNameHolder value ~= newCurrentFilename ifTrue:[ |
1345 |
self currentFileNameHolder value:newCurrentFilename withoutNotifying:self |
|
4781 | 1346 |
]. |
3983 | 1347 |
! |
1348 |
||
4781 | 1349 |
update:something with:aParameter from:changedObject |
3887 | 1350 |
"one of my models changed |
1351 |
" |
|
3983 | 1352 |
|
4781 | 1353 |
changedObject == self currentFileNameHolder ifTrue:[ |
1354 |
super update:something with:aParameter from:changedObject. |
|
3983 | 1355 |
self updateContentsSelection doIfUnLocked:[ |
4017 | 1356 |
self currentFileNameHolderChanged. |
3983 | 1357 |
]. |
4007 | 1358 |
^ self. |
3983 | 1359 |
]. |
4781 | 1360 |
changedObject == self selectionInFileList ifTrue:[ |
3983 | 1361 |
self updateToExternFileHolderLock doIfUnLocked:[ |
1362 |
self updateContentsSelection doLocked:[ |
|
1363 |
self selectionChanged. |
|
1364 |
] |
|
1365 |
]. |
|
1366 |
^ self. |
|
1367 |
]. |
|
4781 | 1368 |
changedObject == self currentSortOrder ifTrue:[ |
4027 | 1369 |
self currentSortOrderChanged. |
1370 |
^ self. |
|
1371 |
]. |
|
4781 | 1372 |
changedObject == self filterBlockHolder ifTrue:[ |
4071 | 1373 |
self filterBlockHolderChanged. |
3887 | 1374 |
^ self. |
1375 |
]. |
|
4781 | 1376 |
changedObject == self sortBlockHolder ifTrue:[ |
4342 | 1377 |
self wakeUpForSortBlockChanged. |
3887 | 1378 |
^ self. |
1379 |
]. |
|
4781 | 1380 |
changedObject == self viewDirsInContentsBrowser ifTrue:[ |
4342 | 1381 |
self wakeUpForFilterChanged. |
3887 | 1382 |
^ self |
1383 |
]. |
|
4781 | 1384 |
changedObject == self showDiskUsageHolder ifTrue:[ |
1385 |
self notify:''. |
|
1386 |
changedObject value ifTrue:[ |
|
1387 |
self startDiskUsageInfoProcess. |
|
1388 |
] ifFalse:[ |
|
1389 |
self flushRememberedDiskUsageInfo |
|
1390 |
]. |
|
1391 |
^ self |
|
1392 |
]. |
|
1393 |
||
1394 |
super update:something with:aParameter from:changedObject |
|
3887 | 1395 |
! |
1396 |
||
4342 | 1397 |
viewPreviewChanged |
1398 |
||
1399 |
browserItemList do:[:el| el resetImageFile ]. |
|
1400 |
self viewedColumnsChanged. |
|
1401 |
! |
|
1402 |
||
3887 | 1403 |
viewedColumnsChanged |
1404 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1405 |
|columns buffer currentSortOrder currentSortOrderColumn currentSortOrderReverse selection holder| |
4342 | 1406 |
|
1407 |
selection := self selectedItems. |
|
4778
e1c81c22bf36
Avoid slow grow operations on Array.
Stefan Vogel <sv@exept.de>
parents:
4768
diff
changeset
|
1408 |
buffer := self class tableColumns |
4768 | 1409 |
collect:[:col| (DataSetColumnSpec new fromLiteralArrayEncoding:col)]. |
1410 |
||
4778
e1c81c22bf36
Avoid slow grow operations on Array.
Stefan Vogel <sv@exept.de>
parents:
4768
diff
changeset
|
1411 |
columns := buffer asOrderedCollection. |
3887 | 1412 |
self viewDetails value = false ifTrue:[ |
4713 | 1413 |
browser showLabels:false. |
3887 | 1414 |
buffer do:[:col | |
1415 |
(col readSelector = #baseName or:[col readSelector = #icon]) ifFalse:[ |
|
1416 |
columns remove:col. |
|
1417 |
] |
|
1418 |
] |
|
1419 |
] ifFalse:[ |
|
4713 | 1420 |
browser showLabels:true. |
4027 | 1421 |
currentSortOrder := self currentSortOrder value. |
1422 |
currentSortOrderColumn := currentSortOrder at:#column ifAbsent:nil. |
|
1423 |
currentSortOrderReverse := currentSortOrder at:#reverse ifAbsent:nil. |
|
3887 | 1424 |
buffer do:[:col | |
1425 |
| id | |
|
4970 | 1426 |
|
1427 |
id := col readSelector. |
|
3887 | 1428 |
id notNil ifTrue:[ |
4027 | 1429 |
(col labelActionArgument notNil and:[col labelActionArgument asSymbol == currentSortOrderColumn]) ifTrue:[ |
1430 |
| label icon| |
|
1431 |
label := col label. |
|
1432 |
icon := currentSortOrderReverse ifTrue:[self class detailsMenuIconDown] ifFalse:[self class detailsMenuIconUp]. |
|
1433 |
col label:(LabelAndIcon label:label icon:icon). |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1434 |
]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1435 |
|
4970 | 1436 |
((id == #baseName) or:[id == #baseNameWithOutSuffix]) ifTrue:[ |
4027 | 1437 |
self viewType value ifTrue:[ |
1438 |
col readSelector:#baseNameWithOutSuffix |
|
3887 | 1439 |
] ifFalse:[ |
4027 | 1440 |
col readSelector:#baseName |
1441 |
]. |
|
1442 |
] ifFalse:[ |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1443 |
holder := self valueHolderForColumn:id. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1444 |
holder value ifFalse:[ |
4970 | 1445 |
columns remove:col. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1446 |
]. |
3887 | 1447 |
] |
1448 |
] |
|
1449 |
] |
|
1450 |
]. |
|
4039 | 1451 |
self updateToExternFileHolderLock doLocked:[ |
1452 |
self tableColumns value:columns. |
|
1453 |
]. |
|
3887 | 1454 |
self columnDescriptors:(self tableColumns value). |
4342 | 1455 |
self selectItems:selection. |
1456 |
self wakeUp. |
|
3887 | 1457 |
! ! |
1458 |
||
1459 |
!DirectoryContentsBrowser methodsFor:'drag & drop'! |
|
1460 |
||
1461 |
doStartDrag:aDropSource in:aView |
|
1462 |
"set the cursors before starting the drag & drop operation |
|
1463 |
" |
|
3983 | 1464 |
|selectedFiles| |
1465 |
||
1466 |
selectedFiles := self selectedFiles. |
|
4014 | 1467 |
(selectedFiles isEmpty) ifTrue:[ |
3887 | 1468 |
^ self. |
1469 |
]. |
|
3953 | 1470 |
^ super doStartDrag:aDropSource in:aView |
1471 |
! |
|
1472 |
||
4746 | 1473 |
dropDestinationPath |
1474 |
|destinationPath| |
|
1475 |
||
1476 |
draggedItem isNil ifTrue:[ |
|
1477 |
destinationPath := self directory. |
|
1478 |
] ifFalse:[ |
|
1479 |
destinationPath := self getDirWithoutFileName:(draggedItem fileName). |
|
1480 |
destinationPath baseName = '..' ifTrue:[ |
|
1481 |
destinationPath := self directory directory. |
|
1482 |
] |
|
1483 |
]. |
|
1484 |
||
1485 |
^ destinationPath |
|
1486 |
! |
|
1487 |
||
4683 | 1488 |
dropOver:aDropContext |
4611 | 1489 |
"called during drag & drop while moving over the widget." |
1490 |
||
3953 | 1491 |
|lineNr newDest destinationFile| |
1492 |
||
1493 |
inDropMode ifFalse:[^ self]. |
|
1494 |
||
4683 | 1495 |
lineNr := self getLineNumberFor:aDropContext. |
3953 | 1496 |
lineNr notNil ifTrue:[ |
3983 | 1497 |
newDest := browserItemList at:lineNr. |
3953 | 1498 |
(newDest notNil and:[newDest isDirectory]) ifTrue:[ |
1499 |
destinationFile := newDest fileName. |
|
4014 | 1500 |
destinationFile baseName = '..' ifTrue:[ |
3953 | 1501 |
destinationFile := self directory directory. |
1502 |
] |
|
1503 |
]. |
|
1504 |
]. |
|
4683 | 1505 |
|
1506 |
newDest == draggedItem ifTrue:[ |
|
1507 |
"/ beyond last contents-line |
|
1508 |
newDest isNil ifTrue:[ |
|
1509 |
canDropItem := self canDropFiles:(aDropContext dropObjects) for:self directory. |
|
1510 |
]. |
|
1511 |
^ self |
|
1512 |
]. |
|
3953 | 1513 |
|
1514 |
destinationFile isNil ifTrue:[ |
|
1515 |
destinationFile := self directory. |
|
1516 |
]. |
|
3887 | 1517 |
|
3953 | 1518 |
newDest ~~ draggedItem ifTrue:[ |
4683 | 1519 |
aDropContext dropSource argument == #archivApplication ifTrue:[ |
3953 | 1520 |
canDropItem := true. |
1521 |
] ifFalse:[ |
|
4683 | 1522 |
canDropItem := self canDropFiles:(aDropContext dropObjects) for:destinationFile. |
3953 | 1523 |
]. |
1524 |
]. |
|
4683 | 1525 |
self dropTargetItemChangedTo:newDest in:aDropContext. |
3953 | 1526 |
! |
1527 |
||
1528 |
dropTargetItemChangedTo:anItem in:aDropContext |
|
1529 |
||
1530 |
| current | |
|
1531 |
||
1532 |
||
1533 |
"/ (anItem notNil and:[anItem isDirectory]) ifTrue:[ self halt]. |
|
1534 |
current := draggedItem. |
|
3967 | 1535 |
"/ Transcript showCR:'current:', (current isNil ifTrue:['nil'] ifFalse:[current fileName baseName]). |
1536 |
"/ Transcript showCR:'anItem:', (anItem isNil ifTrue:['nil'] ifFalse:[anItem fileName baseName]). |
|
3953 | 1537 |
current == anItem ifTrue:[^ self]. |
1538 |
draggedItem := anItem. |
|
1539 |
||
1540 |
aDropContext contentsWillChange. |
|
1541 |
||
1542 |
current ifNotNil:[ |
|
1543 |
current isDirectory ifTrue:[ |
|
1544 |
current icon:(self getIconFor:current). |
|
1545 |
]. |
|
1546 |
]. |
|
1547 |
||
1548 |
anItem ifNotNil:[ |
|
1549 |
anItem isDirectory ifTrue:[ |
|
1550 |
anItem icon:(FileBrowser iconForKeyMatching:#directoryOpenGray). |
|
1551 |
]. |
|
1552 |
]. |
|
4713 | 1553 |
browser shown ifTrue:[ |
1554 |
browser invalidateVisibleRow:current colAt:iconIndex. |
|
1555 |
browser invalidateVisibleRow:anItem colAt:iconIndex. |
|
1556 |
browser repairDamage. |
|
3953 | 1557 |
]. |
3887 | 1558 |
! |
1559 |
||
1560 |
getDisplayObjects:anArgument |
|
4713 | 1561 |
|selectedItems string fnName stream| |
1562 |
||
1563 |
selectedItems := self selectedFiles. |
|
1564 |
selectedItems isEmpty ifTrue:[ ^ '']. |
|
1565 |
||
3887 | 1566 |
stream := WriteStream on:''. |
4713 | 1567 |
stream nextPutAll:(selectedItems first baseName). |
1568 |
selectedItems size == 1 ifTrue:[ |
|
3887 | 1569 |
fnName := 'ui_menuitem.xpm'. |
1570 |
] ifFalse:[ |
|
1571 |
fnName := 'ui_submenu_open.xpm'. |
|
1572 |
stream nextPutAll:' ... '. |
|
4713 | 1573 |
stream nextPutAll:(selectedItems last baseName). |
3887 | 1574 |
]. |
1575 |
string := stream contents. |
|
1576 |
stream close. |
|
4713 | 1577 |
|
3887 | 1578 |
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) |
1579 |
string:(Text string:string emphasis:#bold) |
|
1580 |
) |
|
1581 |
! |
|
1582 |
||
4713 | 1583 |
removeExpandItemTimedBlock |
1584 |
"left blank" |
|
3887 | 1585 |
! ! |
1586 |
||
1587 |
!DirectoryContentsBrowser methodsFor:'event handling'! |
|
1588 |
||
1589 |
processEvent:anEvent |
|
1590 |
"filter keyboard events. |
|
1591 |
Return true, if I have eaten the event" |
|
1592 |
||
1593 |
|focusView key rawKey| |
|
1594 |
||
4713 | 1595 |
anEvent isKeyPressEvent ifFalse:[^ false]. |
1596 |
||
1597 |
focusView := anEvent targetView. |
|
1598 |
(focusView isNil or:[focusView ~~ browser]) ifTrue:[ ^ false]. |
|
1599 |
||
1600 |
key := anEvent key. |
|
1601 |
rawKey := anEvent rawKey. |
|
1602 |
||
1603 |
"/ (key ~= #'Alt_L') ifTrue:[self halt.]. |
|
1604 |
key == #Accept ifTrue:[ |
|
5260 | 1605 |
self withWaitCursorDo:[ |
1606 |
self fileFileIn. |
|
1607 |
]. |
|
4713 | 1608 |
^ true. |
1609 |
]. |
|
1610 |
key == #Paste ifTrue:[ |
|
1611 |
self pasteFiles. |
|
1612 |
^ true. |
|
3887 | 1613 |
]. |
4970 | 1614 |
"/ strange feeling, because behavior is different depending on |
1615 |
"/ where the mouse pointer is (treeView vs. contentsView) |
|
1616 |
"/ |
|
4713 | 1617 |
"/ (key == #CursorLeft) ifTrue:[ |
1618 |
"/ self doGoDirectoryUp. |
|
1619 |
"/ ^ true |
|
1620 |
"/ ]. |
|
1621 |
"/ (key == #CursorRight) ifTrue:[ |
|
1622 |
"/ self doBack. |
|
1623 |
"/ ^ true |
|
1624 |
"/ ]. |
|
1625 |
browserItemList size == 0 ifTrue:[ |
|
1626 |
^ false |
|
1627 |
]. |
|
1628 |
||
1629 |
key == #Cut ifTrue:[ |
|
1630 |
self doCut. |
|
1631 |
^ true. |
|
1632 |
]. |
|
1633 |
key == #Copy ifTrue:[ |
|
1634 |
self doCopy. |
|
1635 |
^ true. |
|
1636 |
]. |
|
1637 |
key == #Delete ifTrue:[ |
|
1638 |
self doDelete. |
|
1639 |
^ true. |
|
1640 |
]. |
|
1641 |
(key == #Return) ifTrue:[ |
|
4972 | 1642 |
self enterAction. |
4713 | 1643 |
^ true. |
1644 |
]. |
|
4828 | 1645 |
key == #Replace ifTrue:[ |
1646 |
self renameSelection. |
|
1647 |
^ true. |
|
1648 |
]. |
|
4713 | 1649 |
|
3887 | 1650 |
^ false |
1651 |
! ! |
|
1652 |
||
1653 |
!DirectoryContentsBrowser methodsFor:'menu accessing'! |
|
1654 |
||
1655 |
viewBrowserMenu |
|
1656 |
||
1657 |
<resource: #programMenu > |
|
1658 |
||
1659 |
|menu| |
|
1660 |
||
3961 | 1661 |
viewBrowserMenu isNil ifTrue:[ |
1662 |
viewBrowserMenu := self class viewBrowserMenu. |
|
1663 |
]. |
|
1664 |
viewBrowserMenu ifNil:[ ^ nil ]. |
|
4080 | 1665 |
viewBrowserMenu findGuiResourcesIn:self. |
1666 |
||
3961 | 1667 |
menu := viewBrowserMenu. |
3887 | 1668 |
menu receiver:self. |
1669 |
^ menu |
|
1670 |
! ! |
|
1671 |
||
1672 |
!DirectoryContentsBrowser methodsFor:'menu actions'! |
|
1673 |
||
1674 |
doShowFileContents |
|
1675 |
||
3983 | 1676 |
| selectedFileItems| |
1677 |
||
1678 |
selectedFileItems := self selectedFileItems. |
|
1679 |
(selectedFileItems size == 1) ifTrue:[ |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4862
diff
changeset
|
1680 |
self openNewTextEditorOn:(selectedFileItems first). |
3887 | 1681 |
]. |
4972 | 1682 |
! |
1683 |
||
1684 |
enterAction |
|
1685 |
||
1686 |
| selectedItems| |
|
1687 |
||
1688 |
selectedItems := self selectedItems. |
|
1689 |
(selectedItems size == 1) ifTrue:[ |
|
1690 |
self enterActionFor:(selectedItems first). |
|
1691 |
]. |
|
3887 | 1692 |
! ! |
1693 |
||
1694 |
!DirectoryContentsBrowser methodsFor:'queries'! |
|
1695 |
||
1696 |
allItemsOfCurrentDirectory |
|
4202 | 1697 |
self viewDirsInContentsBrowser value ifTrue:[ |
4768 | 1698 |
^ browserItemList copyFrom:2. "/ remove the '..' item |
3983 | 1699 |
]. |
4768 | 1700 |
^ browserItemList. |
3887 | 1701 |
! |
1702 |
||
1703 |
fileListIsEmpty |
|
1704 |
||
3983 | 1705 |
^ browserItemList isEmpty |
3887 | 1706 |
! |
1707 |
||
4768 | 1708 |
getAllFilesAsStrings |
1709 |
browserItemList isEmpty ifTrue:[ |
|
1710 |
^ #() |
|
3887 | 1711 |
]. |
4768 | 1712 |
^ browserItemList |
1713 |
select:[:anItem | anItem isDirectory not] |
|
1714 |
thenCollect:[:eachItem | eachItem fileName asString]. |
|
4004 | 1715 |
! |
1716 |
||
1717 |
hasFilesFiltered |
|
4342 | 1718 |
|
1719 |
^ self allItems size ~~ browserItemList size |
|
3983 | 1720 |
! ! |
1721 |
||
1722 |
!DirectoryContentsBrowser methodsFor:'selection'! |
|
1723 |
||
1724 |
selectAll |
|
1725 |
||
1726 |
| sel| |
|
1727 |
||
1728 |
sel := browserItemList copy. |
|
4202 | 1729 |
self viewDirsInContentsBrowser value ifTrue:[ |
4013 | 1730 |
sel removeIdentical:(browserItemList first) ifAbsent:[nil] |
3887 | 1731 |
]. |
3983 | 1732 |
self selectionInFileList value:sel. |
3887 | 1733 |
! |
1734 |
||
4017 | 1735 |
selectCurrentFiles |
1736 |
||
1737 |
|currentSelection| |
|
1738 |
||
1739 |
((currentSelection := self currentFileNameHolder value select:[:file| file isDirectory not]) notEmpty) ifTrue:[ |
|
1740 |
self selectFiles:currentSelection. |
|
1741 |
]. |
|
1742 |
! |
|
1743 |
||
3983 | 1744 |
selectFiles:aColOfFilenames |
1745 |
| curSel newSel| |
|
1746 |
||
1747 |
curSel := self selectedFiles. |
|
1748 |
aColOfFilenames size = curSel size ifTrue:[ |
|
1749 |
| index | |
|
1750 |
index := curSel findFirst:[:file| (aColOfFilenames includes:file) not]. |
|
1751 |
index == 0 ifTrue:[ ^ self]. |
|
3887 | 1752 |
]. |
3983 | 1753 |
newSel := OrderedCollection new. |
1754 |
browserItemList do:[: item| |
|
1755 |
(aColOfFilenames includes:(item fileName)) ifTrue:[ |
|
1756 |
newSel add:item. |
|
1757 |
]. |
|
3887 | 1758 |
]. |
4017 | 1759 |
self updateToExternFileHolderLock doLocked:[ |
4071 | 1760 |
self selectionInFileList value:newSel withoutNotifying:self. |
4017 | 1761 |
]. |
3983 | 1762 |
! |
1763 |
||
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1764 |
selectItems:aColOfItems |
4768 | 1765 |
self selectFiles:(aColOfItems collect:[:eachItem | eachItem fileName]). |
1766 |
||
1767 |
"/ | curSel newSel| |
|
1768 |
"/ |
|
1769 |
"/ curSel := self selectedItems. |
|
1770 |
"/ aColOfItems size = curSel size ifTrue:[ |
|
1771 |
"/ | index | |
|
1772 |
"/ index := curSel findFirst:[:item| (aColOfItems includes:item) not]. |
|
1773 |
"/ index == 0 ifTrue:[ ^ self]. |
|
1774 |
"/ ]. |
|
1775 |
"/ newSel := OrderedCollection new. |
|
1776 |
"/ browserItemList do:[: item| |
|
1777 |
"/ (aColOfItems includes:item) ifTrue:[ |
|
1778 |
"/ newSel add:item. |
|
1779 |
"/ ]. |
|
1780 |
"/ ]. |
|
1781 |
"/ self updateToExternFileHolderLock doLocked:[ |
|
1782 |
"/ self selectionInFileList value:newSel withoutNotifying:self. |
|
1783 |
"/ ]. |
|
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1784 |
! |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1785 |
|
3983 | 1786 |
selectedFileItems |
1787 |
||
1788 |
| sel | |
|
1789 |
||
4972 | 1790 |
sel := self selectedItemsWithoutDotDotDirectory select:[:item | item isDirectory not]. |
3987 | 1791 |
^ sel |
1792 |
! |
|
1793 |
||
1794 |
selectedFileNames |
|
1795 |
^ self selectedFileItems collect:[:item| item fileName]. |
|
3887 | 1796 |
! |
1797 |
||
4978
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1798 |
selectedFiles |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1799 |
|
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1800 |
^ self selectedItemsWithoutDotDotDirectory collect:[:item| item fileName]. |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1801 |
! |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1802 |
|
3983 | 1803 |
selectedItems |
4713 | 1804 |
| selection | |
1805 |
||
1806 |
selection := self selectionInFileList value copy. |
|
1807 |
selection isNil ifTrue:[ ^ #()]. |
|
4972 | 1808 |
^ selection. |
1809 |
! |
|
1810 |
||
1811 |
selectedItemsWithoutDotDotDirectory |
|
1812 |
| selection | |
|
1813 |
||
1814 |
selection := self selectionInFileList value copy. |
|
1815 |
selection isNil ifTrue:[ ^ #()]. |
|
4202 | 1816 |
(self viewDirsInContentsBrowser value and:[browserItemList notEmpty]) ifTrue:[ |
4713 | 1817 |
selection removeIdentical:(browserItemList first) ifAbsent:[nil] |
3887 | 1818 |
]. |
4713 | 1819 |
^ selection. |
3887 | 1820 |
! ! |
1821 |
||
4713 | 1822 |
!DirectoryContentsBrowser methodsFor:'startup & release'! |
3887 | 1823 |
|
1824 |
makeDependent |
|
1825 |
||
4007 | 1826 |
super makeDependent. |
3887 | 1827 |
self currentFileNameHolder addDependent:self. |
4027 | 1828 |
self currentSortOrder addDependent:self. |
4202 | 1829 |
self viewDirsInContentsBrowser addDependent:self. |
4011 | 1830 |
self filterBlockHolder addDependent:self. |
3887 | 1831 |
self sortBlockHolder addDependent:self. |
1832 |
! |
|
1833 |
||
1834 |
postBuildBrowser:aWidget |
|
1835 |
||
4713 | 1836 |
browser := aWidget scrolledView. |
1837 |
browser wantsFocusWithPointerEnter. |
|
3887 | 1838 |
"/ dont register icons anymore |
1839 |
"/ FileBrowser icons keysAndValuesDo:[:aKey :anIcon| |
|
1840 |
"/ browser registerImage:anIcon key:aKey. |
|
1841 |
"/ ]. |
|
4960
c76ffd8375ae
startUpdatetask later (after colDescr is fix)
Claus Gittinger <cg@exept.de>
parents:
4957
diff
changeset
|
1842 |
"/ self columnDescriptors:(self tableColumns value). |
4071 | 1843 |
! |
1844 |
||
1845 |
postOpen |
|
1846 |
||
4998 | 1847 |
self sortFileListsBy:(self sortBlockProperty value) withReverse:(self currentSortOrder value). |
4738 | 1848 |
self matchBlock:self filterBlockHolder value. |
4577 | 1849 |
self currentFileNameHolderChangedForCommon. |
4071 | 1850 |
self currentFileNameHolderChanged. |
3887 | 1851 |
self viewedColumnsChanged. |
4960
c76ffd8375ae
startUpdatetask later (after colDescr is fix)
Claus Gittinger <cg@exept.de>
parents:
4957
diff
changeset
|
1852 |
self startUpdateTask. |
4071 | 1853 |
self windowGroup addPreEventHook:self. |
3887 | 1854 |
! |
1855 |
||
1856 |
release |
|
1857 |
"release my resources |
|
1858 |
" |
|
4342 | 1859 |
self stopUpdateTask. |
3887 | 1860 |
super release. |
1861 |
! |
|
1862 |
||
1863 |
releaseAsSubCanvas |
|
1864 |
||
4342 | 1865 |
self stopUpdateTask. |
3887 | 1866 |
^ super releaseAsSubCanvas. |
1867 |
! ! |
|
1868 |
||
4342 | 1869 |
!DirectoryContentsBrowser methodsFor:'update columns cycle'! |
3887 | 1870 |
|
4017 | 1871 |
findNextItemFor:aBlock |
1872 |
||
4342 | 1873 |
^ self allItems detect:aBlock ifNone:[nil]. |
4017 | 1874 |
! |
1875 |
||
1876 |
findNextVisibleItemFor:aConditionBlock |
|
3983 | 1877 |
|vis idx stillSearching | |
1878 |
||
4713 | 1879 |
vis := browser indexOfFirstRowShown. |
3887 | 1880 |
vis = 0 ifTrue:[vis := 1]. |
3983 | 1881 |
|
1882 |
idx := vis. |
|
1883 |
stillSearching := true. |
|
1884 |
[ stillSearching ] whileTrue:[ |
|
4713 | 1885 |
((idx <= browserItemList size) and:[ (browser isRowVisible:idx) ]) ifFalse:[ |
3983 | 1886 |
stillSearching := false. |
1887 |
idx := nil. |
|
1888 |
] ifTrue:[ |
|
1889 |
(aConditionBlock value:(browserItemList at:idx)) ifTrue:[ |
|
1890 |
"/ found a one |
|
1891 |
stillSearching := false. |
|
1892 |
] ifFalse:[ |
|
1893 |
idx := idx + 1. |
|
1894 |
] |
|
1895 |
]. |
|
3887 | 1896 |
]. |
3983 | 1897 |
idx isNil ifTrue:[^ nil]. |
1898 |
^ browserItemList at:idx ifAbsent:nil |
|
3887 | 1899 |
! |
1900 |
||
5010 | 1901 |
getFileInfoFor:anItem |
3887 | 1902 |
|
1903 |
| type| |
|
1904 |
||
5010 | 1905 |
type := anItem fileName fileType. |
1906 |
anItem fileType:type. |
|
3887 | 1907 |
^ type |
1908 |
! |
|
1909 |
||
5010 | 1910 |
getIconFor:anItem |
3887 | 1911 |
|
1912 |
| key icon| |
|
3906 | 1913 |
|
5010 | 1914 |
key := anItem iconKey. |
3887 | 1915 |
icon := FileBrowser iconForKeyMatching:key. |
5010 | 1916 |
anItem isRemoteDirectory ifTrue:[ |
3906 | 1917 |
^ icon "/ do not query attributes |
1918 |
]. |
|
5010 | 1919 |
^ FileBrowser addOnIconsFor:(anItem fileName) to:icon. |
3887 | 1920 |
! |
1921 |
||
5010 | 1922 |
getIconForMimeType:mime for:anItem |
3887 | 1923 |
|
1924 |
| currentIcon newIcon icon| |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
1925 |
newIcon := FileBrowser iconForKeyMatching:mime. |
5010 | 1926 |
currentIcon := anItem icon. |
3887 | 1927 |
(currentIcon class == MultiImage) ifTrue:[ |
1928 |
| images | |
|
1929 |
images := currentIcon images. |
|
1930 |
images removeFirst. |
|
1931 |
images addFirst:newIcon. |
|
1932 |
icon := currentIcon. |
|
1933 |
] ifFalse:[ |
|
1934 |
icon := newIcon. |
|
1935 |
]. |
|
1936 |
^ icon |
|
1937 |
! |
|
1938 |
||
5010 | 1939 |
getIconForMimeTypeByContents:anItem |
1940 |
^ self getIconForMimeType:(anItem mimeTypeForContents) for:anItem |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
1941 |
! |
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
1942 |
|
5010 | 1943 |
getPreviewFor:anItem |
3887 | 1944 |
|
1945 |
| column icon| |
|
1946 |
||
4713 | 1947 |
column := browser columnAt:previewIndex. |
3887 | 1948 |
column isNil ifTrue:[ |
1949 |
previewIndex := 0. |
|
1950 |
] ifFalse:[ |
|
5010 | 1951 |
(anItem hasMimeType and:[anItem mimeType isImage]) ifTrue:[ |
5238 | 1952 |
Error handle:[:ex| |
3887 | 1953 |
icon := nil. |
1954 |
] do:[ |scale extent w h | |
|
5010 | 1955 |
icon := Image fromFile:(anItem fileName pathName). |
3887 | 1956 |
icon notNil ifTrue:[ |
1957 |
extent := icon extent. |
|
1958 |
w := column width - 4. |
|
1959 |
h := column height. |
|
1960 |
||
1961 |
(extent x > w or:[extent y > h]) ifTrue:[ |
|
1962 |
scale := extent / (w@h). |
|
1963 |
scale := scale x max:(scale y). |
|
1964 |
icon := icon magnifiedTo:((extent / scale max:8.0) asInteger). |
|
1965 |
]. |
|
4713 | 1966 |
icon := icon onDevice:(browser device). |
3887 | 1967 |
icon clearMaskedPixels. |
1968 |
] |
|
1969 |
] |
|
1970 |
] ifFalse:[ icon := nil]. |
|
5010 | 1971 |
anItem preview:(icon ? ''). |
3887 | 1972 |
]. |
1973 |
^ icon |
|
1974 |
! |
|
1975 |
||
5010 | 1976 |
updateChangesFor:anItem |
1977 |
||
1978 |
anItem resetItemForChanges. |
|
3887 | 1979 |
! |
1980 |
||
4342 | 1981 |
updateColumnsCycle |
4970 | 1982 |
" update items in the foolowing order |
1983 |
- update item if item properties are changed |
|
1984 |
- update icon for visible items by suffix |
|
1985 |
- update icon for visible items by contents |
|
1986 |
- update file info for visible items if file info column is shown |
|
1987 |
- update preview for visible items if preview column is shown |
|
1988 |
||
1989 |
- update icon for invisible items by suffix |
|
1990 |
- update icon for invisible items by contents |
|
1991 |
- update file info for invisible items if file info column is shown |
|
1992 |
- update preview for invisible items if preview column is shown |
|
1993 |
- update file info for invisible items if file info column is not shown |
|
1994 |
" |
|
3887 | 1995 |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
1996 |
|desc mime icon type preview| |
3887 | 1997 |
|
4017 | 1998 |
browserItemList notEmpty ifTrue:[ |
3887 | 1999 |
"/ update item if item properties are changed |
4017 | 2000 |
desc := self findNextVisibleItemFor:[:n| n hasBeenModified ]. |
4342 | 2001 |
|
3887 | 2002 |
desc notNil ifTrue:[ |
4073 | 2003 |
self updateChangesFor:desc. |
4713 | 2004 |
browser invalidateVisibleRow:desc. |
4342 | 2005 |
self debugMessage:'item properties are changed', desc baseName. |
3887 | 2006 |
^ true. |
2007 |
]. |
|
2008 |
"/ update icon for visible items by suffix |
|
4017 | 2009 |
desc := self findNextVisibleItemFor:[:n| n icon isNil ]. |
3967 | 2010 |
desc notNil ifTrue:[ |
3887 | 2011 |
icon := self getIconFor:desc. |
2012 |
desc icon:icon. |
|
2013 |
(icon notNil and:[iconIndex ~~ 0]) ifTrue:[ |
|
4713 | 2014 |
browser invalidateVisibleRow:desc colAt:iconIndex |
3887 | 2015 |
]. |
4342 | 2016 |
self debugMessage:'icon for visible items by suffix', desc baseName. |
3887 | 2017 |
^ true |
2018 |
]. |
|
2019 |
"/ update icon for visible items by contents |
|
4017 | 2020 |
desc := self findNextVisibleItemFor:[:n| |
3967 | 2021 |
(n iconKey == #file |
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2022 |
and:[(mime := n mimeTypeForContents asSymbol) ~= #unknown]) |
3967 | 2023 |
]. |
2024 |
desc notNil ifTrue:[ |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2025 |
icon := self getIconForMimeType:mime for:desc. |
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2026 |
"/ icon := self getIconForMimeTypeByContents:desc. |
3967 | 2027 |
desc icon:icon. |
2028 |
(icon notNil and:[iconIndex ~~ 0]) ifTrue:[ |
|
4713 | 2029 |
browser invalidateVisibleRow:desc colAt:iconIndex |
3967 | 2030 |
]. |
2031 |
^ true |
|
2032 |
]. |
|
3887 | 2033 |
"/ update file info for visible items if file info column is shown |
2034 |
fileDescriptionIndex ~~ 0 ifTrue:[ |
|
4345 | 2035 |
desc := self findNextVisibleItemFor:[:n| n fileType isEmpty ]. |
3887 | 2036 |
desc notNil ifTrue:[ |
2037 |
type := self getFileInfoFor:desc. |
|
4713 | 2038 |
type notNil ifTrue:[browser invalidateVisibleRow:desc colAt:fileDescriptionIndex]. |
4342 | 2039 |
self debugMessage:'file info for visible items if file info column is shown', desc baseName. |
3887 | 2040 |
^ true |
2041 |
] |
|
2042 |
]. |
|
2043 |
"/ update preview for visible items if preview column is shown |
|
2044 |
previewIndex ~~ 0 ifTrue:[ |
|
4017 | 2045 |
desc := self findNextVisibleItemFor:[:n| n preview isNil ]. |
3887 | 2046 |
desc notNil ifTrue:[ |
2047 |
preview := self getPreviewFor:desc. |
|
2048 |
preview notNil ifTrue:[ |
|
4713 | 2049 |
browser invalidateVisibleRow:desc colAt:previewIndex |
3887 | 2050 |
]. |
4342 | 2051 |
self debugMessage:'preview for visible items if preview column is shown', desc baseName. |
3887 | 2052 |
^ true |
2053 |
] |
|
2054 |
]. |
|
2055 |
]. |
|
2056 |
||
4349 | 2057 |
"/ validate invisible items to make them available after scrolling |
4342 | 2058 |
self allItems notEmpty ifTrue:[ |
3887 | 2059 |
"/ update icon for invisible items by suffix |
2060 |
desc := self findNextItemFor:[:n| n icon isNil ]. |
|
2061 |
desc notNil ifTrue:[ |
|
2062 |
icon := self getIconFor:desc. |
|
2063 |
desc icon:icon. |
|
4342 | 2064 |
self debugMessage:'icon for invisible items by suffix', desc baseName. |
3887 | 2065 |
^ true |
2066 |
]. |
|
2067 |
"/ update icon for invisible items by contents |
|
2068 |
desc := self findNextItemFor:[:n| (n iconKey == #file and:[n mimeTypeForContents ~= #unknown])]. |
|
2069 |
desc notNil ifTrue:[ |
|
2070 |
icon := self getIconForMimeTypeByContents:desc. |
|
2071 |
desc icon:icon. |
|
4342 | 2072 |
self debugMessage:'icon for invisible items by contents', desc baseName. |
3887 | 2073 |
^ true |
2074 |
]. |
|
2075 |
"/ update file info for invisible items if file info column is shown |
|
2076 |
fileDescriptionIndex ~~ 0 ifTrue:[ |
|
2077 |
desc := self findNextItemFor:[:n| n fileType isNil ]. |
|
2078 |
desc notNil ifTrue:[ |
|
2079 |
self getFileInfoFor:desc. |
|
4342 | 2080 |
self debugMessage:'update file info for invisible items if file info column is shown', desc baseName. |
3887 | 2081 |
^ true |
2082 |
]. |
|
2083 |
]. |
|
2084 |
"/ update preview for invisible items if preview column is shown |
|
2085 |
previewIndex ~~ 0 ifTrue:[ |
|
2086 |
desc := self findNextItemFor:[:n| n preview isNil ]. |
|
2087 |
desc notNil ifTrue:[ |
|
2088 |
self getPreviewFor:desc. |
|
4342 | 2089 |
self debugMessage:'update preview for invisible items if preview column is shown:', desc baseName. |
3887 | 2090 |
^ true |
2091 |
]. |
|
2092 |
]. |
|
2093 |
"/ update file info for invisible items if file info column is not shown |
|
2094 |
desc := self findNextItemFor:[:n| n fileType isNil ]. |
|
2095 |
desc notNil ifTrue:[ |
|
2096 |
self getFileInfoFor:desc. |
|
4342 | 2097 |
self debugMessage:'update file info for invisible items if file info column is not shown:', desc baseName. |
3887 | 2098 |
^ true |
2099 |
]. |
|
2100 |
]. |
|
2101 |
^ false |
|
4342 | 2102 |
! ! |
2103 |
||
2104 |
!DirectoryContentsBrowser methodsFor:'update modification cycle'! |
|
2105 |
||
2106 |
modificationCycle |
|
2107 |
||
2108 |
| oldModificationTime | |
|
2109 |
directory notNil ifTrue:[ |
|
2110 |
directory exists not ifTrue:[ |
|
2111 |
self directoryChangeFlag:true. |
|
2112 |
^ self |
|
2113 |
]. |
|
2114 |
oldModificationTime := modificationTime. |
|
2115 |
modificationTime := directory modificationTime. |
|
2116 |
(directory notNil and:[oldModificationTime ~= directory modificationTime]) ifTrue:[ |
|
2117 |
self wakeUpForDirectoryContentsChanged. |
|
2118 |
]. |
|
2119 |
]. |
|
2120 |
! ! |
|
2121 |
||
2122 |
!DirectoryContentsBrowser methodsFor:'update task'! |
|
2123 |
||
4346 | 2124 |
createItemList |
4342 | 2125 |
|
2126 |
"/ |filterTime sortTime getAllTime| |
|
2127 |
||
2128 |
directory notNil ifTrue:[ |
|
2129 |
modificationTime := directory modificationTime. |
|
2130 |
"/ getAllTime := Time millisecondsToRun:[ |
|
2131 |
self allItems:self readDirectoryItems. |
|
2132 |
"/ ]. |
|
2133 |
"/ filterTime := Time millisecondsToRun:[ |
|
2134 |
filteredItems := self evaluateFilter:(self allItems). |
|
2135 |
"/ ]. |
|
2136 |
"/ sortTime := Time millisecondsToRun:[ |
|
2137 |
filteredItems sort:self sortBlockHolder value. |
|
2138 |
"/ ]. |
|
2139 |
"/ Transcript showCR:'getAllTime:', getAllTime asString. |
|
2140 |
"/ Transcript showCR:'filterTime:', filterTime asString. |
|
2141 |
"/ Transcript showCR:'sortTime:', sortTime asString. |
|
2142 |
"/ Transcript showCR:'time after sort', AbsoluteTime now asString. |
|
2143 |
] ifFalse:[ |
|
2144 |
self allItems:OrderedCollection new. |
|
2145 |
filteredItems := OrderedCollection new. |
|
2146 |
]. |
|
2147 |
self |
|
2148 |
enqueueMessage:#value |
|
4757 | 2149 |
for:[ self setBrowserItemList:filteredItems ] |
4342 | 2150 |
arguments:#(). |
2151 |
! |
|
2152 |
||
4346 | 2153 |
debugMessage:aString |
2154 |
||
2155 |
self class debug ifTrue:[ |
|
2156 |
Transcript showCR:aString |
|
2157 |
]. |
|
2158 |
! |
|
2159 |
||
2160 |
directoryChanged |
|
2161 |
||
2162 |
self setBrowserItemList:#(). |
|
2163 |
self createItemList. |
|
2164 |
! |
|
2165 |
||
4342 | 2166 |
directoryContentsChanged |
2167 |
||
2168 |
|oldItems addItems remItems newItems newAllItems theAllItems| |
|
2169 |
||
2170 |
directory isNil ifTrue:[^ self]. |
|
2171 |
modificationTime := directory modificationTime. |
|
2172 |
newAllItems := self readDirectoryItems. |
|
4346 | 2173 |
newAllItems size > 150 ifTrue:[ |
2174 |
self createItemList. |
|
2175 |
^ self |
|
2176 |
]. |
|
4342 | 2177 |
newItems := self evaluateFilter:newAllItems. |
2178 |
oldItems := filteredItems copy. |
|
2179 |
addItems := OrderedCollection new. |
|
2180 |
remItems := OrderedCollection new. |
|
2181 |
filteredItems size == 0 ifTrue:[ |
|
2182 |
remItems := oldItems. |
|
2183 |
] ifFalse:[ |
|
2184 |
"/ MERGE WITH CURRENT CONTENTS |
|
4894 | 2185 |
oldItems copy do:[:anOldItem| |
4342 | 2186 |
"/ remove no longer valid files |
2187 |
(newItems detectLast:[:aNewItem| aNewItem = anOldItem] ifNone:nil) isNil ifTrue:[ |
|
2188 |
remItems add:anOldItem. |
|
2189 |
oldItems removeIdentical:anOldItem |
|
2190 |
] |
|
2191 |
]. |
|
2192 |
]. |
|
2193 |
"/ add new files |
|
2194 |
newItems do:[:aNewItem| |
|
2195 |
(oldItems detect:[:anOldItem| anOldItem = aNewItem] ifNone:nil) isNil ifTrue:[ |
|
2196 |
addItems add:aNewItem. |
|
2197 |
] |
|
2198 |
]. |
|
2199 |
theAllItems := self allItems. |
|
2200 |
remItems notEmpty ifTrue:[ |
|
2201 |
theAllItems removeAll:remItems |
|
2202 |
]. |
|
2203 |
addItems do:[: aNewItem | |
|
2204 |
(theAllItems includes:aNewItem) not ifTrue:[ |
|
2205 |
theAllItems add:aNewItem. |
|
2206 |
] |
|
2207 |
]. |
|
2208 |
||
2209 |
self |
|
2210 |
enqueueMessage:#value |
|
4757 | 2211 |
for:[ self browserItemListAdd:addItems remove:remItems. ] |
4342 | 2212 |
arguments:#(). |
2213 |
filteredItems := newItems. |
|
2214 |
! |
|
2215 |
||
5010 | 2216 |
evaluateFilter:anItemsList |
4342 | 2217 |
|
2218 |
|showDir filterBlock newItemList noOfAddedFiles noOfFiles| |
|
2219 |
||
2220 |
newItemList := OrderedCollection new. |
|
2221 |
noOfFiles := 0. |
|
2222 |
noOfAddedFiles := 0. |
|
2223 |
showDir := self viewDirsInContentsBrowser value. |
|
2224 |
filterBlock := self matchBlock. |
|
5010 | 2225 |
anItemsList size ~~ 0 ifTrue:[ |
2226 |
anItemsList do:[:eachItem | |isDir| |
|
2227 |
isDir := eachItem isDirectory. |
|
4342 | 2228 |
isDir not ifTrue:[noOfFiles := noOfFiles + 1]. |
5010 | 2229 |
((isDir and:[showDir]) or:[isDir not and:[filterBlock value:eachItem baseName]]) ifTrue:[ |
4342 | 2230 |
isDir not ifTrue:[noOfAddedFiles := noOfAddedFiles + 1]. |
5010 | 2231 |
newItemList add:eachItem |
4648 | 2232 |
]. |
4298 | 2233 |
]. |
4342 | 2234 |
]. |
2235 |
self noOfAddedFiles:noOfAddedFiles noOfFiles:noOfFiles. |
|
2236 |
^ newItemList |
|
2237 |
! |
|
2238 |
||
2239 |
filterChanged |
|
2240 |
||
2241 |
filteredItems := self evaluateFilter:self allItems copy. |
|
2242 |
filteredItems sort:self sortBlockHolder value. |
|
2243 |
self |
|
2244 |
enqueueMessage:#value |
|
4757 | 2245 |
for:[ self setBrowserItemList:filteredItems ] |
4342 | 2246 |
arguments:nil. |
2247 |
! |
|
2248 |
||
2249 |
readDirectoryItems |
|
2250 |
| list contents| |
|
2251 |
||
2252 |
list := OrderedCollection new. |
|
4768 | 2253 |
(directory notNil and:[directory exists]) ifTrue:[ |
4342 | 2254 |
contents := DirectoryContents directoryNamed:directory. |
5010 | 2255 |
contents itemsDo:[:eachItem| |
2256 |
list add:(DirectoryContentsBrowser itemClass forInfoItem:eachItem). |
|
4298 | 2257 |
]. |
4342 | 2258 |
]. |
2259 |
^ list |
|
2260 |
! |
|
2261 |
||
2262 |
sortBlockChanged |
|
2263 |
||
2264 |
filteredItems isNil ifTrue:[ ^ self]. |
|
2265 |
filteredItems sort:self sortBlockHolder value. |
|
2266 |
self |
|
2267 |
enqueueMessage:#value |
|
4757 | 2268 |
for:[ self setBrowserItemList:filteredItems ] |
4342 | 2269 |
arguments:nil. |
2270 |
! |
|
2271 |
||
2272 |
startUpdateTask |
|
2273 |
updateTask isNil ifTrue:[ |
|
4370 | 2274 |
updateTask := [ |
2275 |
[true] whileTrue:[ |
|
2276 |
self updateStep |
|
2277 |
] |
|
2278 |
] newProcess. |
|
4342 | 2279 |
updateTask name:'DirectoryContentsBrowser updateTask'. |
2280 |
updateTask priorityRange:(Processor systemBackgroundPriority to:Processor activePriority). |
|
4370 | 2281 |
updateTask restartable:true. |
4342 | 2282 |
updateTask resume. |
2283 |
]. |
|
2284 |
! |
|
2285 |
||
2286 |
stopUpdateTask |
|
2287 |
||
2288 |
updateTask notNil ifTrue:[ |
|
2289 |
updateTask terminate. |
|
2290 |
]. |
|
2291 |
! |
|
2292 |
||
2293 |
updateBlock |
|
2294 |
||
2295 |
^ [ : timeOut | |
|
2296 |
"/ Transcript showCR:'START'. |
|
2297 |
self isBusy:true. |
|
2298 |
[ |
|
2299 |
self directoryChangeFlag ifTrue:[ |
|
2300 |
self directoryChangeFlag:false. |
|
2301 |
self debugMessage:'directoryChanged'. |
|
2302 |
self directoryChanged. |
|
2303 |
]. |
|
2304 |
self directoryContentsChangeFlag ifTrue:[ |
|
2305 |
self directoryContentsChangeFlag:false. |
|
2306 |
self debugMessage:'directoryContentsChanged'. |
|
2307 |
self directoryContentsChanged. |
|
2308 |
]. |
|
2309 |
self filterChangeFlag ifTrue:[ |
|
2310 |
self filterChangeFlag:false. |
|
2311 |
self debugMessage:'filterChanged'. |
|
2312 |
self filterChanged. |
|
2313 |
]. |
|
2314 |
self sortBlockChangeFlag ifTrue:[ |
|
2315 |
self sortBlockChangeFlag:false. |
|
2316 |
self debugMessage:'sortBlockChanged'. |
|
2317 |
self sortBlockChanged. |
|
2318 |
]. |
|
2319 |
timeOut ifTrue:[ |
|
2320 |
self debugMessage:'evaluate modification'. |
|
2321 |
self modificationCycle |
|
2322 |
]. |
|
2323 |
self updateColumnsCycle ifTrue:[ |
|
2324 |
self debugMessage:'next time another columns update'. |
|
2325 |
self changeSema signal |
|
2326 |
]. |
|
2327 |
] ensure:[ |
|
2328 |
self isBusy:false. |
|
2329 |
]. |
|
2330 |
"/ Transcript showCR:'STOP'. |
|
4298 | 2331 |
] |
2332 |
! |
|
2333 |
||
4370 | 2334 |
updateStep |
2335 |
AbortSignal handle:[ |
|
4607 | 2336 |
self debugMessage:'got an abort signal'. |
4370 | 2337 |
self directoryContentsChangeFlag:false. |
2338 |
self filterChangeFlag:false. |
|
2339 |
self sortBlockChangeFlag:false. |
|
2340 |
] do:[ |
|
4607 | 2341 |
| timedOut | |
2342 |
||
4370 | 2343 |
self debugMessage:'sema wait'. |
4607 | 2344 |
timedOut := (self changeSema waitWithTimeoutMs:(self class updateTaskCyleTime)) isNil. |
2345 |
self debugMessage:'timedOut:', timedOut asString. |
|
2346 |
||
2347 |
(self filterChangeFlag |
|
2348 |
or:[self sortBlockChangeFlag |
|
2349 |
or:[self directoryChangeFlag]]) ifTrue:[ |
|
2350 |
self withCursor:Cursor execute do:[ |
|
2351 |
self updateBlock value:timedOut. |
|
2352 |
] |
|
4370 | 2353 |
] ifFalse:[ |
4607 | 2354 |
self updateBlock value:timedOut. |
3887 | 2355 |
] |
4342 | 2356 |
] |
2357 |
! ! |
|
2358 |
||
4862 | 2359 |
!DirectoryContentsBrowser methodsFor:'update task trigger'! |
2360 |
||
2361 |
wakeUp |
|
2362 |
||
2363 |
self changeSema signal. |
|
2364 |
! |
|
2365 |
||
2366 |
wakeUpForDirectoryChanged |
|
2367 |
||
2368 |
self isBusy ifTrue:[ |
|
2369 |
updateTask interruptWith:[AbortSignal raise]. |
|
2370 |
]. |
|
2371 |
self directoryChangeFlag:true. |
|
2372 |
self wakeUp. |
|
2373 |
! |
|
2374 |
||
2375 |
wakeUpForDirectoryContentsChanged |
|
2376 |
||
2377 |
self directoryContentsChangeFlag:true. |
|
2378 |
self wakeUp. |
|
2379 |
! |
|
2380 |
||
2381 |
wakeUpForFilterChanged |
|
2382 |
||
2383 |
self filterChangeFlag:true. |
|
2384 |
self wakeUp. |
|
2385 |
! |
|
2386 |
||
2387 |
wakeUpForSortBlockChanged |
|
2388 |
||
2389 |
self sortBlockChangeFlag:true. |
|
2390 |
self wakeUp. |
|
2391 |
! ! |
|
2392 |
||
2393 |
!DirectoryContentsBrowser methodsFor:'update task-disk usage'! |
|
4555 | 2394 |
|
2395 |
diskUsageInKiloBytesFor:aDirectory |
|
2396 |
|line kb| |
|
2397 |
||
2398 |
OperatingSystem isUNIXlike ifTrue:[ |
|
2399 |
line := OperatingSystem getCommandOutputFrom:('du -s -k ' , aDirectory pathName). |
|
4559 | 2400 |
line notNil ifTrue:[ |
2401 |
kb := Number readFrom:line readStream. |
|
2402 |
]. |
|
4555 | 2403 |
^ kb |
2404 |
]. |
|
2405 |
||
2406 |
^ nil "/ unknown - for now. |
|
2407 |
! |
|
2408 |
||
4781 | 2409 |
flushRememberedDiskUsageInfo |
2410 |
diskUsageInfo := nil. |
|
2411 |
! |
|
2412 |
||
4782 | 2413 |
flushRememberedDiskUsageInfoFor:aDirectory |
2414 |
|dirPath keysToRemove| |
|
2415 |
||
4783 | 2416 |
diskUsageInfo isNil ifTrue:[ ^ self ]. |
2417 |
||
4782 | 2418 |
dirPath := aDirectory pathName. |
2419 |
keysToRemove := diskUsageInfo keys |
|
2420 |
select:[:key | |
|
2421 |
key startsWith:dirPath |
|
2422 |
]. |
|
2423 |
diskUsageInfo removeAllKeys:keysToRemove. |
|
2424 |
! |
|
2425 |
||
4781 | 2426 |
isDiskUsageInfoStillValid:infoForDirectory for:aDirectoryPath |
4556 | 2427 |
|diskUsageRememberTime infoTimestamp infoKiloBytes infoMegaBytes| |
2428 |
||
2429 |
diskUsageRememberTime := 30. |
|
2430 |
||
2431 |
infoTimestamp := infoForDirectory key. |
|
2432 |
infoKiloBytes := infoForDirectory value. |
|
2433 |
infoMegaBytes := infoKiloBytes // 1024. |
|
2434 |
||
2435 |
"/ only update info every 30 seconds |
|
2436 |
"/ plus another second for every 5 megabytes |
|
2437 |
"/ (i.e. for 100 mb, keep info for 50seconds) |
|
2438 |
||
2439 |
diskUsageRememberTime := diskUsageRememberTime + (infoMegaBytes / 5). "/ another second for every megabyte |
|
2440 |
||
4600
c26a0661b57c
subtracting times - do not depend on seconds to be returned
Claus Gittinger <cg@exept.de>
parents:
4577
diff
changeset
|
2441 |
(AbsoluteTime now getSeconds - infoTimestamp getSeconds) > diskUsageRememberTime ifTrue:[ |
4556 | 2442 |
^ false |
2443 |
]. |
|
4781 | 2444 |
"/ (aDirectoryPath asFilename modificationTime > infoTimestamp) ifTrue:[ |
2445 |
"/ ^ false |
|
2446 |
"/ ]. |
|
4556 | 2447 |
^ true |
2448 |
! |
|
2449 |
||
4555 | 2450 |
showDiskUsageInfoFor:aDirectory as:kiloBytes |
2451 |
|kbString| |
|
2452 |
||
2453 |
kbString := UnitConverter fileSizeStringFor:(kiloBytes * 1024). |
|
2454 |
self notify:('%2 in %1' |
|
2455 |
bindWith:(aDirectory baseName "pathName" allBold) |
|
2456 |
with:(kbString , 'b') "allBold"). |
|
2457 |
! |
|
2458 |
||
4781 | 2459 |
startDiskUsageInfoProcess |
2460 |
|aColOfFiles selectedFile| |
|
2461 |
||
2462 |
aColOfFiles := self currentFileNameHolder value. |
|
2463 |
(aColOfFiles isEmpty or:[self currentFilesAreInSameDirectory not]) ifTrue:[ |
|
2464 |
^ self |
|
2465 |
]. |
|
2466 |
aColOfFiles size == 1 ifTrue:[ |
|
2467 |
selectedFile := aColOfFiles first. |
|
2468 |
selectedFile isSymbolicLink ifTrue:[ |
|
2469 |
self notify:'Symbolic link to: ' , (selectedFile linkInfo at:#path) allBold |
|
2470 |
] ifFalse:[ |
|
2471 |
self startDiskUsageInfoProcessFor:selectedFile. |
|
2472 |
]. |
|
2473 |
]. |
|
2474 |
! |
|
2475 |
||
4555 | 2476 |
startDiskUsageInfoProcessFor:selectedFile |
4556 | 2477 |
|directory dirPath infoForDirectory infoValue| |
4555 | 2478 |
|
2479 |
self showDiskUsageHolder value ifFalse:[^ self]. |
|
2480 |
||
2481 |
OperatingSystem isUNIXlike ifFalse:[ |
|
2482 |
^ self. "/ not yet implemented - see diskUsageInKiloBytesFor: |
|
2483 |
]. |
|
2484 |
||
2485 |
selectedFile isDirectory ifTrue:[ |
|
2486 |
directory := selectedFile |
|
2487 |
] ifFalse:[ |
|
2488 |
directory := selectedFile directory |
|
2489 |
]. |
|
2490 |
||
2491 |
dirPath := directory pathName. |
|
2492 |
diskUsageInfo isNil ifTrue:[ |
|
2493 |
diskUsageInfo := Dictionary new. |
|
2494 |
]. |
|
2495 |
infoForDirectory := diskUsageInfo at:dirPath ifAbsent:nil. |
|
2496 |
infoForDirectory notNil ifTrue:[ |
|
4781 | 2497 |
(self isDiskUsageInfoStillValid:infoForDirectory for:dirPath) ifTrue:[ |
4556 | 2498 |
infoValue := infoForDirectory value. |
4555 | 2499 |
]. |
2500 |
]. |
|
2501 |
||
2502 |
infoValue notNil ifTrue:[ |
|
2503 |
self showDiskUsageInfoFor:directory as:infoValue. |
|
2504 |
^ self. |
|
2505 |
]. |
|
2506 |
||
2507 |
diskUsageUpdateProcess notNil ifTrue:[ |
|
2508 |
diskUsageUpdateProcess terminate |
|
2509 |
]. |
|
2510 |
diskUsageUpdateProcess := |
|
2511 |
[ |
|
2512 |
|kiloBytes| |
|
2513 |
||
2514 |
self notify:('collecting disk usage of %1...' bindWith:directory baseName). |
|
2515 |
kiloBytes := self diskUsageInKiloBytesFor:directory. |
|
4559 | 2516 |
kiloBytes notNil ifTrue:[ |
2517 |
diskUsageInfo at:dirPath put:(AbsoluteTime now -> kiloBytes). |
|
2518 |
self showDiskUsageInfoFor:directory as:kiloBytes. |
|
2519 |
] |
|
4555 | 2520 |
] fork. |
2521 |
! ! |
|
2522 |
||
3887 | 2523 |
!DirectoryContentsBrowser::DirectoryContentsItem class methodsFor:'instance creation'! |
2524 |
||
3983 | 2525 |
fileName:aFilename |
2526 |
||
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2527 |
| instance fileItem| |
3983 | 2528 |
instance := self new. |
2529 |
aFilename asString = '..' ifTrue:[ |
|
2530 |
instance fileName:aFilename. |
|
2531 |
^ instance. |
|
2532 |
]. |
|
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2533 |
fileItem := DirectoryContents contentsItemForFileName:aFilename. |
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2534 |
fileItem notNil ifTrue:[^ self forInfoItem:fileItem]. |
3983 | 2535 |
^ nil |
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2536 |
|
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2537 |
" |
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2538 |
DirectoryContentsItem fileName:'..' |
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2539 |
" |
3983 | 2540 |
! |
2541 |
||
2542 |
forInfoItem:anItem |
|
3887 | 2543 |
| instance | |
2544 |
instance := self new. |
|
3983 | 2545 |
instance fileName:anItem fileName. |
2546 |
anItem isRemoteDirectory ifTrue:[ |
|
2547 |
instance beRemoteDirectory. |
|
2548 |
] ifFalse:[ |
|
2549 |
instance fileInfo:anItem info. |
|
2550 |
]. |
|
3906 | 2551 |
^ instance |
3887 | 2552 |
! ! |
2553 |
||
2554 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'accessing'! |
|
2555 |
||
3983 | 2556 |
fileInfo:something |
2557 |
"set the value of the instance variable 'fileInfo' (automatically generated)" |
|
2558 |
||
2559 |
fileInfo := something. |
|
2560 |
! |
|
2561 |
||
3887 | 2562 |
fileName |
2563 |
"returns the fileName |
|
2564 |
" |
|
2565 |
^ fileName |
|
4023 | 2566 |
|
2567 |
||
3887 | 2568 |
! |
2569 |
||
2570 |
fileName:aFilename |
|
2571 |
"set fileName for instance |
|
2572 |
" |
|
4101 | 2573 |
fileName := aFilename asFilename. |
3887 | 2574 |
! |
2575 |
||
2576 |
fileType |
|
2577 |
"returns the type of the file |
|
2578 |
" |
|
4345 | 2579 |
fileType isNil ifTrue:[ |
2580 |
fileType := ''. |
|
2581 |
]. |
|
3887 | 2582 |
^ fileType |
2583 |
! |
|
2584 |
||
2585 |
fileType:aType |
|
2586 |
"returns the type of the file |
|
2587 |
" |
|
2588 |
||
2589 |
fileType := aType. |
|
2590 |
! |
|
2591 |
||
2592 |
icon |
|
2593 |
"returns the icon assigned to the file |
|
2594 |
" |
|
2595 |
^ icon |
|
2596 |
||
2597 |
||
2598 |
! |
|
2599 |
||
2600 |
icon:anIcon |
|
2601 |
||
2602 |
icon := anIcon. |
|
2603 |
! |
|
2604 |
||
2605 |
iconKey |
|
2606 |
"return the value of the instance variable 'iconKey' (automatically generated)" |
|
2607 |
||
2608 |
iconKey isNil ifTrue:[ |
|
3906 | 2609 |
self isRemoteDirectory ifTrue:[ |
2610 |
iconKey := FileBrowser iconKeyForRemoteDirectory:fileName. |
|
2611 |
] ifFalse:[ |
|
2612 |
iconKey := FileBrowser iconKeyForFile:fileName. |
|
2613 |
] |
|
3887 | 2614 |
]. |
2615 |
^ iconKey |
|
2616 |
! |
|
2617 |
||
2618 |
isDirectory |
|
3967 | 2619 |
self isRemoteDirectory ifTrue:[^ true]. |
2620 |
||
2621 |
self getFileInfo. |
|
2622 |
fileInfo isNil ifTrue:[^ false]. |
|
2623 |
^ fileInfo isDirectory |
|
2624 |
! |
|
3887 | 2625 |
|
3967 | 2626 |
isSymbolicLink |
2627 |
self isRemoteDirectory ifTrue:[^ false]. |
|
2628 |
||
2629 |
self getFileInfo. |
|
2630 |
fileInfo isNil ifTrue:[^ false]. |
|
2631 |
^ fileInfo isSymbolicLink |
|
3887 | 2632 |
! |
2633 |
||
2634 |
lastButOneSuffix |
|
2635 |
"returns the suffix of the file |
|
2636 |
" |
|
2637 |
||
2638 |
^ self suffixes at:2 |
|
2639 |
! |
|
2640 |
||
2641 |
lastSuffix |
|
2642 |
"returns the suffix of the file |
|
2643 |
" |
|
2644 |
||
2645 |
^ self suffixes at:1 |
|
2646 |
! |
|
2647 |
||
4988 | 2648 |
linkTargetIsDirectory |
2649 |
self isSymbolicLink ifFalse:[^ false]. |
|
2650 |
||
2651 |
^ fileName info isDirectory |
|
2652 |
! |
|
2653 |
||
3887 | 2654 |
mimeType |
2655 |
mimeType isNil ifTrue:[ |
|
2656 |
mimeType := MIMETypes mimeTypeForFilename:(self fileName). |
|
2657 |
mimeType isNil ifTrue:[ |
|
2658 |
mimeType := #unknown |
|
2659 |
] |
|
2660 |
]. |
|
2661 |
^ mimeType |
|
2662 |
! |
|
2663 |
||
2664 |
preview |
|
2665 |
||
2666 |
^ preview |
|
2667 |
! |
|
2668 |
||
2669 |
preview:aLabel |
|
2670 |
||
2671 |
preview := aLabel. |
|
2672 |
! |
|
2673 |
||
2674 |
suffix |
|
2675 |
"returns the suffix of the file |
|
2676 |
" |
|
4017 | 2677 |
self isDirectory ifTrue:[^'']. |
3887 | 2678 |
suffix isNil ifTrue:[ |
2679 |
(OperatingSystem isUNIXlike and:[(self baseName at:1) == $.]) ifTrue:[ |
|
2680 |
suffix := ''. |
|
2681 |
] ifFalse:[ |
|
2682 |
suffix := fileName suffix. |
|
2683 |
] |
|
2684 |
]. |
|
2685 |
^ suffix |
|
2686 |
! |
|
2687 |
||
2688 |
suffixes |
|
2689 |
||
2690 |
| lastSuff lastButOneSuff| |
|
2691 |
||
3967 | 2692 |
(fileName name occurrencesOf:$.) <= 1 ifTrue:[ |
2693 |
^ Array with:(self suffix) with:nil. |
|
2694 |
]. |
|
2695 |
(fileName baseName occurrencesOf:$.) <= 1 ifTrue:[ |
|
2696 |
^ Array with:(self suffix) with:nil. |
|
2697 |
]. |
|
3887 | 2698 |
|
3967 | 2699 |
((lastSuff := self suffix) isEmpty) ifTrue:[ |
2700 |
lastSuff := nil. |
|
2701 |
] ifFalse:[ |
|
2702 |
lastSuff := lastSuff asLowercase. |
|
2703 |
]. |
|
2704 |
||
2705 |
((lastButOneSuff := fileName withoutSuffix suffix) isEmpty) ifTrue:[ |
|
2706 |
lastButOneSuff := nil. |
|
2707 |
] ifFalse:[ |
|
2708 |
lastButOneSuff := lastButOneSuff asLowercase. |
|
2709 |
]. |
|
2710 |
||
2711 |
(lastSuff notNil and:[lastButOneSuff notNil]) ifTrue:[ |
|
2712 |
(lastSuff = 'bak' or:[lastSuff = 'sav']) ifTrue:[ |
|
2713 |
lastSuff := lastButOneSuff. |
|
3887 | 2714 |
lastButOneSuff := nil. |
3967 | 2715 |
] |
3887 | 2716 |
]. |
3967 | 2717 |
^ Array with:lastSuff with:lastButOneSuff |
3887 | 2718 |
! |
2719 |
||
2720 |
type |
|
2721 |
"returns the type of the file |
|
2722 |
" |
|
2723 |
^ self valueAt:#type |
|
2724 |
||
2725 |
! ! |
|
2726 |
||
2727 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'actions'! |
|
2728 |
||
2729 |
resetImageFile |
|
2730 |
||
2731 |
" if the image preview extent is changed the icon will set to nil to force the update task to reload the image " |
|
2732 |
||
2733 |
(mimeType notNil and:[ mimeType isImage]) ifTrue:[ |
|
2734 |
preview := nil |
|
2735 |
] |
|
2736 |
! |
|
2737 |
||
3983 | 2738 |
resetItemForChanges |
3887 | 2739 |
|
2740 |
" dont know what someone else is doing with the file - read all item properties new " |
|
2741 |
fileInfo := nil. |
|
2742 |
icon := nil. |
|
2743 |
fileType := nil. |
|
2744 |
preview := nil. |
|
2745 |
owner := nil. |
|
2746 |
group := nil. |
|
4073 | 2747 |
iconKey := nil. |
2748 |
mimeTypeForContents := nil. |
|
2749 |
mimeType := nil. |
|
3887 | 2750 |
! ! |
2751 |
||
2752 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'change queries'! |
|
2753 |
||
3967 | 2754 |
hasBeenModified |
3887 | 2755 |
|
2756 |
"check if item modification time is changed |
|
2757 |
" |
|
2758 |
| time info| |
|
2759 |
||
3906 | 2760 |
self isRemoteDirectory ifTrue:[^ false]. |
2761 |
||
3967 | 2762 |
info := fileName info. |
3887 | 2763 |
info isNil ifTrue:[ ^ false]. |
3962
3906b10c42fd
modified -> modificationTime
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
2764 |
time := info modificationTime. |
3967 | 2765 |
|
3887 | 2766 |
contentsBrowserChangeModificationTime isNil ifTrue:[ |
2767 |
contentsBrowserChangeModificationTime := time. |
|
3967 | 2768 |
fileInfo := nil. |
3887 | 2769 |
^ false. |
2770 |
]. |
|
2771 |
((contentsBrowserChangeModificationTime = time) not) ifTrue:[ |
|
2772 |
contentsBrowserChangeModificationTime := time. |
|
3967 | 2773 |
fileInfo := nil. |
3887 | 2774 |
^ true |
2775 |
]. |
|
2776 |
^ false |
|
2777 |
! ! |
|
2778 |
||
2779 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'compare'! |
|
2780 |
||
5010 | 2781 |
= anItem |
2782 |
||
2783 |
"/ Transcript showCR:(anItem species == self species). |
|
2784 |
anItem species == self species ifFalse:[ ^ false]. |
|
2785 |
anItem isNil ifTrue:[ ^ false]. |
|
2786 |
^ (self fileName = anItem fileName) |
|
3887 | 2787 |
! |
2788 |
||
2789 |
hash |
|
2790 |
^ fileName hash |
|
2791 |
! ! |
|
2792 |
||
2793 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'presentation'! |
|
2794 |
||
2795 |
baseName |
|
2796 |
"returns the baseName of the file |
|
2797 |
" |
|
3967 | 2798 |
^ fileName baseName. |
3887 | 2799 |
! |
2800 |
||
2801 |
baseNameWithOutSuffix |
|
2802 |
"returns the baseName of the file |
|
2803 |
" |
|
2804 |
| baseNameWithOutSuff | |
|
2805 |
||
4017 | 2806 |
self isDirectory ifTrue:[^ self baseName]. |
3887 | 2807 |
baseNameWithOutSuff := self baseName asFilename withoutSuffix asString. |
4017 | 2808 |
(baseNameWithOutSuff isEmpty or:[baseNameWithOutSuff = '.']) ifTrue:[ |
3887 | 2809 |
^ self baseName |
2810 |
]. |
|
2811 |
^ baseNameWithOutSuff. |
|
2812 |
! |
|
2813 |
||
2814 |
date |
|
3967 | 2815 |
"returns the modTimeString |
3887 | 2816 |
" |
2817 |
| modTime | |
|
2818 |
||
3967 | 2819 |
modTime := self modificationTime. |
2820 |
modTime isNil ifTrue:[ |
|
2821 |
^ '???' |
|
3887 | 2822 |
]. |
3967 | 2823 |
^ modTime asDate printString. |
3887 | 2824 |
! |
2825 |
||
2826 |
fileInfoString |
|
2827 |
"get stat info on selected file - return a string which can be |
|
2828 |
shown in a box" |
|
2829 |
||
2830 |
| afileType | |
|
2831 |
||
2832 |
fileName isNil ifTrue:[^ nil]. |
|
2833 |
afileType := self fileType. |
|
2834 |
afileType isNil ifTrue:[ |
|
2835 |
^ ''. |
|
2836 |
]. |
|
2837 |
^ afileType |
|
2838 |
! |
|
2839 |
||
3967 | 2840 |
fileSize |
2841 |
"returns the fileSize |
|
2842 |
" |
|
2843 |
self getFileInfo. |
|
2844 |
fileInfo isNil ifTrue:[^ nil]. |
|
2845 |
||
2846 |
^ fileInfo fileSize |
|
2847 |
! |
|
2848 |
||
3887 | 2849 |
group |
2850 |
"returns the printable group |
|
2851 |
" |
|
2852 |
|gid| |
|
2853 |
||
2854 |
group isNil ifTrue:[ |
|
3967 | 2855 |
self getFileInfo. |
2856 |
fileInfo isNil ifTrue:[^ '???']. |
|
2857 |
||
2858 |
gid := fileInfo gid. |
|
2859 |
(LastGIDToGroupNameMapping notNil and:[gid == LastGIDToGroupNameMapping key]) ifTrue:[ |
|
2860 |
group := LastGIDToGroupNameMapping value |
|
2861 |
] ifFalse:[ |
|
2862 |
group := OperatingSystem getGroupNameFromID:gid. |
|
2863 |
LastGIDToGroupNameMapping := gid -> group. |
|
2864 |
] |
|
3887 | 2865 |
]. |
2866 |
^ group |
|
2867 |
! |
|
2868 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2869 |
inodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2870 |
"returns the inode number |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2871 |
" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2872 |
self getFileInfo. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2873 |
fileInfo isNil ifTrue:[^ nil]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2874 |
^ fileInfo id |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2875 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
2876 |
|
3887 | 2877 |
modificationTime |
2878 |
"returns the absolute time of modification |
|
2879 |
" |
|
3967 | 2880 |
self getFileInfo. |
2881 |
fileInfo isNil ifTrue:[^ nil]. |
|
2882 |
||
2883 |
^ fileInfo modificationTime |
|
3887 | 2884 |
! |
2885 |
||
2886 |
owner |
|
2887 |
"returns the printable owner |
|
2888 |
" |
|
2889 |
|uid| |
|
2890 |
||
2891 |
owner isNil ifTrue:[ |
|
3967 | 2892 |
self getFileInfo. |
2893 |
fileInfo isNil ifTrue:[^ '???']. |
|
2894 |
||
2895 |
uid := fileInfo uid. |
|
2896 |
(LastUIDToUserNameMapping notNil and:[uid == LastUIDToUserNameMapping key]) ifTrue:[ |
|
2897 |
owner := LastUIDToUserNameMapping value |
|
2898 |
] ifFalse:[ |
|
2899 |
owner := OperatingSystem getUserNameFromID:uid. |
|
2900 |
LastUIDToUserNameMapping := uid -> owner. |
|
2901 |
] |
|
3887 | 2902 |
]. |
2903 |
^ owner |
|
2904 |
! |
|
2905 |
||
2906 |
permissions |
|
2907 |
"returns the permissions as printable string |
|
2908 |
" |
|
3967 | 2909 |
|mode permissionString| |
3887 | 2910 |
|
3967 | 2911 |
self getFileInfo. |
2912 |
fileInfo isNil ifTrue:[^ '???'.]. |
|
3887 | 2913 |
|
3967 | 2914 |
mode := fileInfo mode. |
2915 |
permissionString := String new:9 withAll:$-. |
|
2916 |
||
2917 |
1 to:9 by:3 do:[:i| |
|
2918 |
(mode bitAt:i ) == 1 ifTrue:[permissionString at:10 - i put:$x]. |
|
2919 |
(mode bitAt:i + 1) == 1 ifTrue:[permissionString at:9 - i put:$w]. |
|
2920 |
(mode bitAt:i + 2) == 1 ifTrue:[permissionString at:8 - i put:$r]. |
|
3887 | 2921 |
]. |
3967 | 2922 |
^ permissionString |
3887 | 2923 |
! |
2924 |
||
2925 |
printString |
|
3983 | 2926 |
|
2927 |
^ 'a DirectoryContentsItem [', fileName asString, ']' |
|
3887 | 2928 |
! |
2929 |
||
4970 | 2930 |
sizeInBytesString |
2931 |
|locSize| |
|
2932 |
||
2933 |
locSize := self fileSize. |
|
2934 |
locSize isNil ifTrue:[^ '???']. |
|
2935 |
||
2936 |
^ locSize printString "/ leftPaddedTo:8. |
|
2937 |
! |
|
2938 |
||
3887 | 2939 |
sizeString |
2940 |
"returns the size of the file |
|
2941 |
" |
|
2942 |
| unitString n locSize| |
|
2943 |
||
3967 | 2944 |
locSize := self fileSize. |
2945 |
locSize isNil ifTrue:[^ '???']. |
|
2946 |
||
4402
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2947 |
unitString := UnitConverter fileSizeStringFor:locSize. |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2948 |
^ unitString withoutSeparators "/ leftPaddedTo:8. |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2949 |
|
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2950 |
"/ unitString := ''. |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2951 |
"/ locSize < (500 * 1024) ifTrue:[ |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2952 |
"/ locSize < 1024 ifTrue:[ |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2953 |
"/ n := locSize |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2954 |
"/ ] ifFalse:[ |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2955 |
"/ n := (locSize * 10 // 1024 / 10.0). |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2956 |
"/ unitString := ' Kb' |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2957 |
"/ ] |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2958 |
"/ ] ifFalse:[ |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2959 |
"/ n := (locSize * 10 // 1024 // 1024 / 10.0). |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2960 |
"/ unitString := ' Mb' |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2961 |
"/ ]. |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
2962 |
"/ ^ (n printStringLeftPaddedTo:5) , unitString. |
3887 | 2963 |
! |
2964 |
||
2965 |
timeAndDate |
|
2966 |
"returns the date |
|
2967 |
" |
|
4938 | 2968 |
|format modTime date| |
3887 | 2969 |
|
3967 | 2970 |
modTime := self modificationTime. |
2971 |
modTime isNil ifTrue:[ |
|
2972 |
^ '???' |
|
3887 | 2973 |
]. |
4938 | 2974 |
|
2975 |
"/ format := '%(year)-%(mon)-%(day) %h:%m:%s'. |
|
2976 |
date := modTime asDate. |
|
2977 |
date = Date today ifTrue:[ |
|
2978 |
format := (FileBrowser resources string:'Today') , ', %(yearOrTime)' |
|
2979 |
] ifFalse:[ |
|
2980 |
false "date = Date yesterday" ifTrue:[ |
|
2981 |
format := (FileBrowser resources string:'Yesterday') , ', %(yearOrTime)' |
|
2982 |
] ifFalse:[ |
|
2983 |
Smalltalk languageTerritory == #us ifTrue:[ |
|
2984 |
format := '%(ShortMonthName), %(dayPadded) %(yearOrTime)'. |
|
2985 |
] ifFalse:[ |
|
2986 |
format :='%(day)-%(ShortMonthName) %(yearOrTime)'. |
|
2987 |
]. |
|
2988 |
]. |
|
3967 | 2989 |
]. |
4938 | 2990 |
|
2991 |
^ modTime printStringFormat:format. |
|
3887 | 2992 |
! ! |
2993 |
||
2994 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'private'! |
|
2995 |
||
3967 | 2996 |
getFileInfo |
3887 | 2997 |
fileInfo isNil ifTrue:[ |
3906 | 2998 |
self isRemoteDirectory ifTrue:[ |
2999 |
"/ do not access, to avoid automount |
|
3887 | 3000 |
] ifFalse:[ |
3967 | 3001 |
fileInfo := fileName linkInfo. |
3002 |
fileInfo isNil ifTrue:[ |
|
3003 |
fileInfo := fileName info. |
|
3906 | 3004 |
]. |
3967 | 3005 |
]. |
3006 |
]. |
|
3007 |
^ fileInfo |
|
3887 | 3008 |
! ! |
3009 |
||
3010 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'queries'! |
|
3011 |
||
3906 | 3012 |
beRemoteDirectory |
3013 |
fileType := #remoteDirectory. |
|
3014 |
! |
|
3015 |
||
3887 | 3016 |
exists |
3017 |
"returns the fileName |
|
3018 |
" |
|
3019 |
^ fileName exists |
|
3020 |
! |
|
3021 |
||
3022 |
hasMimeType |
|
3023 |
||
3024 |
^ (self mimeType ~= #unknown) |
|
3025 |
! |
|
3026 |
||
3906 | 3027 |
isRemoteDirectory |
3028 |
^ fileType == #remoteDirectory |
|
3029 |
! |
|
3030 |
||
3887 | 3031 |
mimeTypeForContents |
3032 |
||
3033 |
mimeTypeForContents isNil ifTrue:[ |
|
3034 |
mimeTypeForContents := MIMETypes mimeTypeOfContents:(self fileName). |
|
3035 |
mimeTypeForContents isNil ifTrue:[ |
|
3036 |
mimeTypeForContents := #unknown |
|
3037 |
] ifFalse:[ |
|
3038 |
" set mimeType to mimeType of contents if a better mimeType is found " |
|
3039 |
mimeType := mimeTypeForContents. |
|
3040 |
iconKey := mimeTypeForContents. |
|
3041 |
] |
|
3042 |
]. |
|
3043 |
^ mimeTypeForContents |
|
3044 |
! ! |
|
3045 |
||
3046 |
!DirectoryContentsBrowser class methodsFor:'documentation'! |
|
3047 |
||
3048 |
version |
|
5290 | 3049 |
^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.134 2003-10-21 18:20:17 cg Exp $' |
3887 | 3050 |
! ! |