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