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