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