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