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