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