author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 30 Nov 2012 17:23:39 +0000 | |
branch | jv |
changeset 12308 | 5d9291c0fc27 |
parent 12262 | d25ef6bb0ef3 |
child 12317 | aac0f12a3327 |
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 |
5544 | 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 |
|
5868 | 21 |
diskUsageInfo diskUsageUpdateProcess multipleSelect |
12205 | 22 |
doubleClickAction updateCycleSemaphore updatingColumns accessLock' |
5716 | 23 |
classVariableNames:'Debug' |
5544 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Tools-File' |
|
3887 | 26 |
! |
27 |
||
28 |
Object subclass:#DirectoryContentsItem |
|
5544 | 29 |
instanceVariableNames:'fileName fileInfo icon fileType |
30 |
contentsBrowserChangeModificationTime suffix preview group owner |
|
10559
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
31 |
timeAndDate mimeType iconKey mimeTypeForContents baseName' |
5544 | 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 |
12205 | 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: '' |
|
12142 | 186 |
labelIsImage: true |
5312 | 187 |
labelButtonType: Group |
188 |
width: 22 |
|
189 |
minWidth: 22 |
|
190 |
height: 16 |
|
191 |
model: icon |
|
12142 | 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 |
||
12142 | 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 |
|
12142 | 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 |
12205 | 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 |
|
12125 | 923 |
aDirectory ~= directory ifTrue:[ |
924 |
directory notNil ifTrue:[ |
|
925 |
AbstractFileBrowser directoryHistory setPosition:(browser firstLineShown) for:(directory pathName). |
|
926 |
]. |
|
927 |
directory := aDirectory. |
|
928 |
self wakeUpForDirectoryChanged. |
|
929 |
] |
|
930 |
||
931 |
"Modified: / 07-01-2012 / 16:41:20 / cg" |
|
4342 | 932 |
! |
933 |
||
934 |
directoryChangeFlag |
|
935 |
^ directoryChangeFlag |
|
7856 | 936 |
|
12125 | 937 |
"Modified: / 07-01-2012 / 16:34:39 / cg" |
4342 | 938 |
! |
939 |
||
12125 | 940 |
directoryChangeFlag:aBoolean |
941 |
directoryChangeFlag := aBoolean. |
|
7856 | 942 |
|
943 |
"Modified: / 01-10-2007 / 19:22:35 / cg" |
|
12125 | 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 |
|
12125 | 951 |
|
952 |
"Modified: / 07-01-2012 / 16:34:51 / cg" |
|
4342 | 953 |
! |
954 |
||
12125 | 955 |
directoryContentsChangeFlag:aBoolean |
4342 | 956 |
"set the value of the instance variable 'directoryContentsChangeFlag' (automatically generated)" |
957 |
||
12125 | 958 |
directoryContentsChangeFlag := aBoolean. |
959 |
||
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 |
|
12125 | 979 |
|
980 |
"Modified: / 07-01-2012 / 16:35:07 / cg" |
|
4342 | 981 |
! |
982 |
||
12125 | 983 |
filterChangeFlag:aBoolean |
4342 | 984 |
"set the value of the instance variable 'filterChangeFlag' (automatically generated)" |
985 |
||
12125 | 986 |
filterChangeFlag := aBoolean. |
987 |
||
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 |
|
12125 | 1033 |
|
1034 |
"Modified: / 07-01-2012 / 16:35:20 / cg" |
|
4298 | 1035 |
! |
1036 |
||
12125 | 1037 |
sortBlockChangeFlag:aBoolean |
4342 | 1038 |
"set the value of the instance variable 'sortBlockChangeFlag' (automatically generated)" |
1039 |
||
12125 | 1040 |
sortBlockChangeFlag := aBoolean. |
1041 |
||
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 |
||
12205 | 1182 |
|
1183 |
||
1184 |
noOfShownFiles:noOfShownFiles noOfFiles:noOfFiles |
|
4017 | 1185 |
|
4263 | 1186 |
|info filterBox clr| |
1187 |
||
12205 | 1188 |
info := (noOfShownFiles == 1 ifTrue:['%1 file'] ifFalse:['%1 files']). |
1189 |
noOfShownFiles = noOfFiles ifFalse:[ |
|
7672 | 1190 |
info := info,' (%2 total)'. |
4263 | 1191 |
]. |
5120 | 1192 |
self shownFiles |
1193 |
value:(resources |
|
1194 |
string:info |
|
12205 | 1195 |
with:noOfShownFiles |
7672 | 1196 |
with:noOfFiles). |
4263 | 1197 |
|
4017 | 1198 |
filterBox := self filterValueBox value. |
1199 |
filterBox isNil ifTrue:[^ self ]. |
|
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1200 |
|
12205 | 1201 |
noOfShownFiles ~= noOfFiles ifTrue:[ |
4017 | 1202 |
clr := Color red lightened lightened lightened. |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1203 |
[ |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1204 |
View drawingOnClosedDrawableSignal catch:[ |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1205 |
filterBox flash |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1206 |
] |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
1207 |
] fork. |
4017 | 1208 |
] ifFalse:[ |
1209 |
clr := self filterBackgroundColor value. |
|
1210 |
]. |
|
1211 |
filterBox backgroundColor:clr. |
|
12205 | 1212 |
|
1213 |
"Created: / 20-03-2012 / 12:08:57 / cg" |
|
4017 | 1214 |
! |
1215 |
||
8407 | 1216 |
setBrowserItemList:aFilteredItems |
1217 |
||
1218 |
|showDir directoryUpItem locItems browserList| |
|
4017 | 1219 |
|
4202 | 1220 |
showDir := self viewDirsInContentsBrowser value. |
8407 | 1221 |
|
4017 | 1222 |
(showDir and:[self directory notNil and:[self directory isRootDirectory not]]) ifTrue:[ |
5249 | 1223 |
locItems := OrderedCollection new. |
4017 | 1224 |
directoryUpItem := DirectoryContentsBrowser itemClass fileName:(self directory construct:'..'). |
5249 | 1225 |
directoryUpItem notNil ifTrue:[ |
1226 |
locItems add:directoryUpItem. |
|
1227 |
]. |
|
8407 | 1228 |
locItems addAll:aFilteredItems. |
4346 | 1229 |
] ifFalse:[ |
8407 | 1230 |
locItems := aFilteredItems. |
4017 | 1231 |
]. |
4039 | 1232 |
self updateToExternFileHolderLock doLocked:[ |
8407 | 1233 |
browserList := self browserItemList. |
12205 | 1234 |
|
1235 |
(browserList sameContentsAs: locItems) ifTrue:[ |
|
1236 |
"/ same |
|
1237 |
] ifFalse:[ |
|
1238 |
"/ bugfix - first remove all entries in list |
|
1239 |
browserList removeAll. |
|
1240 |
browserList contents:locItems. |
|
1241 |
]. |
|
4039 | 1242 |
]. |
4017 | 1243 |
self selectCurrentFiles. |
12125 | 1244 |
|
12205 | 1245 |
"Modified: / 20-03-2012 / 12:17:14 / cg" |
7714 | 1246 |
! |
1247 |
||
1248 |
updateDiskUsage |
|
1249 |
directory notNil ifTrue:[ |
|
1250 |
self flushRememberedDiskUsageInfoFor:directory. |
|
1251 |
] ifFalse:[ |
|
1252 |
self flushRememberedDiskUsageInfo. |
|
1253 |
]. |
|
1254 |
self startDiskUsageInfoProcess. |
|
3887 | 1255 |
! ! |
1256 |
||
1257 |
!DirectoryContentsBrowser methodsFor:'aspects'! |
|
1258 |
||
3983 | 1259 |
browserItemList |
1260 |
||
1261 |
browserItemList isNil ifTrue:[ |
|
1262 |
browserItemList := List new. |
|
1263 |
]. |
|
1264 |
^ browserItemList |
|
3887 | 1265 |
! |
1266 |
||
3983 | 1267 |
selectionInFileList |
1268 |
||
1269 |
selectionInFileList isNil ifTrue:[ |
|
1270 |
selectionInFileList := ValueHolder new. |
|
1271 |
selectionInFileList addDependent:self. |
|
3887 | 1272 |
]. |
3983 | 1273 |
^ selectionInFileList |
3887 | 1274 |
! |
1275 |
||
1276 |
tableColumns |
|
1277 |
||
1278 |
tableColumns isNil ifTrue:[ |
|
1279 |
tableColumns := self class tableColumns asValue. |
|
1280 |
]. |
|
1281 |
^ tableColumns. |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1282 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1283 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1284 |
valueHolderForColumn:id |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1285 |
"xlate #suffix -> viewType, etc... |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1286 |
i.e. for a columns readSelector, return my valueHolder" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1287 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1288 |
^ self perform:('view' , id asUppercaseFirst) asSymbol |
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 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1291 |
viewFileInfoString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1292 |
^ self viewDescription |
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 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1295 |
viewSizeInBytesString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1296 |
^ self viewSizeInBytes |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1297 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1298 |
|
5312 | 1299 |
viewSizeInKiloBytesString |
1300 |
^ self viewSizeInKiloBytes |
|
1301 |
! |
|
1302 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1303 |
viewSizeString |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1304 |
^ self viewSize |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1305 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1306 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1307 |
viewSuffix |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1308 |
^ self viewType |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1309 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1310 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1311 |
viewTimeAndDate |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1312 |
^ self viewTime |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1313 |
! ! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1314 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1315 |
!DirectoryContentsBrowser methodsFor:'aspects-visibility'! |
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 |
colVisibilityAspectFor:aKey ifAbsent:absentBlock |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1318 |
"aspect for a columns visibility" |
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 |
|holder| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1321 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1322 |
holder := self aspectFor:aKey ifAbsent:absentBlock. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1323 |
holder onChangeSend:#viewedColumnsChanged to:self. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1324 |
^ holder |
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 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1327 |
viewDescription |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1328 |
"aspect for show file description" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1329 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1330 |
^ self colVisibilityAspectFor:#viewDescription ifAbsent:[ false asValue ]. |
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 |
viewDetails |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1334 |
"aspect for show more file properties |
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 |
|
6359 | 1337 |
^ self colVisibilityAspectFor:#viewDetails ifAbsent:[ true asValue ]. |
7079 | 1338 |
|
1339 |
"Modified: / 04-09-2006 / 09:46:43 / cg" |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1340 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1341 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1342 |
viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1343 |
" aspect for show group information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1344 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1345 |
^ self colVisibilityAspectFor:#viewGroup ifAbsent:[ false asValue ]. |
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 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1349 |
" aspect for show file-type icon" |
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:#viewIcon ifAbsent:[ true 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 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1355 |
" aspect for show inode number " |
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:#viewInodeNumber ifAbsent:[ false 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 |
viewOwner |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1361 |
" aspect for show owner information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1362 |
|
6359 | 1363 |
^ self colVisibilityAspectFor:#viewOwner ifAbsent:[ true asValue ]. |
4976
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 |
viewPermissions |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1367 |
" aspect for show permission information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1368 |
|
7079 | 1369 |
^ self colVisibilityAspectFor:#viewPermissions ifAbsent:[ false asValue ]. |
1370 |
||
1371 |
"Modified: / 04-09-2006 / 09:46:12 / cg" |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1372 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1373 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1374 |
viewPreview |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1375 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1376 |
" aspect for show image previev " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1377 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1378 |
^ self colVisibilityAspectFor:#viewPreview ifAbsent:[ false asValue ]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1379 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1380 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1381 |
viewSize |
6463 | 1382 |
" aspect for show-size information " |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1383 |
|
6359 | 1384 |
^ self colVisibilityAspectFor:#viewSize ifAbsent:[ true asValue ]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1385 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1386 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1387 |
viewSizeInBytes |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1388 |
" aspect for show size-in-bytes information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1389 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1390 |
^ self colVisibilityAspectFor:#viewSizeInBytes ifAbsent:[ false asValue ]. |
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 |
|
5312 | 1393 |
viewSizeInKiloBytes |
1394 |
" aspect for show size-in-kilobytes information " |
|
1395 |
||
1396 |
^ self colVisibilityAspectFor:#viewSizeInKiloBytes ifAbsent:[ false asValue ]. |
|
1397 |
! |
|
1398 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1399 |
viewTime |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1400 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1401 |
" aspect for show time information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1402 |
|
6359 | 1403 |
^ self colVisibilityAspectFor:#viewTime ifAbsent:[ true asValue ]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1404 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1405 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1406 |
viewType |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1407 |
" aspect for show suffix (type) information " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1408 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1409 |
^ self colVisibilityAspectFor:#viewType ifAbsent:[ false asValue ]. |
3887 | 1410 |
! ! |
1411 |
||
1412 |
!DirectoryContentsBrowser methodsFor:'change & update'! |
|
1413 |
||
3983 | 1414 |
currentFileNameHolderChanged |
3887 | 1415 |
"filename changed |
1416 |
" |
|
4889 | 1417 |
|newDir currentDir aColOfFiles| |
3983 | 1418 |
|
7563 | 1419 |
aColOfFiles := self currentSelectedObjects. |
4978
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1420 |
aColOfFiles isEmpty ifTrue:[ |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1421 |
"/ selection is gone keep the current directory list |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1422 |
^ self |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1423 |
]. |
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6226
diff
changeset
|
1424 |
(self currentFilesAreInSameDirectory) ifFalse:[ |
3887 | 1425 |
self directory:nil. |
1426 |
^ self |
|
1427 |
]. |
|
6726 | 1428 |
self currentSelectedDirectories size > 1 ifTrue:[ |
4889 | 1429 |
self directory:nil. |
1430 |
^ self |
|
1431 |
]. |
|
4536 | 1432 |
aColOfFiles size == 1 ifTrue:[ |
4781 | 1433 |
self startDiskUsageInfoProcess. |
4536 | 1434 |
]. |
4900 | 1435 |
newDir := (self directoriesForFiles:aColOfFiles) first asCanonicalizedFilename. |
4901 | 1436 |
currentDir := self directory. |
4906
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1437 |
(currentDir notNil and:[newDir = currentDir asCanonicalizedFilename]) ifTrue:[ |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1438 |
self selectFiles:aColOfFiles. |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1439 |
^ self. |
5f632635a291
oops - bad checkin (cvs conflict)
Claus Gittinger <cg@exept.de>
parents:
4903
diff
changeset
|
1440 |
]. |
4536 | 1441 |
"/ change of the directory filename |
1442 |
self directory:newDir. |
|
7563 | 1443 |
|
1444 |
"Modified: / 04-12-2006 / 13:15:32 / cg" |
|
3887 | 1445 |
! |
1446 |
||
4071 | 1447 |
filterBlockHolderChanged |
1448 |
||
7714 | 1449 |
self matchBlock:(self filterBlockHolder value). |
4342 | 1450 |
self wakeUpForFilterChanged. |
4071 | 1451 |
! |
1452 |
||
3983 | 1453 |
selectionChanged |
1454 |
||
4004 | 1455 |
| selection newCurrentFilename | |
3983 | 1456 |
|
1457 |
self directory isNil ifTrue:[^ self]. |
|
4781 | 1458 |
|
3983 | 1459 |
selection := self selectedFiles. |
1460 |
selection isEmpty ifTrue:[ |
|
4004 | 1461 |
newCurrentFilename := OrderedCollection with:self directory. |
3983 | 1462 |
] ifFalse:[ |
4004 | 1463 |
newCurrentFilename := selection. |
3983 | 1464 |
]. |
7563 | 1465 |
self currentSelectedObjects ~= newCurrentFilename ifTrue:[ |
4004 | 1466 |
self currentFileNameHolder value:newCurrentFilename withoutNotifying:self |
4781 | 1467 |
]. |
7563 | 1468 |
|
1469 |
"Modified: / 04-12-2006 / 13:15:37 / cg" |
|
3983 | 1470 |
! |
1471 |
||
4781 | 1472 |
update:something with:aParameter from:changedObject |
3887 | 1473 |
"one of my models changed |
1474 |
" |
|
3983 | 1475 |
|
4781 | 1476 |
changedObject == self currentFileNameHolder ifTrue:[ |
1477 |
super update:something with:aParameter from:changedObject. |
|
3983 | 1478 |
self updateContentsSelection doIfUnLocked:[ |
4017 | 1479 |
self currentFileNameHolderChanged. |
3983 | 1480 |
]. |
4007 | 1481 |
^ self. |
3983 | 1482 |
]. |
4781 | 1483 |
changedObject == self selectionInFileList ifTrue:[ |
3983 | 1484 |
self updateToExternFileHolderLock doIfUnLocked:[ |
1485 |
self updateContentsSelection doLocked:[ |
|
1486 |
self selectionChanged. |
|
1487 |
] |
|
1488 |
]. |
|
1489 |
^ self. |
|
1490 |
]. |
|
4781 | 1491 |
changedObject == self currentSortOrder ifTrue:[ |
4027 | 1492 |
self currentSortOrderChanged. |
1493 |
^ self. |
|
1494 |
]. |
|
4781 | 1495 |
changedObject == self filterBlockHolder ifTrue:[ |
4071 | 1496 |
self filterBlockHolderChanged. |
3887 | 1497 |
^ self. |
1498 |
]. |
|
4781 | 1499 |
changedObject == self sortBlockHolder ifTrue:[ |
4342 | 1500 |
self wakeUpForSortBlockChanged. |
3887 | 1501 |
^ self. |
1502 |
]. |
|
4781 | 1503 |
changedObject == self viewDirsInContentsBrowser ifTrue:[ |
5869 | 1504 |
self sortBlockHolder value directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]). |
4342 | 1505 |
self wakeUpForFilterChanged. |
3887 | 1506 |
^ self |
1507 |
]. |
|
5869 | 1508 |
changedObject == self sortDirectoriesBeforeFiles ifTrue:[ |
1509 |
self sortBlockHolder value directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]). |
|
1510 |
^ self |
|
1511 |
]. |
|
4781 | 1512 |
changedObject == self showDiskUsageHolder ifTrue:[ |
1513 |
self notify:''. |
|
1514 |
changedObject value ifTrue:[ |
|
1515 |
self startDiskUsageInfoProcess. |
|
1516 |
] ifFalse:[ |
|
1517 |
self flushRememberedDiskUsageInfo |
|
1518 |
]. |
|
1519 |
^ self |
|
1520 |
]. |
|
1521 |
||
1522 |
super update:something with:aParameter from:changedObject |
|
3887 | 1523 |
! |
1524 |
||
7563 | 1525 |
updateListAfterDelete:collectionOfFiles |
7572 | 1526 |
|indices firstIndex lastIndex nextIndex nextItem| |
7563 | 1527 |
|
1528 |
collectionOfFiles size > 100 ifTrue:[ |
|
1529 |
super updateListAfterDelete:collectionOfFiles. |
|
1530 |
^ self |
|
1531 |
]. |
|
1532 |
||
1533 |
indices := collectionOfFiles collect:[:eachFile | browserItemList findFirst:[:item | item fileName = eachFile]]. |
|
1534 |
lastIndex := indices max. |
|
7572 | 1535 |
firstIndex := indices min. |
1536 |
nextIndex := lastIndex+1. |
|
1537 |
nextIndex > browserItemList size ifTrue:[ nextIndex := firstIndex-1]. |
|
1538 |
nextItem := browserItemList at:nextIndex ifAbsent:nil. |
|
1539 |
||
1540 |
accessLock critical:[ |
|
1541 |
indices asSortedCollection |
|
1542 |
reverseDo:[:eachIndexToRemove | |
|
1543 |
eachIndexToRemove ~~ 0 ifTrue:[ |
|
1544 |
browserItemList removeIndex:eachIndexToRemove |
|
1545 |
] |
|
1546 |
]. |
|
1547 |
]. |
|
1548 |
||
12205 | 1549 |
self directoryContentsChanged. "/ to force update of the numberOfShown files. |
7563 | 1550 |
nextItem notNil ifTrue:[ |
7572 | 1551 |
self |
1552 |
enqueueMessage:#value |
|
1553 |
for:[ self selectionInFileList value:(OrderedCollection with:nextItem). |
|
1554 |
self selectItems:(OrderedCollection with:nextItem) ] |
|
1555 |
arguments:#(). |
|
1556 |
"/ self selectionInFileList value:(OrderedCollection with:nextItem). |
|
1557 |
"/ self selectItems:(OrderedCollection with:nextItem). |
|
7563 | 1558 |
]. |
1559 |
||
12205 | 1560 |
"Modified: / 20-03-2012 / 13:22:48 / cg" |
5544 | 1561 |
! |
1562 |
||
4342 | 1563 |
viewPreviewChanged |
1564 |
||
1565 |
browserItemList do:[:el| el resetImageFile ]. |
|
1566 |
self viewedColumnsChanged. |
|
1567 |
! |
|
1568 |
||
3887 | 1569 |
viewedColumnsChanged |
1570 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1571 |
|columns buffer currentSortOrder currentSortOrderColumn currentSortOrderReverse selection holder| |
4342 | 1572 |
|
1573 |
selection := self selectedItems. |
|
4778
e1c81c22bf36
Avoid slow grow operations on Array.
Stefan Vogel <sv@exept.de>
parents:
4768
diff
changeset
|
1574 |
buffer := self class tableColumns |
7764 | 1575 |
collect:[:col| (DataSetColumnSpec decodeFromLiteralArray:col)]. |
4768 | 1576 |
|
4778
e1c81c22bf36
Avoid slow grow operations on Array.
Stefan Vogel <sv@exept.de>
parents:
4768
diff
changeset
|
1577 |
columns := buffer asOrderedCollection. |
3887 | 1578 |
self viewDetails value = false ifTrue:[ |
4713 | 1579 |
browser showLabels:false. |
3887 | 1580 |
buffer do:[:col | |
1581 |
(col readSelector = #baseName or:[col readSelector = #icon]) ifFalse:[ |
|
1582 |
columns remove:col. |
|
1583 |
] |
|
1584 |
] |
|
1585 |
] ifFalse:[ |
|
4713 | 1586 |
browser showLabels:true. |
4027 | 1587 |
currentSortOrder := self currentSortOrder value. |
1588 |
currentSortOrderColumn := currentSortOrder at:#column ifAbsent:nil. |
|
1589 |
currentSortOrderReverse := currentSortOrder at:#reverse ifAbsent:nil. |
|
3887 | 1590 |
buffer do:[:col | |
8998 | 1591 |
| id label icon | |
4970 | 1592 |
|
1593 |
id := col readSelector. |
|
3887 | 1594 |
id notNil ifTrue:[ |
4027 | 1595 |
(col labelActionArgument notNil and:[col labelActionArgument asSymbol == currentSortOrderColumn]) ifTrue:[ |
1596 |
label := col label. |
|
8998 | 1597 |
icon := currentSortOrderReverse |
1598 |
ifTrue:[ self class detailsMenuIconDown] |
|
1599 |
ifFalse:[ self class detailsMenuIconUp]. |
|
4027 | 1600 |
col label:(LabelAndIcon label:label icon:icon). |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1601 |
]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1602 |
|
4970 | 1603 |
((id == #baseName) or:[id == #baseNameWithOutSuffix]) ifTrue:[ |
4027 | 1604 |
self viewType value ifTrue:[ |
1605 |
col readSelector:#baseNameWithOutSuffix |
|
3887 | 1606 |
] ifFalse:[ |
4027 | 1607 |
col readSelector:#baseName |
1608 |
]. |
|
1609 |
] ifFalse:[ |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1610 |
holder := self valueHolderForColumn:id. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1611 |
holder value ifFalse:[ |
4970 | 1612 |
columns remove:col. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
1613 |
]. |
3887 | 1614 |
] |
1615 |
] |
|
1616 |
] |
|
1617 |
]. |
|
4039 | 1618 |
self updateToExternFileHolderLock doLocked:[ |
1619 |
self tableColumns value:columns. |
|
1620 |
]. |
|
3887 | 1621 |
self columnDescriptors:(self tableColumns value). |
4342 | 1622 |
self selectItems:selection. |
1623 |
self wakeUp. |
|
7764 | 1624 |
|
1625 |
"Modified: / 27-03-2007 / 08:46:28 / cg" |
|
3887 | 1626 |
! ! |
1627 |
||
1628 |
!DirectoryContentsBrowser methodsFor:'drag & drop'! |
|
1629 |
||
1630 |
doStartDrag:aDropSource in:aView |
|
9360
442d863efe2a
comment/format in: #doStartDrag:in:
Claus Gittinger <cg@exept.de>
parents:
9323
diff
changeset
|
1631 |
"set the cursors before starting the drag & drop operation" |
442d863efe2a
comment/format in: #doStartDrag:in:
Claus Gittinger <cg@exept.de>
parents:
9323
diff
changeset
|
1632 |
|
3983 | 1633 |
|selectedFiles| |
1634 |
||
1635 |
selectedFiles := self selectedFiles. |
|
4014 | 1636 |
(selectedFiles isEmpty) ifTrue:[ |
3887 | 1637 |
^ self. |
1638 |
]. |
|
3953 | 1639 |
^ super doStartDrag:aDropSource in:aView |
1640 |
! |
|
1641 |
||
4746 | 1642 |
dropDestinationPath |
1643 |
|destinationPath| |
|
1644 |
||
1645 |
draggedItem isNil ifTrue:[ |
|
1646 |
destinationPath := self directory. |
|
1647 |
] ifFalse:[ |
|
1648 |
destinationPath := self getDirWithoutFileName:(draggedItem fileName). |
|
1649 |
destinationPath baseName = '..' ifTrue:[ |
|
1650 |
destinationPath := self directory directory. |
|
1651 |
] |
|
1652 |
]. |
|
1653 |
||
1654 |
^ destinationPath |
|
1655 |
! |
|
1656 |
||
4683 | 1657 |
dropOver:aDropContext |
4611 | 1658 |
"called during drag & drop while moving over the widget." |
1659 |
||
3953 | 1660 |
|lineNr newDest destinationFile| |
1661 |
||
1662 |
inDropMode ifFalse:[^ self]. |
|
1663 |
||
4683 | 1664 |
lineNr := self getLineNumberFor:aDropContext. |
3953 | 1665 |
lineNr notNil ifTrue:[ |
3983 | 1666 |
newDest := browserItemList at:lineNr. |
3953 | 1667 |
(newDest notNil and:[newDest isDirectory]) ifTrue:[ |
1668 |
destinationFile := newDest fileName. |
|
4014 | 1669 |
destinationFile baseName = '..' ifTrue:[ |
3953 | 1670 |
destinationFile := self directory directory. |
1671 |
] |
|
1672 |
]. |
|
1673 |
]. |
|
4683 | 1674 |
|
1675 |
newDest == draggedItem ifTrue:[ |
|
1676 |
"/ beyond last contents-line |
|
1677 |
newDest isNil ifTrue:[ |
|
1678 |
canDropItem := self canDropFiles:(aDropContext dropObjects) for:self directory. |
|
1679 |
]. |
|
1680 |
^ self |
|
1681 |
]. |
|
3953 | 1682 |
|
1683 |
destinationFile isNil ifTrue:[ |
|
1684 |
destinationFile := self directory. |
|
1685 |
]. |
|
3887 | 1686 |
|
3953 | 1687 |
newDest ~~ draggedItem ifTrue:[ |
4683 | 1688 |
aDropContext dropSource argument == #archivApplication ifTrue:[ |
3953 | 1689 |
canDropItem := true. |
1690 |
] ifFalse:[ |
|
4683 | 1691 |
canDropItem := self canDropFiles:(aDropContext dropObjects) for:destinationFile. |
3953 | 1692 |
]. |
1693 |
]. |
|
4683 | 1694 |
self dropTargetItemChangedTo:newDest in:aDropContext. |
3953 | 1695 |
! |
1696 |
||
1697 |
dropTargetItemChangedTo:anItem in:aDropContext |
|
1698 |
||
1699 |
| current | |
|
1700 |
||
1701 |
||
1702 |
"/ (anItem notNil and:[anItem isDirectory]) ifTrue:[ self halt]. |
|
1703 |
current := draggedItem. |
|
3967 | 1704 |
"/ Transcript showCR:'current:', (current isNil ifTrue:['nil'] ifFalse:[current fileName baseName]). |
1705 |
"/ Transcript showCR:'anItem:', (anItem isNil ifTrue:['nil'] ifFalse:[anItem fileName baseName]). |
|
3953 | 1706 |
current == anItem ifTrue:[^ self]. |
1707 |
draggedItem := anItem. |
|
1708 |
||
1709 |
aDropContext contentsWillChange. |
|
1710 |
||
9534
aabf8d5125a5
changed: #dropTargetItemChangedTo:in:
Claus Gittinger <cg@exept.de>
parents:
9513
diff
changeset
|
1711 |
current notNil ifTrue:[ |
3953 | 1712 |
current isDirectory ifTrue:[ |
1713 |
current icon:(self getIconFor:current). |
|
1714 |
]. |
|
1715 |
]. |
|
1716 |
||
9534
aabf8d5125a5
changed: #dropTargetItemChangedTo:in:
Claus Gittinger <cg@exept.de>
parents:
9513
diff
changeset
|
1717 |
anItem notNil ifTrue:[ |
3953 | 1718 |
anItem isDirectory ifTrue:[ |
1719 |
anItem icon:(FileBrowser iconForKeyMatching:#directoryOpenGray). |
|
1720 |
]. |
|
1721 |
]. |
|
4713 | 1722 |
browser shown ifTrue:[ |
1723 |
browser invalidateVisibleRow:current colAt:iconIndex. |
|
1724 |
browser invalidateVisibleRow:anItem colAt:iconIndex. |
|
1725 |
browser repairDamage. |
|
3953 | 1726 |
]. |
9534
aabf8d5125a5
changed: #dropTargetItemChangedTo:in:
Claus Gittinger <cg@exept.de>
parents:
9513
diff
changeset
|
1727 |
|
aabf8d5125a5
changed: #dropTargetItemChangedTo:in:
Claus Gittinger <cg@exept.de>
parents:
9513
diff
changeset
|
1728 |
"Modified: / 08-08-2010 / 14:41:53 / cg" |
3887 | 1729 |
! |
1730 |
||
1731 |
getDisplayObjects:anArgument |
|
4713 | 1732 |
|selectedItems string fnName stream| |
1733 |
||
1734 |
selectedItems := self selectedFiles. |
|
1735 |
selectedItems isEmpty ifTrue:[ ^ '']. |
|
1736 |
||
3887 | 1737 |
stream := WriteStream on:''. |
4713 | 1738 |
stream nextPutAll:(selectedItems first baseName). |
1739 |
selectedItems size == 1 ifTrue:[ |
|
3887 | 1740 |
fnName := 'ui_menuitem.xpm'. |
1741 |
] ifFalse:[ |
|
1742 |
fnName := 'ui_submenu_open.xpm'. |
|
1743 |
stream nextPutAll:' ... '. |
|
4713 | 1744 |
stream nextPutAll:(selectedItems last baseName). |
3887 | 1745 |
]. |
1746 |
string := stream contents. |
|
1747 |
stream close. |
|
4713 | 1748 |
|
3887 | 1749 |
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) |
1750 |
string:(Text string:string emphasis:#bold) |
|
1751 |
) |
|
1752 |
! ! |
|
1753 |
||
1754 |
!DirectoryContentsBrowser methodsFor:'event handling'! |
|
1755 |
||
1756 |
processEvent:anEvent |
|
1757 |
"filter keyboard events. |
|
1758 |
Return true, if I have eaten the event" |
|
1759 |
||
1760 |
|focusView key rawKey| |
|
1761 |
||
4713 | 1762 |
anEvent isKeyPressEvent ifFalse:[^ false]. |
1763 |
||
1764 |
focusView := anEvent targetView. |
|
1765 |
(focusView isNil or:[focusView ~~ browser]) ifTrue:[ ^ false]. |
|
1766 |
||
1767 |
key := anEvent key. |
|
1768 |
rawKey := anEvent rawKey. |
|
1769 |
||
1770 |
"/ (key ~= #'Alt_L') ifTrue:[self halt.]. |
|
1771 |
key == #Accept ifTrue:[ |
|
6831
56061d3bcbf0
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6826
diff
changeset
|
1772 |
self withActivityIndicationDo:[ |
5260 | 1773 |
self fileFileIn. |
1774 |
]. |
|
4713 | 1775 |
^ true. |
1776 |
]. |
|
1777 |
key == #Paste ifTrue:[ |
|
1778 |
self pasteFiles. |
|
1779 |
^ true. |
|
3887 | 1780 |
]. |
4970 | 1781 |
"/ strange feeling, because behavior is different depending on |
1782 |
"/ where the mouse pointer is (treeView vs. contentsView) |
|
1783 |
"/ |
|
5404 | 1784 |
(key == #CursorLeft) ifTrue:[ |
1785 |
self doGoDirectoryUp. |
|
1786 |
^ true |
|
1787 |
]. |
|
4713 | 1788 |
"/ (key == #CursorRight) ifTrue:[ |
1789 |
"/ self doBack. |
|
1790 |
"/ ^ true |
|
1791 |
"/ ]. |
|
1792 |
browserItemList size == 0 ifTrue:[ |
|
1793 |
^ false |
|
1794 |
]. |
|
1795 |
||
1796 |
key == #Cut ifTrue:[ |
|
1797 |
self doCut. |
|
1798 |
^ true. |
|
1799 |
]. |
|
1800 |
key == #Copy ifTrue:[ |
|
1801 |
self doCopy. |
|
1802 |
^ true. |
|
1803 |
]. |
|
1804 |
key == #Delete ifTrue:[ |
|
1805 |
self doDelete. |
|
1806 |
^ true. |
|
1807 |
]. |
|
1808 |
(key == #Return) ifTrue:[ |
|
4972 | 1809 |
self enterAction. |
4713 | 1810 |
^ true. |
1811 |
]. |
|
8715 | 1812 |
key == #Rename ifTrue:[ |
4828 | 1813 |
self renameSelection. |
1814 |
^ true. |
|
1815 |
]. |
|
4713 | 1816 |
|
3887 | 1817 |
^ false |
6831
56061d3bcbf0
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6826
diff
changeset
|
1818 |
|
56061d3bcbf0
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6826
diff
changeset
|
1819 |
"Modified: / 25-07-2006 / 09:08:16 / cg" |
3887 | 1820 |
! ! |
1821 |
||
6298 | 1822 |
!DirectoryContentsBrowser methodsFor:'initialization'! |
6226 | 1823 |
|
1824 |
initialize |
|
1825 |
changeSema := Semaphore new. |
|
7572 | 1826 |
updateCycleSemaphore := Semaphore new. |
1827 |
accessLock := RecursionLock new. |
|
12125 | 1828 |
|
1829 |
filterChangeFlag := false. |
|
1830 |
sortBlockChangeFlag := false. |
|
1831 |
directoryChangeFlag := false. |
|
1832 |
directoryContentsChangeFlag := false. |
|
1833 |
||
6226 | 1834 |
super initialize. |
7572 | 1835 |
|
12125 | 1836 |
"Modified: / 07-01-2012 / 16:34:25 / cg" |
6226 | 1837 |
! ! |
1838 |
||
3887 | 1839 |
!DirectoryContentsBrowser methodsFor:'menu accessing'! |
1840 |
||
1841 |
viewBrowserMenu |
|
1842 |
||
1843 |
<resource: #programMenu > |
|
1844 |
||
1845 |
|menu| |
|
1846 |
||
3961 | 1847 |
viewBrowserMenu isNil ifTrue:[ |
1848 |
viewBrowserMenu := self class viewBrowserMenu. |
|
1849 |
]. |
|
7584 | 1850 |
viewBrowserMenu isNil ifTrue:[ ^ nil ]. |
4080 | 1851 |
viewBrowserMenu findGuiResourcesIn:self. |
1852 |
||
3961 | 1853 |
menu := viewBrowserMenu. |
3887 | 1854 |
menu receiver:self. |
1855 |
^ menu |
|
1856 |
! ! |
|
1857 |
||
1858 |
!DirectoryContentsBrowser methodsFor:'menu actions'! |
|
1859 |
||
1860 |
doShowFileContents |
|
1861 |
||
3983 | 1862 |
| selectedFileItems| |
1863 |
||
1864 |
selectedFileItems := self selectedFileItems. |
|
1865 |
(selectedFileItems size == 1) ifTrue:[ |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4862
diff
changeset
|
1866 |
self openNewTextEditorOn:(selectedFileItems first). |
3887 | 1867 |
]. |
4972 | 1868 |
! |
1869 |
||
1870 |
enterAction |
|
1871 |
||
1872 |
| selectedItems| |
|
1873 |
||
1874 |
selectedItems := self selectedItems. |
|
1875 |
(selectedItems size == 1) ifTrue:[ |
|
1876 |
self enterActionFor:(selectedItems first). |
|
1877 |
]. |
|
3887 | 1878 |
! ! |
1879 |
||
1880 |
!DirectoryContentsBrowser methodsFor:'queries'! |
|
1881 |
||
1882 |
allItemsOfCurrentDirectory |
|
4202 | 1883 |
self viewDirsInContentsBrowser value ifTrue:[ |
4768 | 1884 |
^ browserItemList copyFrom:2. "/ remove the '..' item |
3983 | 1885 |
]. |
4768 | 1886 |
^ browserItemList. |
3887 | 1887 |
! |
1888 |
||
1889 |
fileListIsEmpty |
|
1890 |
||
3983 | 1891 |
^ browserItemList isEmpty |
3887 | 1892 |
! |
1893 |
||
4768 | 1894 |
getAllFilesAsStrings |
1895 |
browserItemList isEmpty ifTrue:[ |
|
1896 |
^ #() |
|
3887 | 1897 |
]. |
4768 | 1898 |
^ browserItemList |
1899 |
select:[:anItem | anItem isDirectory not] |
|
1900 |
thenCollect:[:eachItem | eachItem fileName asString]. |
|
4004 | 1901 |
! |
1902 |
||
1903 |
hasFilesFiltered |
|
4342 | 1904 |
|
1905 |
^ self allItems size ~~ browserItemList size |
|
3983 | 1906 |
! ! |
1907 |
||
1908 |
!DirectoryContentsBrowser methodsFor:'selection'! |
|
1909 |
||
1910 |
selectAll |
|
1911 |
||
1912 |
| sel| |
|
1913 |
||
1914 |
sel := browserItemList copy. |
|
4202 | 1915 |
self viewDirsInContentsBrowser value ifTrue:[ |
4013 | 1916 |
sel removeIdentical:(browserItemList first) ifAbsent:[nil] |
3887 | 1917 |
]. |
3983 | 1918 |
self selectionInFileList value:sel. |
3887 | 1919 |
! |
1920 |
||
4017 | 1921 |
selectCurrentFiles |
1922 |
||
1923 |
|currentSelection| |
|
1924 |
||
7563 | 1925 |
((currentSelection := self currentSelectedObjects select:[:file| file isDirectory not]) notEmpty) ifTrue:[ |
4017 | 1926 |
self selectFiles:currentSelection. |
1927 |
]. |
|
7563 | 1928 |
|
1929 |
"Modified: / 04-12-2006 / 13:15:34 / cg" |
|
4017 | 1930 |
! |
1931 |
||
3983 | 1932 |
selectFiles:aColOfFilenames |
1933 |
| curSel newSel| |
|
1934 |
||
1935 |
curSel := self selectedFiles. |
|
1936 |
aColOfFilenames size = curSel size ifTrue:[ |
|
9105 | 1937 |
"/ anything changed ? |
1938 |
(curSel contains:[:file| (aColOfFilenames includes:file) not]) ifFalse:[^ self]. |
|
3887 | 1939 |
]. |
3983 | 1940 |
newSel := OrderedCollection new. |
1941 |
browserItemList do:[: item| |
|
1942 |
(aColOfFilenames includes:(item fileName)) ifTrue:[ |
|
1943 |
newSel add:item. |
|
1944 |
]. |
|
3887 | 1945 |
]. |
4017 | 1946 |
self updateToExternFileHolderLock doLocked:[ |
4071 | 1947 |
self selectionInFileList value:newSel withoutNotifying:self. |
4017 | 1948 |
]. |
3983 | 1949 |
! |
1950 |
||
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1951 |
selectItems:aColOfItems |
4768 | 1952 |
self selectFiles:(aColOfItems collect:[:eachItem | eachItem fileName]). |
1953 |
||
1954 |
"/ | curSel newSel| |
|
1955 |
"/ |
|
1956 |
"/ curSel := self selectedItems. |
|
1957 |
"/ aColOfItems size = curSel size ifTrue:[ |
|
1958 |
"/ | index | |
|
1959 |
"/ index := curSel findFirst:[:item| (aColOfItems includes:item) not]. |
|
1960 |
"/ index == 0 ifTrue:[ ^ self]. |
|
1961 |
"/ ]. |
|
1962 |
"/ newSel := OrderedCollection new. |
|
1963 |
"/ browserItemList do:[: item| |
|
1964 |
"/ (aColOfItems includes:item) ifTrue:[ |
|
1965 |
"/ newSel add:item. |
|
1966 |
"/ ]. |
|
1967 |
"/ ]. |
|
1968 |
"/ self updateToExternFileHolderLock doLocked:[ |
|
1969 |
"/ self selectionInFileList value:newSel withoutNotifying:self. |
|
1970 |
"/ ]. |
|
4335
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1971 |
! |
b56935032115
keep selection on update and insert new lines smarter in displayed list
penk
parents:
4298
diff
changeset
|
1972 |
|
3983 | 1973 |
selectedFileItems |
1974 |
||
1975 |
| sel | |
|
1976 |
||
4972 | 1977 |
sel := self selectedItemsWithoutDotDotDirectory select:[:item | item isDirectory not]. |
3987 | 1978 |
^ sel |
1979 |
! |
|
1980 |
||
1981 |
selectedFileNames |
|
1982 |
^ self selectedFileItems collect:[:item| item fileName]. |
|
3887 | 1983 |
! |
1984 |
||
4978
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1985 |
selectedFiles |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1986 |
|
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1987 |
^ self selectedItemsWithoutDotDotDirectory collect:[:item| item fileName]. |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1988 |
! |
9ca1ae265211
selectedFiles for directoryContentsBrowser without the .. dir
penk
parents:
4976
diff
changeset
|
1989 |
|
3983 | 1990 |
selectedItems |
4713 | 1991 |
| selection | |
1992 |
||
1993 |
selection := self selectionInFileList value copy. |
|
1994 |
selection isNil ifTrue:[ ^ #()]. |
|
5870 | 1995 |
selection isSequenceable ifFalse:[ |
1996 |
selection := OrderedCollection with:selection |
|
1997 |
]. |
|
4972 | 1998 |
^ selection. |
1999 |
! |
|
2000 |
||
2001 |
selectedItemsWithoutDotDotDirectory |
|
2002 |
| selection | |
|
2003 |
||
5676 | 2004 |
selection := self selectionInFileList value. |
4972 | 2005 |
selection isNil ifTrue:[ ^ #()]. |
5868 | 2006 |
selection isSequenceable ifFalse:[ |
2007 |
selection := OrderedCollection with:selection. |
|
2008 |
]. |
|
8977
0fd3fcbb8fc7
copy asOrderedCollection -> copyAsOrderedCollection
Claus Gittinger <cg@exept.de>
parents:
8845
diff
changeset
|
2009 |
selection := selection copyAsOrderedCollection. |
4202 | 2010 |
(self viewDirsInContentsBrowser value and:[browserItemList notEmpty]) ifTrue:[ |
4713 | 2011 |
selection removeIdentical:(browserItemList first) ifAbsent:[nil] |
3887 | 2012 |
]. |
4713 | 2013 |
^ selection. |
3887 | 2014 |
! ! |
2015 |
||
4713 | 2016 |
!DirectoryContentsBrowser methodsFor:'startup & release'! |
3887 | 2017 |
|
2018 |
makeDependent |
|
2019 |
||
4007 | 2020 |
super makeDependent. |
3887 | 2021 |
self currentFileNameHolder addDependent:self. |
4027 | 2022 |
self currentSortOrder addDependent:self. |
4202 | 2023 |
self viewDirsInContentsBrowser addDependent:self. |
5869 | 2024 |
self sortDirectoriesBeforeFiles addDependent:self. |
4011 | 2025 |
self filterBlockHolder addDependent:self. |
3887 | 2026 |
self sortBlockHolder addDependent:self. |
2027 |
! |
|
2028 |
||
2029 |
postBuildBrowser:aWidget |
|
2030 |
||
4713 | 2031 |
browser := aWidget scrolledView. |
2032 |
browser wantsFocusWithPointerEnter. |
|
3887 | 2033 |
"/ dont register icons anymore |
2034 |
"/ FileBrowser icons keysAndValuesDo:[:aKey :anIcon| |
|
2035 |
"/ browser registerImage:anIcon key:aKey. |
|
2036 |
"/ ]. |
|
4960
c76ffd8375ae
startUpdatetask later (after colDescr is fix)
Claus Gittinger <cg@exept.de>
parents:
4957
diff
changeset
|
2037 |
"/ self columnDescriptors:(self tableColumns value). |
4071 | 2038 |
! |
2039 |
||
5444 | 2040 |
postOpenFromMaster:fromMaster |
4071 | 2041 |
|
4998 | 2042 |
self sortFileListsBy:(self sortBlockProperty value) withReverse:(self currentSortOrder value). |
7714 | 2043 |
self matchBlock:(self filterBlockHolder value). |
5444 | 2044 |
fromMaster ifFalse:[ |
5442 | 2045 |
self currentFileNameHolderChangedForCommon. |
2046 |
]. |
|
5443 | 2047 |
self currentFileNameHolderChanged. |
3887 | 2048 |
self viewedColumnsChanged. |
4960
c76ffd8375ae
startUpdatetask later (after colDescr is fix)
Claus Gittinger <cg@exept.de>
parents:
4957
diff
changeset
|
2049 |
self startUpdateTask. |
4071 | 2050 |
self windowGroup addPreEventHook:self. |
3887 | 2051 |
! |
2052 |
||
2053 |
release |
|
2054 |
"release my resources |
|
2055 |
" |
|
4342 | 2056 |
self stopUpdateTask. |
3887 | 2057 |
super release. |
2058 |
! |
|
2059 |
||
2060 |
releaseAsSubCanvas |
|
2061 |
||
4342 | 2062 |
self stopUpdateTask. |
3887 | 2063 |
^ super releaseAsSubCanvas. |
2064 |
! ! |
|
2065 |
||
4342 | 2066 |
!DirectoryContentsBrowser methodsFor:'update columns cycle'! |
3887 | 2067 |
|
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2068 |
findNextItemFor:aConditionBlock |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2069 |
|checkRowAndReturnItemIfConditionIsTrue |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2070 |
firstRowShown lastRowShown rLow rHigh numItems| |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2071 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2072 |
checkRowAndReturnItemIfConditionIsTrue := |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2073 |
[:row | |item| |
7963 | 2074 |
item := browserItemList at:row ifAbsent:nil. |
2075 |
item notNil ifTrue:[ |
|
2076 |
(aConditionBlock value:item) ifTrue:[ |
|
2077 |
^ item. |
|
2078 |
] |
|
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2079 |
]. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2080 |
]. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2081 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2082 |
firstRowShown := browser indexOfFirstRowShown. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2083 |
lastRowShown := browser indexOfLastRowShown. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2084 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2085 |
firstRowShown to:lastRowShown do:checkRowAndReturnItemIfConditionIsTrue. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2086 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2087 |
numItems := browserItemList size. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2088 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2089 |
rLow := firstRowShown - 1. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2090 |
rHigh := lastRowShown + 1. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2091 |
[(rLow >= 1) or:[ rHigh <= numItems]] whileTrue:[ |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2092 |
rLow >= 1 ifTrue:[ |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2093 |
checkRowAndReturnItemIfConditionIsTrue value:rLow. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2094 |
rLow := rLow - 1 |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2095 |
]. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2096 |
rHigh <= numItems ifTrue:[ |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2097 |
checkRowAndReturnItemIfConditionIsTrue value:rHigh. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2098 |
rHigh := rHigh + 1 |
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 |
^ nil. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2102 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2103 |
"/ ^ self allItems detect:aBlock ifNone:[nil]. |
4017 | 2104 |
! |
2105 |
||
2106 |
findNextVisibleItemFor:aConditionBlock |
|
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2107 |
|firstRow row item| |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2108 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2109 |
firstRow := browser indexOfFirstRowShown. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2110 |
firstRow <= 0 ifTrue:[firstRow := 1]. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2111 |
|
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2112 |
row := firstRow. |
6826 | 2113 |
[true] whileTrue:[ |
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2114 |
((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
|
2115 |
^ nil. |
3983 | 2116 |
]. |
8658
bf595f0cb6f5
changed #findNextVisibleItemFor:
Stefan Vogel <sv@exept.de>
parents:
8533
diff
changeset
|
2117 |
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
|
2118 |
(aConditionBlock value:item) ifTrue:[ |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2119 |
^ item. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2120 |
]. |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2121 |
row := row + 1. |
6826 | 2122 |
] |
2123 |
||
2124 |
"Modified: / 18-07-2006 / 08:56:47 / cg" |
|
3887 | 2125 |
! |
2126 |
||
5010 | 2127 |
getFileInfoFor:anItem |
3887 | 2128 |
|
2129 |
| type| |
|
2130 |
||
5010 | 2131 |
type := anItem fileName fileType. |
2132 |
anItem fileType:type. |
|
3887 | 2133 |
^ type |
2134 |
! |
|
2135 |
||
5010 | 2136 |
getIconFor:anItem |
3887 | 2137 |
|
2138 |
| key icon| |
|
3906 | 2139 |
|
5010 | 2140 |
key := anItem iconKey. |
3887 | 2141 |
icon := FileBrowser iconForKeyMatching:key. |
5010 | 2142 |
anItem isRemoteDirectory ifTrue:[ |
3906 | 2143 |
^ icon "/ do not query attributes |
2144 |
]. |
|
5010 | 2145 |
^ FileBrowser addOnIconsFor:(anItem fileName) to:icon. |
3887 | 2146 |
! |
2147 |
||
5010 | 2148 |
getIconForMimeType:mime for:anItem |
7908
820560688c8a
changed #getIconForMimeType:for:
Claus Gittinger <cg@exept.de>
parents:
7901
diff
changeset
|
2149 |
|currentIcon newIcon images| |
820560688c8a
changed #getIconForMimeType:for:
Claus Gittinger <cg@exept.de>
parents:
7901
diff
changeset
|
2150 |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2151 |
newIcon := FileBrowser iconForKeyMatching:mime. |
9323 | 2152 |
currentIcon := anItem iconOrNil. |
2153 |
||
2154 |
(currentIcon notNil and:[currentIcon class == MultiImage]) ifTrue:[ |
|
3887 | 2155 |
images := currentIcon images. |
2156 |
images removeFirst. |
|
2157 |
images addFirst:newIcon. |
|
7908
820560688c8a
changed #getIconForMimeType:for:
Claus Gittinger <cg@exept.de>
parents:
7901
diff
changeset
|
2158 |
^ currentIcon. |
3887 | 2159 |
]. |
9323 | 2160 |
^ newIcon. |
3887 | 2161 |
! |
2162 |
||
5010 | 2163 |
getIconForMimeTypeByContents:anItem |
2164 |
^ self getIconForMimeType:(anItem mimeTypeForContents) for:anItem |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2165 |
! |
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2166 |
|
5010 | 2167 |
getPreviewFor:anItem |
3887 | 2168 |
|
9225 | 2169 |
| column icon| |
3887 | 2170 |
|
9225 | 2171 |
column := browser columnDescriptorAt:previewIndex. |
3887 | 2172 |
column isNil ifTrue:[ |
2173 |
previewIndex := 0. |
|
2174 |
] ifFalse:[ |
|
5010 | 2175 |
(anItem hasMimeType and:[anItem mimeType isImage]) ifTrue:[ |
5238 | 2176 |
Error handle:[:ex| |
3887 | 2177 |
icon := nil. |
2178 |
] do:[ |scale extent w h | |
|
5010 | 2179 |
icon := Image fromFile:(anItem fileName pathName). |
3887 | 2180 |
icon notNil ifTrue:[ |
2181 |
extent := icon extent. |
|
2182 |
w := column width - 4. |
|
2183 |
h := column height. |
|
2184 |
||
2185 |
(extent x > w or:[extent y > h]) ifTrue:[ |
|
2186 |
scale := extent / (w@h). |
|
2187 |
scale := scale x max:(scale y). |
|
2188 |
icon := icon magnifiedTo:((extent / scale max:8.0) asInteger). |
|
2189 |
]. |
|
4713 | 2190 |
icon := icon onDevice:(browser device). |
3887 | 2191 |
icon clearMaskedPixels. |
2192 |
] |
|
2193 |
] |
|
2194 |
] ifFalse:[ icon := nil]. |
|
5010 | 2195 |
anItem preview:(icon ? ''). |
3887 | 2196 |
]. |
2197 |
^ icon |
|
2198 |
! |
|
2199 |
||
4342 | 2200 |
updateColumnsCycle |
6026
0a098f7a9e09
Stop update task when application is closed
Stefan Vogel <sv@exept.de>
parents:
5994
diff
changeset
|
2201 |
"update items in the following order |
4970 | 2202 |
- update item if item properties are changed |
2203 |
- update icon for visible items by suffix |
|
2204 |
- update icon for visible items by contents |
|
2205 |
- update file info for visible items if file info column is shown |
|
2206 |
- update preview for visible items if preview column is shown |
|
2207 |
||
2208 |
- update icon for invisible items by suffix |
|
2209 |
- update icon for invisible items by contents |
|
2210 |
- update file info for invisible items if file info column is shown |
|
2211 |
- 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
|
2212 |
- 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
|
2213 |
Return true, if more is to be done. |
4970 | 2214 |
" |
3887 | 2215 |
|
4404
1165b811a9a9
only ask once for mimeTypeOfContents
Claus Gittinger <cg@exept.de>
parents:
4402
diff
changeset
|
2216 |
|desc mime icon type preview| |
3887 | 2217 |
|
4017 | 2218 |
browserItemList notEmpty ifTrue:[ |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2219 |
"/ update item if item's properties have changed |
5475 | 2220 |
"/ desc := self findNextVisibleItemFor:[:n| n accessFirstTime ]. |
2221 |
"/ desc notNil ifTrue:[ |
|
2222 |
"/ browser invalidateVisibleRow:desc. |
|
2223 |
"/ self debugMessage:'item properties are changed ', desc baseName. |
|
2224 |
"/ ^ true. |
|
2225 |
"/ ]. |
|
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2226 |
|
3887 | 2227 |
"/ update icon for visible items by suffix |
9323 | 2228 |
desc := self findNextVisibleItemFor:[:n| n iconOrNil isNil ]. |
3967 | 2229 |
desc notNil ifTrue:[ |
3887 | 2230 |
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
|
2231 |
icon notNil ifTrue:[ |
12125 | 2232 |
icon ~= desc icon ifTrue:[ |
2233 |
desc icon:icon. |
|
2234 |
(iconIndex ~~ 0) ifTrue:[ |
|
2235 |
browser invalidateVisibleRow:desc colAt:iconIndex |
|
2236 |
]. |
|
2237 |
self debugMessage:'icon for visible items ', desc baseName. |
|
12205 | 2238 |
updatingColumns := true. |
2239 |
^ true |
|
12125 | 2240 |
]. |
2241 |
]. |
|
2242 |
]. |
|
2243 |
"/ update icon for visible items by contents |
|
2244 |
desc := self findNextVisibleItemFor: |
|
2245 |
[:n| |
|
2246 |
(n iconKey == #file |
|
2247 |
and:[(mime := n mimeTypeForContents asSymbol) ~= #unknown]) |
|
2248 |
]. |
|
2249 |
desc notNil ifTrue:[ |
|
2250 |
icon := self getIconForMimeType:mime for:desc. |
|
2251 |
"/ icon := self getIconForMimeTypeByContents:desc. |
|
2252 |
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
|
2253 |
desc icon:icon. |
4430ef82be3f
100% cpu busy loop, if an icon for an item
Claus Gittinger <cg@exept.de>
parents:
6382
diff
changeset
|
2254 |
(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
|
2255 |
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
|
2256 |
]. |
3967 | 2257 |
]. |
2258 |
^ true |
|
2259 |
]. |
|
3887 | 2260 |
"/ update file info for visible items if file info column is shown |
2261 |
fileDescriptionIndex ~~ 0 ifTrue:[ |
|
4345 | 2262 |
desc := self findNextVisibleItemFor:[:n| n fileType isEmpty ]. |
3887 | 2263 |
desc notNil ifTrue:[ |
2264 |
type := self getFileInfoFor:desc. |
|
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2265 |
type notNil ifTrue:[ |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2266 |
browser invalidateVisibleRow:desc colAt:fileDescriptionIndex |
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2267 |
]. |
5475 | 2268 |
self debugMessage:'file info for visible items if file info column is shown ', desc baseName. |
3887 | 2269 |
^ true |
2270 |
] |
|
2271 |
]. |
|
2272 |
"/ update preview for visible items if preview column is shown |
|
2273 |
previewIndex ~~ 0 ifTrue:[ |
|
4017 | 2274 |
desc := self findNextVisibleItemFor:[:n| n preview isNil ]. |
3887 | 2275 |
desc notNil ifTrue:[ |
2276 |
preview := self getPreviewFor:desc. |
|
2277 |
preview notNil ifTrue:[ |
|
4713 | 2278 |
browser invalidateVisibleRow:desc colAt:previewIndex |
3887 | 2279 |
]. |
5475 | 2280 |
self debugMessage:'preview for visible items if preview column is shown ', desc baseName. |
3887 | 2281 |
^ true |
2282 |
] |
|
2283 |
]. |
|
2284 |
]. |
|
2285 |
||
4349 | 2286 |
"/ validate invisible items to make them available after scrolling |
4342 | 2287 |
self allItems notEmpty ifTrue:[ |
3887 | 2288 |
"/ update icon for invisible items by suffix |
9323 | 2289 |
desc := self findNextItemFor:[:n| n iconOrNil isNil ]. |
3887 | 2290 |
desc notNil ifTrue:[ |
2291 |
icon := self getIconFor:desc. |
|
6440 | 2292 |
icon notNil ifTrue:[ |
2293 |
desc icon:icon. |
|
2294 |
browser invalidateVisibleRow:desc colAt:iconIndex. |
|
2295 |
self debugMessage:'icon for invisible items by suffix ', desc baseName. |
|
2296 |
^ true |
|
2297 |
]. |
|
3887 | 2298 |
]. |
2299 |
"/ update icon for invisible items by contents |
|
2300 |
desc := self findNextItemFor:[:n| (n iconKey == #file and:[n mimeTypeForContents ~= #unknown])]. |
|
2301 |
desc notNil ifTrue:[ |
|
2302 |
icon := self getIconForMimeTypeByContents:desc. |
|
2303 |
desc icon:icon. |
|
6222
8d7dfc929ab3
update visible and near-visible items first.
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2304 |
browser invalidateVisibleRow:desc colAt:iconIndex. |
5475 | 2305 |
self debugMessage:'icon for invisible items by contents ', desc baseName. |
3887 | 2306 |
^ true |
2307 |
]. |
|
2308 |
"/ update file info for invisible items if file info column is shown |
|
2309 |
fileDescriptionIndex ~~ 0 ifTrue:[ |
|
2310 |
desc := self findNextItemFor:[:n| n fileType isNil ]. |
|
2311 |
desc notNil ifTrue:[ |
|
2312 |
self getFileInfoFor:desc. |
|
5475 | 2313 |
self debugMessage:'update file info for invisible items if file info column is shown ', desc baseName. |
3887 | 2314 |
^ true |
2315 |
]. |
|
2316 |
]. |
|
2317 |
"/ update preview for invisible items if preview column is shown |
|
2318 |
previewIndex ~~ 0 ifTrue:[ |
|
2319 |
desc := self findNextItemFor:[:n| n preview isNil ]. |
|
2320 |
desc notNil ifTrue:[ |
|
2321 |
self getPreviewFor:desc. |
|
5475 | 2322 |
self debugMessage:'update preview for invisible items if preview column is shown: ', desc baseName. |
3887 | 2323 |
^ true |
2324 |
]. |
|
2325 |
]. |
|
2326 |
"/ update file info for invisible items if file info column is not shown |
|
2327 |
desc := self findNextItemFor:[:n| n fileType isNil ]. |
|
2328 |
desc notNil ifTrue:[ |
|
2329 |
self getFileInfoFor:desc. |
|
5475 | 2330 |
self debugMessage:'update file info for invisible items if file info column is not shown: ', desc baseName. |
3887 | 2331 |
^ true |
2332 |
]. |
|
2333 |
]. |
|
2334 |
^ false |
|
12125 | 2335 |
|
12205 | 2336 |
"Modified: / 20-03-2012 / 13:05:28 / cg" |
4342 | 2337 |
! ! |
2338 |
||
2339 |
!DirectoryContentsBrowser methodsFor:'update modification cycle'! |
|
2340 |
||
2341 |
modificationCycle |
|
5475 | 2342 |
| oldModificationTime desc| |
8496 | 2343 |
|
2344 |
directory isNil ifTrue:[^ self]. |
|
2345 |
||
2346 |
directory exists ifFalse:[ |
|
12125 | 2347 |
"/ directory vanished |
2348 |
directoryContentsChangeFlag := true. |
|
8496 | 2349 |
^ self |
2350 |
]. |
|
2351 |
directory isRootDirectory ifTrue:[ |
|
2352 |
^ self |
|
4342 | 2353 |
]. |
8496 | 2354 |
|
2355 |
oldModificationTime := modificationTime. |
|
2356 |
modificationTime := directory modificationTime. |
|
2357 |
||
2358 |
oldModificationTime ~= modificationTime ifTrue:[ |
|
12125 | 2359 |
directoryContentsChangeFlag := true. |
12205 | 2360 |
self wakeUpForDirectoryContentsChanged. |
8496 | 2361 |
^ self |
2362 |
]. |
|
2363 |
||
5475 | 2364 |
desc := self findNextItemFor:[:n| n hasBeenModified ]. |
8496 | 2365 |
|
5475 | 2366 |
desc notNil ifTrue:[ |
2367 |
desc resetItem. |
|
2368 |
browser invalidateVisibleRow:desc. |
|
2369 |
self debugMessage:'item is modified ', desc baseName. |
|
2370 |
^ self. |
|
2371 |
]. |
|
12125 | 2372 |
|
12205 | 2373 |
"Modified: / 20-03-2012 / 12:24:38 / cg" |
4342 | 2374 |
! ! |
2375 |
||
2376 |
!DirectoryContentsBrowser methodsFor:'update task'! |
|
2377 |
||
4346 | 2378 |
createItemList |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2379 |
"reread the whole list of items" |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2380 |
|
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2381 |
|rawFilteredItems| |
4342 | 2382 |
|
2383 |
directory notNil ifTrue:[ |
|
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2384 |
self allItems:self readDirectoryItems. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2385 |
rawFilteredItems := self evaluateFilter:(self allItems). |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2386 |
filteredItems := self sortBlockHolder value sortItemList:rawFilteredItems. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2387 |
|
4342 | 2388 |
"/ Transcript showCR:'getAllTime:', getAllTime asString. |
2389 |
"/ Transcript showCR:'filterTime:', filterTime asString. |
|
2390 |
"/ Transcript showCR:'sortTime:', sortTime asString. |
|
5780
0951e30d7914
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5777
diff
changeset
|
2391 |
"/ Transcript showCR:'time after sort', Timestamp now asString. |
4342 | 2392 |
] ifFalse:[ |
2393 |
self allItems:OrderedCollection new. |
|
2394 |
filteredItems := OrderedCollection new. |
|
2395 |
]. |
|
2396 |
self |
|
7539 | 2397 |
enqueueMessage:#setBrowserItemList: |
2398 |
for:self |
|
2399 |
arguments:(Array with:filteredItems). |
|
4342 | 2400 |
! |
2401 |
||
4346 | 2402 |
debugMessage:aString |
5716 | 2403 |
Debug == true ifTrue:[ |
4346 | 2404 |
Transcript showCR:aString |
2405 |
]. |
|
12125 | 2406 |
|
2407 |
" |
|
2408 |
Debug := true |
|
2409 |
Debug := false |
|
2410 |
" |
|
2411 |
||
2412 |
"Modified (comment): / 07-01-2012 / 16:30:25 / cg" |
|
4346 | 2413 |
! |
2414 |
||
2415 |
directoryChanged |
|
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2416 |
"reread the whole list of items" |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2417 |
|
5935
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2418 |
|pos| |
4346 | 2419 |
|
12205 | 2420 |
self setBrowserItemList:#(). |
2421 |
directoryContentsChangeFlag := true. |
|
2422 |
^ self. |
|
2423 |
||
4346 | 2424 |
self createItemList. |
5935
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2425 |
|
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2426 |
directory notNil ifTrue:[ |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2427 |
pos := AbstractFileBrowser directoryHistory getPositionFor:(directory pathName). |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2428 |
"/ self halt. |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2429 |
pos notNil ifTrue:[ |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2430 |
browser scrollToLine:pos. |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2431 |
] |
72f0c8866406
attempt to preserve scroll-position as per directory
Claus Gittinger <cg@exept.de>
parents:
5870
diff
changeset
|
2432 |
]. |
12125 | 2433 |
|
12205 | 2434 |
"Modified: / 20-03-2012 / 13:16:25 / cg" |
4346 | 2435 |
! |
2436 |
||
4342 | 2437 |
directoryContentsChanged |
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2438 |
|oldItems itemsToAdd itemsToRemove newItems newAllItems oldAllItems| |
4342 | 2439 |
|
2440 |
directory isNil ifTrue:[^ self]. |
|
12205 | 2441 |
|
2442 |
filterChangeFlag := false. |
|
2443 |
updatingColumns := true. |
|
2444 |
||
4342 | 2445 |
newAllItems := self readDirectoryItems. |
8496 | 2446 |
|
12205 | 2447 |
oldItems := filteredItems copy ? #(). |
2448 |
||
2449 |
(oldItems isEmptyOrNil |
|
2450 |
or:[newAllItems size > 150]) ifTrue:[ |
|
4346 | 2451 |
self createItemList. |
2452 |
^ self |
|
2453 |
]. |
|
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2454 |
|
4342 | 2455 |
newItems := self evaluateFilter:newAllItems. |
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2456 |
itemsToAdd := OrderedCollection new. |
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2457 |
itemsToRemove := OrderedCollection new. |
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2458 |
|
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2459 |
oldItems notEmptyOrNil ifTrue:[ |
4342 | 2460 |
"/ MERGE WITH CURRENT CONTENTS |
4894 | 2461 |
oldItems copy do:[:anOldItem| |
4342 | 2462 |
"/ remove no longer valid files |
5474 | 2463 |
(newItems includes:anOldItem) ifFalse:[ |
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2464 |
itemsToRemove add:anOldItem. |
4342 | 2465 |
oldItems removeIdentical:anOldItem |
2466 |
] |
|
2467 |
]. |
|
2468 |
]. |
|
2469 |
"/ add new files |
|
2470 |
newItems do:[:aNewItem| |
|
5474 | 2471 |
(oldItems includes:aNewItem) ifFalse:[ |
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2472 |
itemsToAdd add:aNewItem. |
4342 | 2473 |
] |
2474 |
]. |
|
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2475 |
oldAllItems := self allItems. |
12205 | 2476 |
oldAllItems notEmpty ifTrue:[ |
2477 |
itemsToRemove notEmpty ifTrue:[ |
|
12229 | 2478 |
oldAllItems removeAllFoundIn:itemsToRemove |
12205 | 2479 |
]. |
5716 | 2480 |
]. |
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2481 |
itemsToAdd do:[: aNewItem | |
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2482 |
(oldAllItems includes:aNewItem) ifFalse:[ |
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2483 |
oldAllItems add:aNewItem. |
5716 | 2484 |
] |
2485 |
]. |
|
4342 | 2486 |
|
2487 |
self |
|
2488 |
enqueueMessage:#value |
|
9880
06f533cdb0c7
changed: #directoryContentsChanged
Claus Gittinger <cg@exept.de>
parents:
9791
diff
changeset
|
2489 |
for:[ self browserItemListAdd:itemsToAdd remove:itemsToRemove. ] |
4342 | 2490 |
arguments:#(). |
2491 |
filteredItems := newItems. |
|
7572 | 2492 |
|
12229 | 2493 |
"Modified: / 23-03-2012 / 14:42:32 / cg" |
4342 | 2494 |
! |
2495 |
||
5010 | 2496 |
evaluateFilter:anItemsList |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2497 |
"return filtered items from anItemsList" |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2498 |
|
12205 | 2499 |
|showDir showHidden filterBlock newItemList noOfShownFiles noOfFiles showFiles| |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2500 |
|
4342 | 2501 |
noOfFiles := 0. |
12205 | 2502 |
noOfShownFiles := 0. |
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 |
showHidden := self showHiddenFiles value. |
4342 | 2505 |
showDir := self viewDirsInContentsBrowser value. |
5870 | 2506 |
showFiles := self viewFilesInContentsBrowser value. |
2507 |
||
12262 | 2508 |
filterBlock := self matchBlock ? [:v1 :v2 | true ]. |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2509 |
newItemList := anItemsList |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2510 |
select:[:eachItem | |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2511 |
|isDir showIt| |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2512 |
|
12308 | 2513 |
filterChangeFlag ifTrue:[^ nil]. |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2514 |
isDir := eachItem isDirectory. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2515 |
isDir ifFalse:[noOfFiles := noOfFiles + 1]. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2516 |
|
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2517 |
showIt := isDir |
9318 | 2518 |
ifTrue:[ showDir and:[ showHidden or:[ eachItem fileName isHidden not ]]] |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2519 |
ifFalse:[ showFiles and:[filterBlock |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2520 |
value:eachItem fileName |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2521 |
value:eachItem baseName]]. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2522 |
|
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2523 |
showIt ifTrue:[ |
12205 | 2524 |
isDir ifFalse:[noOfShownFiles := noOfShownFiles + 1]. |
9103
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2525 |
]. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2526 |
showIt |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2527 |
]. |
eba365efe5e6
hidden files (directories) handling
Claus Gittinger <cg@exept.de>
parents:
8998
diff
changeset
|
2528 |
|
12205 | 2529 |
self noOfShownFiles:noOfShownFiles noOfFiles:noOfFiles. |
4342 | 2530 |
^ newItemList |
12205 | 2531 |
|
12308 | 2532 |
"Modified: / 20-11-2012 / 14:28:33 / cg" |
4342 | 2533 |
! |
2534 |
||
2535 |
filterChanged |
|
5777
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2536 |
|newFilteredItems| |
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2537 |
|
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2538 |
newFilteredItems := self evaluateFilter:self allItems copy. |
12308 | 2539 |
filterChangeFlag ifTrue:[^ self]. |
2540 |
||
5777
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2541 |
newFilteredItems ~= filteredItems ifTrue:[ |
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2542 |
filteredItems := newFilteredItems. |
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2543 |
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
|
2544 |
self |
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2545 |
enqueueMessage:#value |
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2546 |
for:[ self setBrowserItemList:filteredItems ] |
8227 | 2547 |
arguments:#(). |
5777
d8ca0c8e0af5
dont update list after a filterChange, if the new filter
Claus Gittinger <cg@exept.de>
parents:
5740
diff
changeset
|
2548 |
]. |
12308 | 2549 |
|
2550 |
"Modified: / 20-11-2012 / 14:28:54 / cg" |
|
4342 | 2551 |
! |
2552 |
||
2553 |
readDirectoryItems |
|
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2554 |
|list contents itemClass| |
4342 | 2555 |
|
8496 | 2556 |
list := OrderedCollection new. |
2557 |
contents := DirectoryContents directoryNamed:directory. |
|
2558 |
||
2559 |
contents notEmptyOrNil ifTrue:[ |
|
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2560 |
itemClass := DirectoryContentsBrowser itemClass. |
8496 | 2561 |
modificationTime := contents modificationTime. |
2562 |
||
5010 | 2563 |
contents itemsDo:[:eachItem| |
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2564 |
list add:(itemClass forInfoItem:eachItem). |
4298 | 2565 |
]. |
4342 | 2566 |
]. |
2567 |
^ list |
|
2568 |
! |
|
2569 |
||
2570 |
sortBlockChanged |
|
2571 |
||
2572 |
filteredItems isNil ifTrue:[ ^ self]. |
|
5383 | 2573 |
filteredItems := self sortBlockHolder value sortItemList:filteredItems. |
4342 | 2574 |
self |
2575 |
enqueueMessage:#value |
|
4757 | 2576 |
for:[ self setBrowserItemList:filteredItems ] |
8227 | 2577 |
arguments:#(). |
4342 | 2578 |
! |
2579 |
||
2580 |
startUpdateTask |
|
9538 | 2581 |
(updateTask isNil or:[updateTask isDead]) ifTrue:[ |
4370 | 2582 |
updateTask := [ |
6026
0a098f7a9e09
Stop update task when application is closed
Stefan Vogel <sv@exept.de>
parents:
5994
diff
changeset
|
2583 |
[self isOpen] whileTrue:[ |
4370 | 2584 |
self updateStep |
2585 |
] |
|
2586 |
] newProcess. |
|
4342 | 2587 |
updateTask name:'DirectoryContentsBrowser updateTask'. |
2588 |
updateTask priorityRange:(Processor systemBackgroundPriority to:Processor activePriority). |
|
4370 | 2589 |
updateTask restartable:true. |
4342 | 2590 |
updateTask resume. |
2591 |
]. |
|
9538 | 2592 |
|
2593 |
"Modified: / 10-08-2010 / 14:03:57 / sr" |
|
4342 | 2594 |
! |
2595 |
||
2596 |
stopUpdateTask |
|
2597 |
||
2598 |
updateTask notNil ifTrue:[ |
|
2599 |
updateTask terminate. |
|
6026
0a098f7a9e09
Stop update task when application is closed
Stefan Vogel <sv@exept.de>
parents:
5994
diff
changeset
|
2600 |
updateTask := nil. |
4342 | 2601 |
]. |
2602 |
! |
|
2603 |
||
12125 | 2604 |
updateAfterTimeout:timeOut |
5474 | 2605 |
|
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2606 |
"/ Transcript showCR:'START'. |
5474 | 2607 |
self isBusy:true. |
2608 |
[ |
|
12125 | 2609 |
directoryChangeFlag ifTrue:[ |
2610 |
directoryChangeFlag := false. |
|
5474 | 2611 |
self debugMessage:'directoryChanged'. |
2612 |
self directoryChanged. |
|
2613 |
]. |
|
12125 | 2614 |
directoryContentsChangeFlag ifTrue:[ |
2615 |
directoryContentsChangeFlag := false. |
|
5474 | 2616 |
self debugMessage:'directoryContentsChanged'. |
2617 |
self directoryContentsChanged. |
|
2618 |
]. |
|
12125 | 2619 |
filterChangeFlag ifTrue:[ |
2620 |
filterChangeFlag := false. |
|
5474 | 2621 |
self debugMessage:'filterChanged'. |
2622 |
self filterChanged. |
|
2623 |
]. |
|
12125 | 2624 |
sortBlockChangeFlag ifTrue:[ |
2625 |
sortBlockChangeFlag := false. |
|
5474 | 2626 |
self debugMessage:'sortBlockChanged'. |
2627 |
self sortBlockChanged. |
|
2628 |
]. |
|
2629 |
timeOut ifTrue:[ |
|
2630 |
self debugMessage:'evaluate modification'. |
|
2631 |
self modificationCycle |
|
2632 |
]. |
|
2633 |
self updateColumnsCycle ifTrue:[ |
|
2634 |
self debugMessage:'next time another columns update'. |
|
12205 | 2635 |
updatingColumns := true. |
6226 | 2636 |
changeSema signal |
5475 | 2637 |
] ifFalse:[ |
6438
4430ef82be3f
100% cpu busy loop, if an icon for an item
Claus Gittinger <cg@exept.de>
parents:
6382
diff
changeset
|
2638 |
self debugMessage:'next time no column update'. |
12205 | 2639 |
updatingColumns := false. |
5474 | 2640 |
]. |
2641 |
] ensure:[ |
|
2642 |
self isBusy:false. |
|
6374 | 2643 |
updateCycleSemaphore signalIf |
5474 | 2644 |
]. |
2645 |
"/ Transcript showCR:'STOP'. |
|
12125 | 2646 |
|
2647 |
"Created: / 07-01-2012 / 16:27:50 / cg" |
|
2648 |
! |
|
2649 |
||
2650 |
updateStep |
|
2651 |
|timedOut sensor| |
|
2652 |
||
2653 |
"/ Processor yield. |
|
2654 |
||
2655 |
sensor := self windowGroup sensor. |
|
2656 |
(sensor anyButtonPressed or:[sensor shiftDown]) ifTrue:[ |
|
2657 |
Processor yield. |
|
2658 |
||
2659 |
"/ no update while scrolling |
|
12205 | 2660 |
timedOut := ( changeSema waitWithTimeoutMs:(self class updateTaskCyleTime milliseconds) ) isNil. |
12125 | 2661 |
timedOut ifFalse:[changeSema signal]. |
2662 |
^ self |
|
2663 |
]. |
|
2664 |
||
2665 |
AbortOperationRequest handle:[ |
|
2666 |
"/ to get out of a debugger loop... |
|
2667 |
self debugMessage:'got an abort signal'. |
|
2668 |
self directoryContentsChangeFlag:false. |
|
2669 |
self filterChangeFlag:false. |
|
2670 |
self sortBlockChangeFlag:false. |
|
2671 |
] do:[ |
|
12205 | 2672 |
(updatingColumns == true) ifTrue:[ |
2673 |
timedOut := false |
|
2674 |
] ifFalse:[ |
|
2675 |
self debugMessage:'sema wait'. |
|
2676 |
timedOut := (changeSema waitWithTimeoutMs:(self class updateTaskCyleTime asMilliseconds)) isNil. |
|
2677 |
self debugMessage:'timedOut:', timedOut asString. |
|
2678 |
]. |
|
12125 | 2679 |
|
2680 |
(filterChangeFlag |
|
2681 |
or:[ sortBlockChangeFlag |
|
2682 |
or:[ directoryChangeFlag |
|
12205 | 2683 |
or:[ directoryContentsChangeFlag |
2684 |
or:[ updatingColumns == true ]]]]) ifTrue:[ |
|
12125 | 2685 |
accessLock critical:[ |
2686 |
self updateAfterTimeout:timedOut. |
|
2687 |
]. |
|
2688 |
]. |
|
2689 |
]. |
|
2690 |
||
12205 | 2691 |
"Modified: / 20-03-2012 / 13:07:22 / cg" |
4342 | 2692 |
! ! |
2693 |
||
4862 | 2694 |
!DirectoryContentsBrowser methodsFor:'update task trigger'! |
2695 |
||
2696 |
wakeUp |
|
9538 | 2697 |
self isOpen ifTrue:[ |
2698 |
"/ the updateTask might be nil or dead.... |
|
2699 |
self startUpdateTask |
|
2700 |
]. |
|
6226 | 2701 |
changeSema signal. |
9538 | 2702 |
|
2703 |
"Modified: / 10-08-2010 / 14:07:40 / sr" |
|
4862 | 2704 |
! |
2705 |
||
2706 |
wakeUpForDirectoryChanged |
|
2707 |
self isBusy ifTrue:[ |
|
5474 | 2708 |
self isBusy:false. |
4862 | 2709 |
updateTask interruptWith:[AbortSignal raise]. |
2710 |
]. |
|
12125 | 2711 |
directoryChangeFlag := true. |
4862 | 2712 |
self wakeUp. |
12125 | 2713 |
|
2714 |
"Modified: / 07-01-2012 / 16:43:12 / cg" |
|
4862 | 2715 |
! |
2716 |
||
2717 |
wakeUpForDirectoryContentsChanged |
|
2718 |
||
2719 |
self directoryContentsChangeFlag:true. |
|
2720 |
self wakeUp. |
|
2721 |
! |
|
2722 |
||
2723 |
wakeUpForFilterChanged |
|
2724 |
||
2725 |
self filterChangeFlag:true. |
|
2726 |
self wakeUp. |
|
2727 |
! |
|
2728 |
||
2729 |
wakeUpForSortBlockChanged |
|
2730 |
||
2731 |
self sortBlockChangeFlag:true. |
|
2732 |
self wakeUp. |
|
2733 |
! ! |
|
2734 |
||
2735 |
!DirectoryContentsBrowser methodsFor:'update task-disk usage'! |
|
4555 | 2736 |
|
2737 |
diskUsageInKiloBytesFor:aDirectory |
|
6770 | 2738 |
|line sum kb| |
4555 | 2739 |
|
2740 |
OperatingSystem isUNIXlike ifTrue:[ |
|
2741 |
line := OperatingSystem getCommandOutputFrom:('du -s -k ' , aDirectory pathName). |
|
4559 | 2742 |
line notNil ifTrue:[ |
2743 |
kb := Number readFrom:line readStream. |
|
2744 |
]. |
|
4555 | 2745 |
^ kb |
2746 |
]. |
|
2747 |
||
6770 | 2748 |
sum := 0. |
2749 |
aDirectory recursiveDirectoryContentsDo:[:fnString | |
|
2750 |
|fn| |
|
2751 |
||
2752 |
fn := aDirectory construct:fnString. |
|
2753 |
fn isDirectory ifFalse:[ |
|
6809 | 2754 |
fn exists ifTrue:[ "/ cares for missing links in WinNT |
2755 |
sum := sum + fn fileSize |
|
2756 |
]. |
|
6770 | 2757 |
]. |
2758 |
]. |
|
2759 |
^ sum / 1024 |
|
6809 | 2760 |
|
2761 |
"Modified: / 04-07-2006 / 11:27:38 / cg" |
|
4555 | 2762 |
! |
2763 |
||
4781 | 2764 |
flushRememberedDiskUsageInfo |
2765 |
diskUsageInfo := nil. |
|
2766 |
! |
|
2767 |
||
4782 | 2768 |
flushRememberedDiskUsageInfoFor:aDirectory |
2769 |
|dirPath keysToRemove| |
|
2770 |
||
4783 | 2771 |
diskUsageInfo isNil ifTrue:[ ^ self ]. |
2772 |
||
4782 | 2773 |
dirPath := aDirectory pathName. |
2774 |
keysToRemove := diskUsageInfo keys |
|
2775 |
select:[:key | |
|
2776 |
key startsWith:dirPath |
|
2777 |
]. |
|
2778 |
diskUsageInfo removeAllKeys:keysToRemove. |
|
2779 |
! |
|
2780 |
||
4781 | 2781 |
isDiskUsageInfoStillValid:infoForDirectory for:aDirectoryPath |
4556 | 2782 |
|diskUsageRememberTime infoTimestamp infoKiloBytes infoMegaBytes| |
2783 |
||
2784 |
diskUsageRememberTime := 30. |
|
2785 |
||
2786 |
infoTimestamp := infoForDirectory key. |
|
2787 |
infoKiloBytes := infoForDirectory value. |
|
2788 |
infoMegaBytes := infoKiloBytes // 1024. |
|
2789 |
||
2790 |
"/ only update info every 30 seconds |
|
2791 |
"/ plus another second for every 5 megabytes |
|
2792 |
"/ (i.e. for 100 mb, keep info for 50seconds) |
|
2793 |
||
2794 |
diskUsageRememberTime := diskUsageRememberTime + (infoMegaBytes / 5). "/ another second for every megabyte |
|
2795 |
||
5780
0951e30d7914
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5777
diff
changeset
|
2796 |
(Timestamp now getSeconds - infoTimestamp getSeconds) > diskUsageRememberTime ifTrue:[ |
4556 | 2797 |
^ false |
2798 |
]. |
|
4781 | 2799 |
"/ (aDirectoryPath asFilename modificationTime > infoTimestamp) ifTrue:[ |
2800 |
"/ ^ false |
|
2801 |
"/ ]. |
|
4556 | 2802 |
^ true |
2803 |
! |
|
2804 |
||
4555 | 2805 |
showDiskUsageInfoFor:aDirectory as:kiloBytes |
2806 |
|kbString| |
|
2807 |
||
2808 |
kbString := UnitConverter fileSizeStringFor:(kiloBytes * 1024). |
|
2809 |
self notify:('%2 in %1' |
|
2810 |
bindWith:(aDirectory baseName "pathName" allBold) |
|
2811 |
with:(kbString , 'b') "allBold"). |
|
2812 |
! |
|
2813 |
||
4781 | 2814 |
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
|
2815 |
|aColOfFiles selectedFile info| |
4781 | 2816 |
|
7563 | 2817 |
aColOfFiles := self currentSelectedObjects. |
8252
17b35ca1a9ab
changed #startDiskUsageInfoProcess
Claus Gittinger <cg@exept.de>
parents:
8227
diff
changeset
|
2818 |
|
4781 | 2819 |
(aColOfFiles isEmpty or:[self currentFilesAreInSameDirectory not]) ifTrue:[ |
2820 |
^ self |
|
2821 |
]. |
|
2822 |
aColOfFiles size == 1 ifTrue:[ |
|
2823 |
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
|
2824 |
info := selectedFile linkInfo. |
5974 | 2825 |
(info notNil and:[info isSymbolicLink]) ifTrue:[ |
8372 | 2826 |
"/ self notify:'Symbolic link to: ' , (info path ? '') allBold |
4781 | 2827 |
] ifFalse:[ |
2828 |
self startDiskUsageInfoProcessFor:selectedFile. |
|
2829 |
]. |
|
2830 |
]. |
|
7563 | 2831 |
|
2832 |
"Modified: / 04-12-2006 / 13:15:40 / cg" |
|
4781 | 2833 |
! |
2834 |
||
4555 | 2835 |
startDiskUsageInfoProcessFor:selectedFile |
4556 | 2836 |
|directory dirPath infoForDirectory infoValue| |
4555 | 2837 |
|
2838 |
self showDiskUsageHolder value ifFalse:[^ self]. |
|
2839 |
||
2840 |
selectedFile isDirectory ifTrue:[ |
|
2841 |
directory := selectedFile |
|
2842 |
] ifFalse:[ |
|
2843 |
directory := selectedFile directory |
|
2844 |
]. |
|
2845 |
||
2846 |
dirPath := directory pathName. |
|
2847 |
diskUsageInfo isNil ifTrue:[ |
|
2848 |
diskUsageInfo := Dictionary new. |
|
2849 |
]. |
|
2850 |
infoForDirectory := diskUsageInfo at:dirPath ifAbsent:nil. |
|
2851 |
infoForDirectory notNil ifTrue:[ |
|
4781 | 2852 |
(self isDiskUsageInfoStillValid:infoForDirectory for:dirPath) ifTrue:[ |
4556 | 2853 |
infoValue := infoForDirectory value. |
4555 | 2854 |
]. |
2855 |
]. |
|
2856 |
||
2857 |
infoValue notNil ifTrue:[ |
|
2858 |
self showDiskUsageInfoFor:directory as:infoValue. |
|
2859 |
^ self. |
|
2860 |
]. |
|
2861 |
||
2862 |
diskUsageUpdateProcess notNil ifTrue:[ |
|
2863 |
diskUsageUpdateProcess terminate |
|
2864 |
]. |
|
2865 |
diskUsageUpdateProcess := |
|
2866 |
[ |
|
2867 |
|kiloBytes| |
|
2868 |
||
2869 |
self notify:('collecting disk usage of %1...' bindWith:directory baseName). |
|
2870 |
kiloBytes := self diskUsageInKiloBytesFor:directory. |
|
4559 | 2871 |
kiloBytes notNil ifTrue:[ |
9116
469bd38ba4c6
changed: #startDiskUsageInfoProcessFor:
Claus Gittinger <cg@exept.de>
parents:
9105
diff
changeset
|
2872 |
diskUsageInfo notNil ifTrue:[ |
469bd38ba4c6
changed: #startDiskUsageInfoProcessFor:
Claus Gittinger <cg@exept.de>
parents:
9105
diff
changeset
|
2873 |
diskUsageInfo at:dirPath put:(Timestamp now -> kiloBytes). |
469bd38ba4c6
changed: #startDiskUsageInfoProcessFor:
Claus Gittinger <cg@exept.de>
parents:
9105
diff
changeset
|
2874 |
self showDiskUsageInfoFor:directory as:kiloBytes. |
469bd38ba4c6
changed: #startDiskUsageInfoProcessFor:
Claus Gittinger <cg@exept.de>
parents:
9105
diff
changeset
|
2875 |
]. |
4559 | 2876 |
] |
4555 | 2877 |
] fork. |
2878 |
! ! |
|
2879 |
||
3887 | 2880 |
!DirectoryContentsBrowser::DirectoryContentsItem class methodsFor:'instance creation'! |
2881 |
||
3983 | 2882 |
fileName:aFilename |
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2883 |
| instance fileItem| |
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2884 |
|
3983 | 2885 |
aFilename asString = '..' ifTrue:[ |
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2886 |
instance := self new. |
3983 | 2887 |
instance fileName:aFilename. |
2888 |
^ instance. |
|
2889 |
]. |
|
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2890 |
fileItem := DirectoryContents contentsItemForFileName:aFilename. |
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2891 |
fileItem isNil ifTrue:[^ nil]. |
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2892 |
^ self forInfoItem:fileItem. |
3999
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2893 |
|
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2894 |
" |
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2895 |
DirectoryContentsItem fileName:'..' |
10b79980664c
get an item from dirContents
Claus Gittinger <cg@exept.de>
parents:
3996
diff
changeset
|
2896 |
" |
3983 | 2897 |
! |
2898 |
||
2899 |
forInfoItem:anItem |
|
3887 | 2900 |
| instance | |
7601
3958b3fb0caa
update of icons got corrupted
Claus Gittinger <cg@exept.de>
parents:
7584
diff
changeset
|
2901 |
|
3887 | 2902 |
instance := self new. |
3983 | 2903 |
instance fileName:anItem fileName. |
2904 |
anItem isRemoteDirectory ifTrue:[ |
|
2905 |
instance beRemoteDirectory. |
|
2906 |
] ifFalse:[ |
|
2907 |
instance fileInfo:anItem info. |
|
2908 |
]. |
|
3906 | 2909 |
^ instance |
3887 | 2910 |
! ! |
2911 |
||
2912 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'accessing'! |
|
2913 |
||
3983 | 2914 |
fileInfo:something |
2915 |
fileInfo := something. |
|
2916 |
! |
|
2917 |
||
3887 | 2918 |
fileName |
2919 |
^ fileName |
|
2920 |
! |
|
2921 |
||
2922 |
fileName:aFilename |
|
5994 | 2923 |
"set fileName" |
2924 |
||
4101 | 2925 |
fileName := aFilename asFilename. |
5994 | 2926 |
self assert:(fileName notNil). |
3887 | 2927 |
! |
2928 |
||
2929 |
fileType |
|
5994 | 2930 |
"returns the type of the file" |
2931 |
||
4345 | 2932 |
fileType isNil ifTrue:[ |
2933 |
fileType := ''. |
|
2934 |
]. |
|
3887 | 2935 |
^ fileType |
2936 |
! |
|
2937 |
||
2938 |
fileType:aType |
|
2939 |
fileType := aType. |
|
2940 |
! |
|
2941 |
||
2942 |
icon |
|
9323 | 2943 |
"answer the icon displayed in the table widget; if the icon is unspecified, |
2944 |
and the fileInfo is set a default icon is returned otherwise nil" |
|
2945 |
||
2946 |
|key| |
|
2947 |
||
2948 |
icon notNil ifTrue:[^ icon ]. |
|
2949 |
||
2950 |
key := #file. "/ default |
|
2951 |
||
2952 |
self isRemoteDirectory ifTrue:[ |
|
2953 |
key := #directory. |
|
2954 |
] ifFalse:[ |
|
2955 |
"do not fetch the fileInfo..." |
|
2956 |
fileInfo isNil ifTrue:[ ^ nil ]. |
|
2957 |
||
2958 |
self isDirectory ifTrue:[ |
|
2959 |
key := #directory. |
|
2960 |
] ifFalse:[ |
|
2961 |
self isSymbolicLink ifTrue:[ |
|
2962 |
key := #fileLink |
|
2963 |
] ifFalse:[ |
|
2964 |
key := #file |
|
2965 |
]. |
|
2966 |
]. |
|
2967 |
]. |
|
2968 |
^ MIMETypeIconLibrary iconForKey:key. |
|
3887 | 2969 |
! |
2970 |
||
2971 |
icon:anIcon |
|
2972 |
||
2973 |
icon := anIcon. |
|
2974 |
! |
|
2975 |
||
2976 |
iconKey |
|
2977 |
iconKey isNil ifTrue:[ |
|
3906 | 2978 |
self isRemoteDirectory ifTrue:[ |
2979 |
iconKey := FileBrowser iconKeyForRemoteDirectory:fileName. |
|
2980 |
] ifFalse:[ |
|
2981 |
iconKey := FileBrowser iconKeyForFile:fileName. |
|
2982 |
] |
|
3887 | 2983 |
]. |
2984 |
^ iconKey |
|
2985 |
! |
|
2986 |
||
9323 | 2987 |
iconOrNil |
2988 |
"answer the icon or nil if unspecifed" |
|
2989 |
||
2990 |
^ icon |
|
2991 |
! |
|
2992 |
||
3887 | 2993 |
isDirectory |
3967 | 2994 |
self isRemoteDirectory ifTrue:[^ true]. |
2995 |
||
2996 |
self getFileInfo. |
|
2997 |
fileInfo isNil ifTrue:[^ false]. |
|
2998 |
^ fileInfo isDirectory |
|
2999 |
! |
|
3887 | 3000 |
|
3967 | 3001 |
isSymbolicLink |
3002 |
self isRemoteDirectory ifTrue:[^ false]. |
|
3003 |
||
3004 |
self getFileInfo. |
|
3005 |
fileInfo isNil ifTrue:[^ false]. |
|
3006 |
^ fileInfo isSymbolicLink |
|
3887 | 3007 |
! |
3008 |
||
3009 |
lastButOneSuffix |
|
3010 |
"returns the suffix of the file |
|
3011 |
" |
|
3012 |
||
3013 |
^ self suffixes at:2 |
|
3014 |
! |
|
3015 |
||
3016 |
lastSuffix |
|
3017 |
"returns the suffix of the file |
|
3018 |
" |
|
3019 |
||
3020 |
^ self suffixes at:1 |
|
3021 |
! |
|
3022 |
||
4988 | 3023 |
linkTargetIsDirectory |
3024 |
self isSymbolicLink ifFalse:[^ false]. |
|
3025 |
||
3026 |
^ fileName info isDirectory |
|
3027 |
! |
|
3028 |
||
3887 | 3029 |
mimeType |
3030 |
mimeType isNil ifTrue:[ |
|
3031 |
mimeType := MIMETypes mimeTypeForFilename:(self fileName). |
|
3032 |
mimeType isNil ifTrue:[ |
|
3033 |
mimeType := #unknown |
|
3034 |
] |
|
3035 |
]. |
|
3036 |
^ mimeType |
|
3037 |
! |
|
3038 |
||
3039 |
preview |
|
3040 |
||
3041 |
^ preview |
|
3042 |
! |
|
3043 |
||
3044 |
preview:aLabel |
|
3045 |
||
3046 |
preview := aLabel. |
|
3047 |
! |
|
3048 |
||
3049 |
suffix |
|
3050 |
"returns the suffix of the file |
|
3051 |
" |
|
4017 | 3052 |
self isDirectory ifTrue:[^'']. |
3887 | 3053 |
suffix isNil ifTrue:[ |
3054 |
(OperatingSystem isUNIXlike and:[(self baseName at:1) == $.]) ifTrue:[ |
|
3055 |
suffix := ''. |
|
3056 |
] ifFalse:[ |
|
3057 |
suffix := fileName suffix. |
|
3058 |
] |
|
3059 |
]. |
|
3060 |
^ suffix |
|
3061 |
! |
|
3062 |
||
3063 |
suffixes |
|
3064 |
||
3065 |
| lastSuff lastButOneSuff| |
|
3066 |
||
3967 | 3067 |
(fileName name occurrencesOf:$.) <= 1 ifTrue:[ |
3068 |
^ Array with:(self suffix) with:nil. |
|
3069 |
]. |
|
3070 |
(fileName baseName occurrencesOf:$.) <= 1 ifTrue:[ |
|
3071 |
^ Array with:(self suffix) with:nil. |
|
3072 |
]. |
|
3887 | 3073 |
|
3967 | 3074 |
((lastSuff := self suffix) isEmpty) ifTrue:[ |
3075 |
lastSuff := nil. |
|
3076 |
] ifFalse:[ |
|
3077 |
lastSuff := lastSuff asLowercase. |
|
3078 |
]. |
|
3079 |
||
3080 |
((lastButOneSuff := fileName withoutSuffix suffix) isEmpty) ifTrue:[ |
|
3081 |
lastButOneSuff := nil. |
|
3082 |
] ifFalse:[ |
|
3083 |
lastButOneSuff := lastButOneSuff asLowercase. |
|
3084 |
]. |
|
3085 |
||
3086 |
(lastSuff notNil and:[lastButOneSuff notNil]) ifTrue:[ |
|
3087 |
(lastSuff = 'bak' or:[lastSuff = 'sav']) ifTrue:[ |
|
3088 |
lastSuff := lastButOneSuff. |
|
3887 | 3089 |
lastButOneSuff := nil. |
3967 | 3090 |
] |
3887 | 3091 |
]. |
3967 | 3092 |
^ Array with:lastSuff with:lastButOneSuff |
3887 | 3093 |
! |
3094 |
||
3095 |
type |
|
3096 |
"returns the type of the file |
|
3097 |
" |
|
3098 |
^ self valueAt:#type |
|
3099 |
||
3100 |
! ! |
|
3101 |
||
3102 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'actions'! |
|
3103 |
||
3104 |
resetImageFile |
|
3105 |
" if the image preview extent is changed the icon will set to nil to force the update task to reload the image " |
|
3106 |
||
3107 |
(mimeType notNil and:[ mimeType isImage]) ifTrue:[ |
|
3108 |
preview := nil |
|
3109 |
] |
|
3110 |
! |
|
3111 |
||
5475 | 3112 |
resetItem |
3887 | 3113 |
" dont know what someone else is doing with the file - read all item properties new " |
5994 | 3114 |
|
3887 | 3115 |
fileInfo := nil. |
3116 |
icon := nil. |
|
3117 |
fileType := nil. |
|
3118 |
preview := nil. |
|
3119 |
owner := nil. |
|
3120 |
group := nil. |
|
4073 | 3121 |
iconKey := nil. |
3122 |
mimeTypeForContents := nil. |
|
3123 |
mimeType := nil. |
|
3887 | 3124 |
! ! |
3125 |
||
3126 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'change queries'! |
|
3127 |
||
3967 | 3128 |
hasBeenModified |
5994 | 3129 |
"check if item modification time has changed" |
3130 |
||
3131 |
|info| |
|
3887 | 3132 |
|
3906 | 3133 |
self isRemoteDirectory ifTrue:[^ false]. |
8496 | 3134 |
"/ root directories are not verified |
3135 |
fileName isRootDirectory ifTrue:[ ^ false ]. |
|
3136 |
||
3906 | 3137 |
|
5475 | 3138 |
fileInfo isNil ifTrue:[ |
3139 |
"first time of invokation " |
|
3140 |
info := self getFileInfo. |
|
3141 |
info isNil ifTrue:[ ^ false]. |
|
3142 |
^ true |
|
3887 | 3143 |
]. |
8372 | 3144 |
fileInfo isSymbolicLink ifTrue:[ |
3145 |
"/ symbolic links are not verified |
|
3146 |
^ false |
|
3147 |
]. |
|
3148 |
||
5475 | 3149 |
self modificationTime ~= fileName modificationTime ifTrue:[ |
3887 | 3150 |
^ true |
3151 |
]. |
|
3152 |
^ false |
|
3153 |
! ! |
|
3154 |
||
6188 | 3155 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'comparing'! |
3887 | 3156 |
|
5010 | 3157 |
= anItem |
3158 |
||
3159 |
"/ Transcript showCR:(anItem species == self species). |
|
3160 |
anItem species == self species ifFalse:[ ^ false]. |
|
3161 |
anItem isNil ifTrue:[ ^ false]. |
|
3162 |
^ (self fileName = anItem fileName) |
|
3887 | 3163 |
! |
3164 |
||
3165 |
hash |
|
3166 |
^ fileName hash |
|
3167 |
! ! |
|
3168 |
||
3169 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'presentation'! |
|
3170 |
||
3171 |
baseName |
|
5994 | 3172 |
"returns the baseName of the file" |
3173 |
||
10559
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3174 |
baseName isNil ifTrue:[ |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3175 |
baseName := fileName baseName. |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3176 |
fileName isDirectory ifTrue:[ |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3177 |
baseName := baseName allBold. |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3178 |
]. |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3179 |
]. |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3180 |
^ baseName |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3181 |
|
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3182 |
"Modified: / 09-08-2011 / 14:48:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3887 | 3183 |
! |
3184 |
||
3185 |
baseNameWithOutSuffix |
|
5994 | 3186 |
"returns the baseName of the file" |
3187 |
||
10559
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3188 |
| baseNameWithOutSuffix | |
3887 | 3189 |
|
4017 | 3190 |
self isDirectory ifTrue:[^ self baseName]. |
10559
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3191 |
baseNameWithOutSuffix := self baseName asFilename withoutSuffix asString. |
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3192 |
(baseNameWithOutSuffix isEmpty or:[baseNameWithOutSuffix = '.']) ifTrue:[ |
3887 | 3193 |
^ self baseName |
3194 |
]. |
|
10559
e36369957676
Directories are displayed in bold font for easier navigation
vrany
parents:
10300
diff
changeset
|
3195 |
^ baseNameWithOutSuffix. |
3887 | 3196 |
! |
3197 |
||
3198 |
date |
|
5994 | 3199 |
"returns the modTimeString" |
3200 |
||
3887 | 3201 |
| modTime | |
3202 |
||
3967 | 3203 |
modTime := self modificationTime. |
3204 |
modTime isNil ifTrue:[ |
|
3205 |
^ '???' |
|
3887 | 3206 |
]. |
3967 | 3207 |
^ modTime asDate printString. |
3887 | 3208 |
! |
3209 |
||
3210 |
fileInfoString |
|
3211 |
"get stat info on selected file - return a string which can be |
|
3212 |
shown in a box" |
|
3213 |
||
3214 |
| afileType | |
|
3215 |
||
3216 |
fileName isNil ifTrue:[^ nil]. |
|
3217 |
afileType := self fileType. |
|
3218 |
afileType isNil ifTrue:[ |
|
3219 |
^ ''. |
|
3220 |
]. |
|
3221 |
^ afileType |
|
3222 |
! |
|
3223 |
||
3967 | 3224 |
fileSize |
5994 | 3225 |
"returns the fileSize" |
3226 |
||
3967 | 3227 |
self getFileInfo. |
3228 |
fileInfo isNil ifTrue:[^ nil]. |
|
3229 |
||
3230 |
^ fileInfo fileSize |
|
3231 |
! |
|
3232 |
||
3887 | 3233 |
group |
5994 | 3234 |
"returns the printable group" |
3235 |
||
3887 | 3236 |
|gid| |
3237 |
||
3238 |
group isNil ifTrue:[ |
|
3967 | 3239 |
self getFileInfo. |
3240 |
fileInfo isNil ifTrue:[^ '???']. |
|
3241 |
||
3242 |
gid := fileInfo gid. |
|
3243 |
(LastGIDToGroupNameMapping notNil and:[gid == LastGIDToGroupNameMapping key]) ifTrue:[ |
|
3244 |
group := LastGIDToGroupNameMapping value |
|
3245 |
] ifFalse:[ |
|
3246 |
group := OperatingSystem getGroupNameFromID:gid. |
|
3247 |
LastGIDToGroupNameMapping := gid -> group. |
|
3248 |
] |
|
3887 | 3249 |
]. |
3250 |
^ group |
|
3251 |
! |
|
3252 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3253 |
inodeNumber |
5994 | 3254 |
"returns the inode number" |
3255 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3256 |
self getFileInfo. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3257 |
fileInfo isNil ifTrue:[^ nil]. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3258 |
^ fileInfo id |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3259 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4972
diff
changeset
|
3260 |
|
3887 | 3261 |
modificationTime |
5994 | 3262 |
"returns the absolute time of modification" |
3263 |
||
3967 | 3264 |
self getFileInfo. |
3265 |
fileInfo isNil ifTrue:[^ nil]. |
|
3266 |
||
3267 |
^ fileInfo modificationTime |
|
3887 | 3268 |
! |
3269 |
||
3270 |
owner |
|
5994 | 3271 |
"returns the printable owner" |
3272 |
||
3887 | 3273 |
|uid| |
3274 |
||
3275 |
owner isNil ifTrue:[ |
|
3967 | 3276 |
self getFileInfo. |
3277 |
fileInfo isNil ifTrue:[^ '???']. |
|
3278 |
||
3279 |
uid := fileInfo uid. |
|
3280 |
(LastUIDToUserNameMapping notNil and:[uid == LastUIDToUserNameMapping key]) ifTrue:[ |
|
3281 |
owner := LastUIDToUserNameMapping value |
|
3282 |
] ifFalse:[ |
|
3283 |
owner := OperatingSystem getUserNameFromID:uid. |
|
3284 |
LastUIDToUserNameMapping := uid -> owner. |
|
3285 |
] |
|
3887 | 3286 |
]. |
3287 |
^ owner |
|
3288 |
! |
|
3289 |
||
3290 |
permissions |
|
5994 | 3291 |
"returns the permissions as printable string" |
3292 |
||
3967 | 3293 |
|mode permissionString| |
3887 | 3294 |
|
3967 | 3295 |
self getFileInfo. |
3296 |
fileInfo isNil ifTrue:[^ '???'.]. |
|
3887 | 3297 |
|
3967 | 3298 |
mode := fileInfo mode. |
3299 |
permissionString := String new:9 withAll:$-. |
|
3300 |
||
3301 |
1 to:9 by:3 do:[:i| |
|
3302 |
(mode bitAt:i ) == 1 ifTrue:[permissionString at:10 - i put:$x]. |
|
3303 |
(mode bitAt:i + 1) == 1 ifTrue:[permissionString at:9 - i put:$w]. |
|
3304 |
(mode bitAt:i + 2) == 1 ifTrue:[permissionString at:8 - i put:$r]. |
|
3887 | 3305 |
]. |
3967 | 3306 |
^ permissionString |
3887 | 3307 |
! |
3308 |
||
4970 | 3309 |
sizeInBytesString |
3310 |
|locSize| |
|
3311 |
||
3312 |
locSize := self fileSize. |
|
3313 |
locSize isNil ifTrue:[^ '???']. |
|
3314 |
||
3315 |
^ locSize printString "/ leftPaddedTo:8. |
|
3316 |
! |
|
3317 |
||
5312 | 3318 |
sizeInKiloBytesString |
3319 |
|locSize| |
|
3320 |
||
3321 |
locSize := self fileSize. |
|
3322 |
locSize isNil ifTrue:[^ '???']. |
|
3323 |
||
3324 |
(locSize \\ 1024) == 0 ifTrue:[ |
|
3325 |
^ (locSize // 1024) printString , ' ' |
|
3326 |
]. |
|
3327 |
^ ((locSize / 1024) asFixedPoint:1) printString |
|
3328 |
! |
|
3329 |
||
3887 | 3330 |
sizeString |
5994 | 3331 |
"returns the size of the file" |
3332 |
||
3333 |
| unitString locSize| |
|
3887 | 3334 |
|
3967 | 3335 |
locSize := self fileSize. |
3336 |
locSize isNil ifTrue:[^ '???']. |
|
3337 |
||
4402
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
3338 |
unitString := UnitConverter fileSizeStringFor:locSize. |
c13678e65aa8
sizeCol is aligned on the decimalPoint
Claus Gittinger <cg@exept.de>
parents:
4376
diff
changeset
|
3339 |
^ unitString withoutSeparators "/ leftPaddedTo:8. |
3887 | 3340 |
! |
3341 |
||
3342 |
timeAndDate |
|
5994 | 3343 |
"returns the time- and date string" |
3344 |
||
5338 | 3345 |
|resources format modTime date| |
3887 | 3346 |
|
3967 | 3347 |
modTime := self modificationTime. |
3348 |
modTime isNil ifTrue:[ |
|
3349 |
^ '???' |
|
3887 | 3350 |
]. |
4938 | 3351 |
|
5338 | 3352 |
resources := FileBrowser resources. |
3353 |
||
4938 | 3354 |
"/ format := '%(year)-%(mon)-%(day) %h:%m:%s'. |
3355 |
date := modTime asDate. |
|
3356 |
date = Date today ifTrue:[ |
|
5338 | 3357 |
format := (resources string:'Today') , ' %(yearOrTime)' |
4938 | 3358 |
] ifFalse:[ |
3359 |
false "date = Date yesterday" ifTrue:[ |
|
5338 | 3360 |
format := (resources string:'Yesterday') , ' %(yearOrTime)' |
4938 | 3361 |
] ifFalse:[ |
8845
471945efed1c
Smalltalk language -> UserPreferences current language
Claus Gittinger <cg@exept.de>
parents:
8715
diff
changeset
|
3362 |
UserPreferences current languageTerritory == #us ifTrue:[ |
4938 | 3363 |
format := '%(ShortMonthName), %(dayPadded) %(yearOrTime)'. |
3364 |
] ifFalse:[ |
|
3365 |
format :='%(day)-%(ShortMonthName) %(yearOrTime)'. |
|
3366 |
]. |
|
3367 |
]. |
|
3967 | 3368 |
]. |
4938 | 3369 |
|
3370 |
^ modTime printStringFormat:format. |
|
3887 | 3371 |
! ! |
3372 |
||
5716 | 3373 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'printing'! |
3374 |
||
3375 |
printOn:aStream |
|
3376 |
super printOn:aStream. |
|
8003
7af5b26e1723
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
7963
diff
changeset
|
3377 |
aStream |
7af5b26e1723
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
7963
diff
changeset
|
3378 |
nextPut:$[; |
7af5b26e1723
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
7963
diff
changeset
|
3379 |
nextPutAll:fileName asString; |
7af5b26e1723
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
7963
diff
changeset
|
3380 |
nextPut:$]. |
5716 | 3381 |
! ! |
3382 |
||
3887 | 3383 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'private'! |
3384 |
||
3967 | 3385 |
getFileInfo |
3887 | 3386 |
fileInfo isNil ifTrue:[ |
3906 | 3387 |
self isRemoteDirectory ifTrue:[ |
3388 |
"/ do not access, to avoid automount |
|
3887 | 3389 |
] ifFalse:[ |
3967 | 3390 |
fileInfo := fileName linkInfo. |
3391 |
]. |
|
3392 |
]. |
|
3393 |
^ fileInfo |
|
3887 | 3394 |
! ! |
3395 |
||
3396 |
!DirectoryContentsBrowser::DirectoryContentsItem methodsFor:'queries'! |
|
3397 |
||
3906 | 3398 |
beRemoteDirectory |
3399 |
fileType := #remoteDirectory. |
|
3400 |
! |
|
3401 |
||
3887 | 3402 |
exists |
3403 |
^ fileName exists |
|
3404 |
! |
|
3405 |
||
3406 |
hasMimeType |
|
3407 |
||
3408 |
^ (self mimeType ~= #unknown) |
|
3409 |
! |
|
3410 |
||
3906 | 3411 |
isRemoteDirectory |
3412 |
^ fileType == #remoteDirectory |
|
3413 |
! |
|
3414 |
||
3887 | 3415 |
mimeTypeForContents |
3416 |
||
3417 |
mimeTypeForContents isNil ifTrue:[ |
|
3418 |
mimeTypeForContents := MIMETypes mimeTypeOfContents:(self fileName). |
|
3419 |
mimeTypeForContents isNil ifTrue:[ |
|
3420 |
mimeTypeForContents := #unknown |
|
3421 |
] ifFalse:[ |
|
3422 |
" set mimeType to mimeType of contents if a better mimeType is found " |
|
3423 |
mimeType := mimeTypeForContents. |
|
3424 |
iconKey := mimeTypeForContents. |
|
3425 |
] |
|
3426 |
]. |
|
3427 |
^ mimeTypeForContents |
|
3428 |
! ! |
|
3429 |
||
3430 |
!DirectoryContentsBrowser class methodsFor:'documentation'! |
|
3431 |
||
3432 |
version |
|
12308 | 3433 |
^ '$Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.249 2012/11/21 07:42:59 cg Exp $' |
8845
471945efed1c
Smalltalk language -> UserPreferences current language
Claus Gittinger <cg@exept.de>
parents:
8715
diff
changeset
|
3434 |
! |
471945efed1c
Smalltalk language -> UserPreferences current language
Claus Gittinger <cg@exept.de>
parents:
8715
diff
changeset
|
3435 |
|
471945efed1c
Smalltalk language -> UserPreferences current language
Claus Gittinger <cg@exept.de>
parents:
8715
diff
changeset
|
3436 |
version_CVS |
12308 | 3437 |
^ '§Header: /cvs/stx/stx/libtool/DirectoryContentsBrowser.st,v 1.249 2012/11/21 07:42:59 cg Exp §' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
3438 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
3439 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
3440 |
version_SVN |
12308 | 3441 |
^ '$Id: DirectoryContentsBrowser.st 8074 2012-11-30 17:23:39Z vranyj1 $' |
12125 | 3442 |
! ! |