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