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