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