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