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