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