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