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