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