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