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