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