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