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