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