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