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