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