author | penk |
Mon, 28 Oct 2002 13:37:51 +0100 | |
changeset 4080 | c32f68f51f47 |
parent 4071 | f923c8257818 |
child 4085 | 9e58ddfa6969 |
permissions | -rw-r--r-- |
3892 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
AbstractFileBrowser subclass:#DirectoryTreeBrowser |
|
4071 | 4 |
instanceVariableNames:'dirBrowser updateToExternFileHolderLock oldDropItem |
3995
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
5 |
expandItemTimedBlock updateTreeSelection inDropMode canDropItem |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
6 |
doubleClickAction newVisibilityHolder allowFileOperations |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
7 |
multipleSelect treeSelectionHolder' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
8 |
classVariableNames:'' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
9 |
poolDictionaries:'' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
10 |
category:'Interface-Tools-File' |
3892 | 11 |
! |
12 |
||
13 |
HierarchicalFileList subclass:#DirTreeBrowserHFL |
|
3995
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
14 |
instanceVariableNames:'draggedItem grayDirectoryIcon' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
15 |
classVariableNames:'' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
16 |
poolDictionaries:'' |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
17 |
privateIn:DirectoryTreeBrowser |
3892 | 18 |
! |
19 |
||
20 |
!DirectoryTreeBrowser class methodsFor:'documentation'! |
|
21 |
||
22 |
documentation |
|
23 |
" |
|
24 |
documentation to be added. |
|
25 |
||
26 |
[author:] |
|
27 |
Christian Penk (penk@bierfix) |
|
28 |
||
29 |
[see also:] |
|
30 |
||
31 |
[instance variables:] |
|
32 |
||
33 |
[class variables:] |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
examples |
|
38 |
" |
|
39 |
Starting the application: |
|
40 |
[exBegin] |
|
41 |
DirectoryTreeBrowser open |
|
42 |
||
43 |
[exEnd] |
|
44 |
||
45 |
more examples to be added: |
|
46 |
[exBegin] |
|
47 |
... add code fragment for |
|
48 |
... executable example here ... |
|
49 |
[exEnd] |
|
50 |
" |
|
51 |
! ! |
|
52 |
||
53 |
!DirectoryTreeBrowser class methodsFor:'instance creation'! |
|
54 |
||
55 |
open |
|
56 |
||
57 |
^ super open |
|
58 |
" |
|
59 |
DirectoryTreeBrowser open |
|
60 |
" |
|
61 |
! |
|
62 |
||
63 |
openOn:aFileName |
|
64 |
||
65 |
| file | |
|
66 |
file := aFileName asFilename. |
|
67 |
file exists ifTrue:[ |
|
68 |
self openOn:aFileName withFiles:(file isDirectory not) |
|
69 |
] |
|
70 |
||
71 |
" |
|
72 |
DirectoryTreeBrowser openOn:Filename homeDirectory |
|
73 |
DirectoryTreeBrowser openOn:(Filename homeDirectory construct:'.bashrc') |
|
74 |
" |
|
75 |
! |
|
76 |
||
77 |
openOn:aFileName withFiles:aBoolean |
|
78 |
||
79 |
| instance| |
|
80 |
||
81 |
instance := DirectoryTreeBrowser new. |
|
82 |
instance open. |
|
83 |
instance viewFilesInDirectoryTree value:aBoolean. |
|
84 |
instance currentFileNameHolder value:(OrderedCollection with:aFileName). |
|
85 |
" |
|
86 |
DirectoryTreeBrowser openOn:Filename homeDirectory |
|
87 |
DirectoryTreeBrowser openOn:(Filename homeDirectory construct:'.bashrc') withFiles:false |
|
88 |
" |
|
89 |
! ! |
|
90 |
||
91 |
!DirectoryTreeBrowser class methodsFor:'defaults'! |
|
92 |
||
93 |
timeForExpandOnDropInMilliseconds |
|
94 |
||
95 |
^ 1500 |
|
96 |
! ! |
|
97 |
||
98 |
!DirectoryTreeBrowser class methodsFor:'interface specs'! |
|
99 |
||
100 |
windowSpec |
|
101 |
"This resource specification was automatically generated |
|
102 |
by the UIPainter of ST/X." |
|
103 |
||
104 |
"Do not manually edit this!! If it is corrupted, |
|
105 |
the UIPainter may not be able to read the specification." |
|
106 |
||
107 |
" |
|
108 |
UIPainter new openOnClass:DirectoryTreeBrowser andSelector:#windowSpec |
|
109 |
DirectoryTreeBrowser new openInterface:#windowSpec |
|
110 |
DirectoryTreeBrowser open |
|
111 |
" |
|
112 |
||
113 |
<resource: #canvas> |
|
114 |
||
115 |
^ |
|
116 |
#(#FullSpec |
|
117 |
#name: #windowSpec |
|
118 |
#window: |
|
119 |
#(#WindowSpec |
|
120 |
#label: 'DirectoryTreeBrowser' |
|
121 |
#name: 'DirectoryTreeBrowser' |
|
122 |
#min: #(#Point 10 10) |
|
123 |
#max: #(#Point 1024 768) |
|
124 |
#bounds: #(#Rectangle 16 42 316 342) |
|
125 |
#menu: #mainMenu |
|
126 |
) |
|
127 |
#component: |
|
128 |
#(#SpecCollection |
|
129 |
#collection: #( |
|
130 |
#(#HierarchicalListViewSpec |
|
131 |
#name: 'HierarchicalListView' |
|
132 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
133 |
#model: #treeSelectionHolder |
|
134 |
#menu: #menu |
|
135 |
#hasHorizontalScrollBar: true |
|
136 |
#hasVerticalScrollBar: true |
|
137 |
#miniScrollerHorizontal: false |
|
138 |
#miniScrollerVertical: false |
|
139 |
#listModel: #fileList |
|
140 |
#multipleSelectOk: true |
|
3982 | 141 |
#useIndex: false |
3906 | 142 |
#highlightMode: #label |
3892 | 143 |
#doubleClickSelector: #doDoubleClick: |
144 |
#indicatorSelector: #doIndicatorClick: |
|
145 |
#postBuildCallback: #postBuildDirBrowser: |
|
146 |
#properties: |
|
147 |
#(#PropertyListDictionary |
|
3982 | 148 |
#overSelector: #dropOver: |
3892 | 149 |
#dragArgument: #directoryTreeBrowser |
150 |
#startDragSelector: #doStartDrag:in: |
|
151 |
#displayObjectSelector: #getDisplayObjects: |
|
152 |
#dropObjectSelector: #getDropObjects: |
|
153 |
#dropArgument: #directoryTreeBrowser |
|
3952 | 154 |
#canDropSelector: #canDrop: |
3892 | 155 |
#leaveSelector: #dropLeave: |
3952 | 156 |
#enterSelector: #dropEnter: |
3982 | 157 |
#dropSelector: #doDrop: |
3892 | 158 |
) |
159 |
) |
|
160 |
) |
|
161 |
||
162 |
) |
|
163 |
) |
|
164 |
! ! |
|
165 |
||
166 |
!DirectoryTreeBrowser class methodsFor:'menu specs'! |
|
167 |
||
168 |
menu |
|
169 |
"This resource specification was automatically generated |
|
170 |
by the MenuEditor of ST/X." |
|
171 |
||
172 |
"Do not manually edit this!! If it is corrupted, |
|
173 |
the MenuEditor may not be able to read the specification." |
|
174 |
||
175 |
" |
|
176 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#menu |
|
177 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser menu)) startUp |
|
178 |
" |
|
179 |
||
180 |
<resource: #menu> |
|
181 |
||
182 |
^ |
|
183 |
#(#Menu |
|
184 |
#( |
|
185 |
#(#MenuItem |
|
186 |
#label: 'Copy' |
|
4080 | 187 |
#itemValue: #doCopy |
3892 | 188 |
#translateLabel: true |
3956 | 189 |
#isVisible: #allowFileOperations |
3892 | 190 |
) |
191 |
#(#MenuItem |
|
192 |
#label: 'Cut' |
|
4080 | 193 |
#itemValue: #doCut |
3892 | 194 |
#translateLabel: true |
3956 | 195 |
#isVisible: #allowFileOperations |
3892 | 196 |
) |
197 |
#(#MenuItem |
|
4080 | 198 |
#enabled: #canPaste |
3892 | 199 |
#label: 'Paste' |
4080 | 200 |
#itemValue: #pasteFiles |
3892 | 201 |
#translateLabel: true |
3956 | 202 |
#isVisible: #allowFileOperations |
3892 | 203 |
) |
204 |
#(#MenuItem |
|
205 |
#label: 'Delete' |
|
4080 | 206 |
#itemValue: #doDelete |
207 |
#nameKey: #delete |
|
3892 | 208 |
#translateLabel: true |
3956 | 209 |
#isVisible: #allowFileOperations |
3892 | 210 |
) |
211 |
#(#MenuItem |
|
3907 | 212 |
#label: 'Rename' |
4080 | 213 |
#itemValue: #treeViewFileRename |
3907 | 214 |
#translateLabel: true |
3956 | 215 |
#isVisible: #allowFileOperations |
3907 | 216 |
) |
217 |
#(#MenuItem |
|
3892 | 218 |
#label: '-' |
3956 | 219 |
#isVisible: #allowFileOperations |
3892 | 220 |
) |
221 |
#(#MenuItem |
|
4080 | 222 |
#label: 'View Files' |
3956 | 223 |
#translateLabel: true |
224 |
#indication: #viewFilesInDirectoryTree |
|
3907 | 225 |
) |
226 |
#(#MenuItem |
|
227 |
#label: 'Sort' |
|
4080 | 228 |
#nameKey: #Sort |
3892 | 229 |
#translateLabel: true |
3907 | 230 |
#submenuChannel: #sortMenu |
3892 | 231 |
) |
232 |
#(#MenuItem |
|
4080 | 233 |
#enabled: #selectedFilesIncludesNonRootDirectory |
4010 | 234 |
#label: 'Set Selection to Root' |
4080 | 235 |
#itemValue: #doSetSelectionToRoot |
3892 | 236 |
#translateLabel: true |
237 |
) |
|
238 |
#(#MenuItem |
|
239 |
#label: '-' |
|
240 |
) |
|
241 |
#(#MenuItem |
|
242 |
#label: 'New' |
|
243 |
#translateLabel: true |
|
3956 | 244 |
#isVisible: #newVisibilityHolder |
3892 | 245 |
#submenuChannel: #newMenu |
246 |
) |
|
247 |
#(#MenuItem |
|
3907 | 248 |
#label: 'Update' |
4080 | 249 |
#itemValue: #doUpdate |
3907 | 250 |
#translateLabel: true |
251 |
) |
|
252 |
#(#MenuItem |
|
4080 | 253 |
#enabled: #hasSelection |
3907 | 254 |
#label: 'Properties...' |
4080 | 255 |
#itemValue: #doShowProperties |
3892 | 256 |
#translateLabel: true |
3907 | 257 |
) |
258 |
#(#MenuItem |
|
4080 | 259 |
#label: 'More' |
260 |
#translateLabel: true |
|
3907 | 261 |
#submenu: |
262 |
#(#Menu |
|
263 |
#( |
|
264 |
#(#MenuItem |
|
4080 | 265 |
#enabled: #enableDirectoryUp |
3907 | 266 |
#label: 'Directory Up' |
4080 | 267 |
#itemValue: #doGoDirectoryUp |
3907 | 268 |
#translateLabel: true |
269 |
) |
|
270 |
#(#MenuItem |
|
271 |
#label: 'Re-/ Expand Directory' |
|
4080 | 272 |
#itemValue: #toggleExpandSelectedItem |
3907 | 273 |
#translateLabel: true |
274 |
) |
|
275 |
) |
|
276 |
nil |
|
277 |
nil |
|
278 |
) |
|
3892 | 279 |
) |
280 |
) |
|
281 |
nil |
|
282 |
nil |
|
283 |
) |
|
284 |
! ! |
|
285 |
||
286 |
!DirectoryTreeBrowser class methodsFor:'plugIn spec'! |
|
287 |
||
288 |
aspectSelectors |
|
289 |
"This resource specification was automatically generated |
|
290 |
by the UIPainter of ST/X." |
|
291 |
||
292 |
"Do not manually edit this. If it is corrupted, |
|
293 |
the UIPainter may not be able to read the specification." |
|
294 |
||
295 |
"Return a description of exported aspects; |
|
296 |
these can be connected to aspects of an embedding application |
|
297 |
(if this app is embedded in a subCanvas)." |
|
298 |
||
299 |
^ #( |
|
300 |
#selectedDirectoryModel |
|
301 |
). |
|
302 |
||
303 |
! ! |
|
304 |
||
305 |
!DirectoryTreeBrowser methodsFor:'accessing'! |
|
306 |
||
3952 | 307 |
doubleClickAction |
308 |
||
309 |
^ doubleClickAction |
|
310 |
! |
|
311 |
||
312 |
doubleClickAction:aBlock |
|
313 |
||
314 |
" aBlock is a one arg block with selected index as argument " |
|
315 |
||
316 |
doubleClickAction := aBlock |
|
317 |
! |
|
318 |
||
3892 | 319 |
updateToExternFileHolderLock |
320 |
"return the value of the instance variable 'updateToExternFileHolder' (automatically generated)" |
|
321 |
||
322 |
updateToExternFileHolderLock isNil ifTrue:[ |
|
323 |
updateToExternFileHolderLock := self class newLock. |
|
324 |
]. |
|
325 |
^ updateToExternFileHolderLock |
|
326 |
! |
|
327 |
||
328 |
updateTreeSelection |
|
329 |
"return the value of the instance variable 'updateToExternFileHolder' (automatically generated)" |
|
330 |
||
331 |
updateTreeSelection isNil ifTrue:[ |
|
332 |
updateTreeSelection := self class newLock. |
|
333 |
]. |
|
334 |
^ updateTreeSelection |
|
335 |
! ! |
|
336 |
||
337 |
!DirectoryTreeBrowser methodsFor:'actions'! |
|
338 |
||
339 |
doDoubleClick:anIndex |
|
340 |
"handle a doubleClick on a directory |
|
341 |
" |
|
3952 | 342 |
| item file isDirectory| |
3892 | 343 |
|
3952 | 344 |
self doubleClickAction notNil ifTrue:[ |
345 |
self doubleClickAction value:anIndex. |
|
346 |
]. |
|
3892 | 347 |
item := self fileList at:anIndex ifAbsent:nil. |
348 |
item notNil ifTrue:[ |
|
349 |
isDirectory := item isDirectory. |
|
350 |
file := item fileName. |
|
351 |
isDirectory ifTrue:[ |
|
352 |
(file isReadable and:[file isExecutable]) ifTrue:[ |
|
353 |
self doExpand:item. |
|
354 |
] |
|
355 |
] ifFalse:[ |
|
3952 | 356 |
"/ self openApplByFileItem:item. |
3892 | 357 |
] |
358 |
] |
|
359 |
! |
|
360 |
||
361 |
doExpand:anItem |
|
362 |
" expand the item; return true the item have expanded " |
|
363 |
||
364 |
(anItem notNil and:[anItem isDirectory and:[anItem isExpanded not]]) ifTrue:[ |
|
365 |
anItem toggleExpand. |
|
366 |
^ true. |
|
367 |
]. |
|
368 |
^ false |
|
369 |
! |
|
370 |
||
371 |
doIndicatorClick:anIndex |
|
372 |
"handle a click on the indicator |
|
373 |
" |
|
374 |
||
375 |
|item| |
|
376 |
||
377 |
item := self fileList at:anIndex ifAbsent:nil. |
|
378 |
self toggleExpand:item |
|
379 |
! |
|
380 |
||
4010 | 381 |
doSetSelectionToRoot |
3982 | 382 |
| selDir| |
383 |
||
384 |
selDir := self firstSelectedDirectory. |
|
385 |
selDir notNil ifTrue:[ |
|
386 |
self rootHolder value asFilename = selDir ifTrue:[ ^ self]. |
|
387 |
self rootHolder value:selDir. |
|
388 |
self currentFileNameHolder value:(OrderedCollection with:selDir). |
|
389 |
]. |
|
390 |
! |
|
391 |
||
3892 | 392 |
doUpdate |
393 |
||
394 |
self fileList monitoringCycle. |
|
395 |
"/ self updateSelectedItem |
|
396 |
! |
|
397 |
||
3989 | 398 |
evaluateSortBlock |
399 |
||
400 |
self fileList sortBlock:(self sortBlockHolder value). |
|
401 |
! |
|
402 |
||
3892 | 403 |
setMatchBlockForList:list |
404 |
||
4021 | 405 |
| selection matchBlock filterBlock viewFiles| |
3982 | 406 |
|
407 |
selection := self selectedItems. |
|
4011 | 408 |
filterBlock := self filterBlockHolder value. |
409 |
viewFiles := self viewFilesInDirectoryTree value. |
|
410 |
matchBlock := [:fileName :isDir| |
|
411 |
(isDir |
|
412 |
or:[viewFiles |
|
413 |
and:[filterBlock value:fileName baseName]]) |
|
3892 | 414 |
]. |
4011 | 415 |
list matchBlock:matchBlock. |
3892 | 416 |
! |
417 |
||
418 |
toggleExpand:anItem |
|
419 |
||
420 |
(anItem notNil and:[anItem isDirectory]) ifTrue:[ |
|
421 |
anItem toggleExpand |
|
422 |
]. |
|
423 |
! |
|
424 |
||
3982 | 425 |
toggleExpandSelectedItem |
426 |
||
427 |
|selDir| |
|
428 |
||
429 |
selDir := self selectedDirectoryItems. |
|
430 |
selDir do:[:item| |
|
431 |
self toggleExpand:item. |
|
432 |
]. |
|
433 |
! |
|
434 |
||
3892 | 435 |
treeViewFileRename |
3982 | 436 |
|
3906 | 437 |
dirBrowser openEditor. |
3892 | 438 |
! |
439 |
||
440 |
updateSelectedItem |
|
441 |
||
442 |
| sel | |
|
443 |
||
3982 | 444 |
sel := self selectedItems. |
3892 | 445 |
sel isEmpty ifTrue:[ ^ self]. |
446 |
sel do:[:item| |
|
447 |
item invalidateRepairNow:true. |
|
448 |
] |
|
449 |
! ! |
|
450 |
||
451 |
!DirectoryTreeBrowser methodsFor:'aspects'! |
|
452 |
||
3956 | 453 |
allowFileOperations |
454 |
"allowFileOperations |
|
455 |
" |
|
456 |
allowFileOperations isNil ifTrue:[ |
|
457 |
allowFileOperations := true asValue. |
|
458 |
]. |
|
459 |
^ allowFileOperations. |
|
460 |
! |
|
461 |
||
3892 | 462 |
fileList |
463 |
"holder, which keeps the current list of file entries shown by the directory-browser |
|
464 |
" |
|
465 |
||
466 |
|list| |
|
467 |
||
468 |
(list := builder bindingAt:#fileList) isNil ifTrue:[ |
|
469 |
list := DirTreeBrowserHFL new. |
|
470 |
list application:self. |
|
471 |
list showRoot:true. |
|
472 |
self setMatchBlockForList:list. |
|
473 |
list directory:(self rootHolder value). |
|
474 |
builder aspectAt:#fileList put:list. |
|
475 |
list monitoringTaskDelay:2 |
|
476 |
]. |
|
477 |
^ list |
|
478 |
! |
|
479 |
||
3958 | 480 |
multipleSelect |
481 |
||
482 |
multipleSelect isNil ifTrue:[ |
|
483 |
multipleSelect := true. |
|
484 |
]. |
|
485 |
^ multipleSelect |
|
486 |
! |
|
487 |
||
488 |
multipleSelect:aBoolean |
|
489 |
||
490 |
multipleSelect := aBoolean. |
|
491 |
dirBrowser multipleSelectOk:aBoolean. |
|
492 |
! |
|
493 |
||
3956 | 494 |
newVisibilityHolder |
495 |
"newVisibilityHolder |
|
496 |
" |
|
497 |
newVisibilityHolder isNil ifTrue:[ |
|
498 |
newVisibilityHolder := true asValue. |
|
499 |
]. |
|
500 |
^ newVisibilityHolder. |
|
501 |
! |
|
502 |
||
3982 | 503 |
treeSelectionHolder |
504 |
||
505 |
treeSelectionHolder isNil ifTrue:[ |
|
506 |
treeSelectionHolder := ValueHolder new. |
|
507 |
treeSelectionHolder addDependent:self. |
|
508 |
]. |
|
509 |
^ treeSelectionHolder |
|
3892 | 510 |
! ! |
511 |
||
512 |
!DirectoryTreeBrowser methodsFor:'change & update'! |
|
513 |
||
3982 | 514 |
changeMatchBlock |
515 |
||
516 |
|list| |
|
517 |
||
518 |
list := self fileList. |
|
4021 | 519 |
self setMatchBlockForList:list. |
520 |
self currentFileNameHolderChanged. |
|
3982 | 521 |
! |
3892 | 522 |
|
3982 | 523 |
currentFileNameHolderChanged |
524 |
||
525 |
| selectFiles viewFiles| |
|
3892 | 526 |
|
3982 | 527 |
viewFiles:= self viewFilesInDirectoryTree value. |
528 |
viewFiles ifTrue:[ |
|
529 |
selectFiles := self currentFileNameHolder value. |
|
530 |
] ifFalse:[ |
|
531 |
selectFiles := self currentDirectories value. |
|
532 |
]. |
|
4018 | 533 |
self rootHolder notNil ifTrue:[ |
3982 | 534 |
self selectFiles:selectFiles. |
535 |
^ self |
|
536 |
]. |
|
537 |
! |
|
538 |
||
4011 | 539 |
rootHolderChanged |
540 |
||
541 |
|list file rootHolder| |
|
542 |
list := self fileList. |
|
543 |
rootHolder := self rootHolder. |
|
544 |
file := rootHolder value. |
|
545 |
file notNil ifTrue:[ |
|
546 |
file := Filename named:(file asString). |
|
547 |
file isDirectory ifTrue:[ |
|
548 |
list directory:file |
|
549 |
] |
|
550 |
]. |
|
4071 | 551 |
self rootHolder value:(list directory asString) withoutNotifying:self. |
4011 | 552 |
! |
553 |
||
3982 | 554 |
selectionChanged |
555 |
||
3995
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
556 |
|sel currentFileDir| |
3982 | 557 |
|
3995
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
558 |
" if viewFiles is false i can't take my |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
559 |
selection to overwrite currentFileNameHolder" |
8341aed594d2
Fix for single values and FileDialog
Stefan Vogel <sv@exept.de>
parents:
3989
diff
changeset
|
560 |
|
3982 | 561 |
sel := self selectedFiles. |
562 |
(self viewFilesInDirectoryTree value not) ifTrue:[ |
|
3892 | 563 |
(self currentFilesAreInSameDirectory and:[sel size == 1]) ifTrue:[ |
564 |
currentFileDir := self getDirWithoutFileName:(self currentFileNameHolder value first). |
|
565 |
(sel first = currentFileDir) ifTrue:[ |
|
566 |
^ self. |
|
567 |
]. |
|
568 |
]. |
|
569 |
]. |
|
570 |
self currentFileNameHolder value:sel. |
|
571 |
! |
|
572 |
||
573 |
update:something with:aParameter from:aModel |
|
574 |
"one of my models changed |
|
575 |
" |
|
576 |
||
577 |
||
3982 | 578 |
" the execution of selectionChanged and currentFileNameHolderChanged must |
3892 | 579 |
lock against each other because values dont must be the same (e.g. no files |
580 |
in tree view) |
|
581 |
" |
|
582 |
||
583 |
aModel == self currentFileNameHolder ifTrue:[ |
|
4003 | 584 |
super update:something with:aParameter from:aModel. |
3892 | 585 |
self updateTreeSelection doIfUnLocked:[ |
586 |
self updateToExternFileHolderLock doLocked:[ |
|
3982 | 587 |
self currentFileNameHolderChanged. |
3892 | 588 |
]. |
589 |
]. |
|
4003 | 590 |
^ self. |
3892 | 591 |
]. |
592 |
aModel == self treeSelectionHolder ifTrue:[ |
|
593 |
self updateToExternFileHolderLock doIfUnLocked:[ |
|
594 |
self updateTreeSelection doLocked:[ |
|
3982 | 595 |
self selectionChanged. |
3892 | 596 |
] |
597 |
]. |
|
598 |
^ self |
|
599 |
]. |
|
3982 | 600 |
aModel == self rootHolder ifTrue:[ |
4011 | 601 |
self rootHolderChanged. |
3892 | 602 |
^ self. |
603 |
]. |
|
604 |
aModel == self viewFilesInDirectoryTree ifTrue:[ |
|
3982 | 605 |
self updateToExternFileHolderLock doLocked:[ |
606 |
self changeMatchBlock. |
|
3892 | 607 |
]. |
608 |
^ self. |
|
609 |
]. |
|
3989 | 610 |
aModel == self sortBlockHolder ifTrue:[ |
611 |
self evaluateSortBlock. |
|
612 |
^ self. |
|
613 |
]. |
|
4011 | 614 |
aModel == self filterBlockHolder ifTrue:[ |
3982 | 615 |
" filter goes only on fileNames not on directories |
616 |
have to change the matchBlock only if files are shown" |
|
617 |
self viewFilesInDirectoryTree value ifTrue:[ |
|
4018 | 618 |
self changeMatchBlock. |
3982 | 619 |
]. |
620 |
^ self |
|
3892 | 621 |
]. |
622 |
super update:something with:aParameter from:aModel. |
|
623 |
^ self |
|
624 |
! ! |
|
625 |
||
626 |
!DirectoryTreeBrowser methodsFor:'drag & drop'! |
|
627 |
||
3952 | 628 |
canDrop:aContext |
3892 | 629 |
|
3952 | 630 |
^ canDropItem |
3892 | 631 |
! |
632 |
||
633 |
doDrop:aContext |
|
3952 | 634 |
|col destination destinationPath receiver| |
3892 | 635 |
|
3952 | 636 |
destination := self fileList draggedItem. |
637 |
self dropLeave:aContext. |
|
638 |
destination ifNil:[^ false]. |
|
639 |
||
3892 | 640 |
destinationPath := destination fileName. |
3952 | 641 |
|
642 |
aContext dropSource argument == #archivApplication ifTrue:[ |
|
643 |
receiver := aContext dropSource receiver. |
|
3892 | 644 |
receiver extractSelectedFilesTo:destinationPath askForExtractOptions:true. |
645 |
^ true |
|
646 |
]. |
|
647 |
col := OrderedCollection new. |
|
648 |
aContext dropObjects do:[:obj | |
|
649 |
col add:(obj theObject) |
|
650 |
]. |
|
3952 | 651 |
self copyOrMoveFiles:col to:destinationPath. |
3892 | 652 |
^ true |
653 |
! |
|
654 |
||
3952 | 655 |
dropEnter:aContext |
656 |
||
657 |
|dropedObjects| |
|
3892 | 658 |
|
3952 | 659 |
self dropTargetItemChangedTo:nil in:aContext. |
660 |
inDropMode := false. |
|
661 |
||
662 |
dropedObjects := aContext dropObjects. |
|
3892 | 663 |
|
3952 | 664 |
dropedObjects do:[:aObject| |checkObject checkObjectString| |
665 |
aObject isFileObject ifFalse:[^ self]. |
|
666 |
checkObject := aObject theObject. |
|
667 |
checkObject isFilename not ifTrue:[^ self]. |
|
668 |
((aContext dropSource argument == #archivApplication) not) ifTrue:[ |
|
669 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
670 |
checkObject isReadable ifFalse:[^ self]. |
|
671 |
]. |
|
672 |
]. |
|
673 |
inDropMode := true. |
|
3892 | 674 |
! |
675 |
||
676 |
dropLeave:aDropContext |
|
677 |
"send the last time, when leaving the widget |
|
678 |
" |
|
3952 | 679 |
inDropMode ifTrue:[ |
680 |
self dropTargetItemChangedTo:nil in:aDropContext. |
|
681 |
self removeExpandItemTimedBlock. |
|
682 |
inDropMode := false. |
|
683 |
]. |
|
3892 | 684 |
! |
685 |
||
3952 | 686 |
dropOver:aContext |
687 |
"send the last time, when leaving the widget |
|
688 |
" |
|
689 |
|lineNr newDest| |
|
690 |
||
691 |
inDropMode ifFalse:[^ self]. |
|
692 |
||
693 |
lineNr := self getLineNumberFor:aContext. |
|
3892 | 694 |
|
3952 | 695 |
lineNr notNil ifTrue:[ |
696 |
newDest := self fileList at:lineNr ifAbsent:nil. |
|
697 |
]. |
|
4018 | 698 |
(newDest isNil or:[newDest == self fileList draggedItem]) ifTrue:[ |
3952 | 699 |
^ self |
700 |
]. |
|
701 |
newDest isDirectory not ifTrue:[ |
|
702 |
newDest := nil. |
|
703 |
canDropItem := false. |
|
704 |
]. |
|
705 |
self dropTargetItemChangedTo:newDest in:aContext. |
|
706 |
||
707 |
newDest notNil ifTrue:[ |
|
708 |
aContext dropSource argument == #archivApplication ifTrue:[ |
|
709 |
canDropItem := true. |
|
710 |
] ifFalse:[ |
|
711 |
canDropItem := self canDropFiles:(aContext dropObjects) for:newDest fileName. |
|
712 |
]. |
|
713 |
]. |
|
3892 | 714 |
! |
715 |
||
3952 | 716 |
dropTargetItemChangedTo:anItem in:aDropContext |
717 |
|current| |
|
718 |
||
719 |
current := self fileList draggedItem. |
|
720 |
current == anItem ifTrue:[^ self]. |
|
721 |
||
722 |
self fileList draggedItem:anItem. |
|
723 |
||
724 |
aDropContext contentsWillChange. |
|
725 |
current ifNotNil:[ |
|
726 |
current isDirectory ifTrue:[ |
|
727 |
self removeExpandItemTimedBlock. |
|
728 |
current changed:#icon. |
|
729 |
] |
|
730 |
]. |
|
3892 | 731 |
|
3952 | 732 |
anItem ifNotNil:[ |
733 |
anItem isDirectory ifTrue:[ |
|
734 |
anItem changed:#icon. |
|
735 |
(anItem notNil and:[anItem isDirectory and:[anItem fileName isWritable]]) ifTrue:[ |
|
736 |
expandItemTimedBlock := [ |
|
737 |
self expandForDrop:anItem with:aDropContext. |
|
738 |
]. |
|
739 |
Processor addTimedBlock:expandItemTimedBlock |
|
740 |
afterMilliseconds:(self class timeForExpandOnDropInMilliseconds). |
|
741 |
] |
|
742 |
]. |
|
743 |
]. |
|
744 |
dirBrowser shown ifTrue:[ |
|
745 |
dirBrowser repairDamage. |
|
746 |
]. |
|
3892 | 747 |
! |
748 |
||
749 |
expandForDrop:item with:aDropContext |
|
750 |
||
751 |
aDropContext saveDraw:[ |
|
752 |
(self doExpand:item) ifTrue:[ |
|
753 |
self windowGroup processExposeEvents |
|
754 |
]. |
|
755 |
] |
|
756 |
! |
|
757 |
||
758 |
getDisplayObjects:anArgument |
|
759 |
||
760 |
| string fnName sel size stream| |
|
3982 | 761 |
sel := self selectedItems. |
3892 | 762 |
size := sel size. |
763 |
size == 0 ifTrue:[^ '']. |
|
764 |
stream := WriteStream on:''. |
|
765 |
stream nextPutAll:sel first baseName. |
|
766 |
size == 1 ifTrue:[ |
|
767 |
fnName := 'ui_menuitem.xpm'. |
|
768 |
] ifFalse:[ |
|
769 |
fnName := 'ui_submenu_open.xpm'. |
|
770 |
stream nextPutAll:' ... '. |
|
771 |
stream nextPutAll:sel last baseName. |
|
772 |
]. |
|
773 |
string := stream contents. |
|
774 |
stream close. |
|
775 |
||
776 |
fnName := 'ui_menuitem.xpm'. |
|
777 |
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) |
|
778 |
string:(Text string:string emphasis:#bold) |
|
779 |
) |
|
780 |
! |
|
781 |
||
782 |
getDropObjects:anArgument |
|
783 |
||
784 |
| sel ret| |
|
785 |
||
3982 | 786 |
sel := self selectedFiles. |
3892 | 787 |
sel isEmpty ifTrue:[ ^ self ]. |
788 |
ret := sel collect:[:file| |
|
789 |
DropObject newFile:file |
|
790 |
]. |
|
791 |
^ ret |
|
792 |
! |
|
793 |
||
794 |
getLineNumberFor:aDropContext |
|
795 |
| yVisible| |
|
796 |
||
797 |
yVisible := (aDropContext targetPoint y). |
|
798 |
^ dirBrowser yVisibleToLineNr:yVisible. |
|
799 |
! |
|
800 |
||
801 |
removeExpandItemTimedBlock |
|
3952 | 802 |
|
3892 | 803 |
expandItemTimedBlock notNil ifTrue:[ |
804 |
Processor removeTimedBlock:expandItemTimedBlock. |
|
805 |
expandItemTimedBlock := nil |
|
806 |
] |
|
807 |
! ! |
|
808 |
||
809 |
!DirectoryTreeBrowser methodsFor:'event handling'! |
|
810 |
||
811 |
processEvent:anEvent |
|
812 |
"filter keyboard events. |
|
813 |
Return true, if I have eaten the event" |
|
814 |
||
4009 | 815 |
|evView key rawKey| |
3892 | 816 |
|
817 |
anEvent isKeyPressEvent ifTrue:[ |
|
4009 | 818 |
evView := anEvent targetView. |
819 |
evView isNil ifTrue:[ ^ false]. |
|
820 |
evView == dirBrowser ifFalse:[ ^ false]. |
|
821 |
key := anEvent key. |
|
3892 | 822 |
rawKey := anEvent rawKey. |
823 |
||
3906 | 824 |
|
4009 | 825 |
(key == #CursorLeft) ifTrue:[ |
826 |
"go to last selection in selection history" |
|
827 |
(self rootSelected and:[(self fileList at:1) isExpanded not]) ifTrue:[ |
|
828 |
self doGoDirectoryUp. |
|
3892 | 829 |
^ true |
4009 | 830 |
] ifFalse:[ |
831 |
^ false |
|
832 |
] |
|
833 |
]. |
|
834 |
(key == #FocusPrevious) ifTrue:[ |
|
835 |
"go to last selection in selection history" |
|
836 |
self doBack. |
|
837 |
^ true |
|
838 |
]. |
|
839 |
(key == #FocusNext) ifTrue:[ |
|
840 |
"go to next selection in selection history" |
|
841 |
self doForward. |
|
842 |
^ true |
|
843 |
]. |
|
844 |
(key == #Replace) ifTrue:[ |
|
845 |
self treeViewFileRename. |
|
846 |
^ true |
|
847 |
]. |
|
848 |
(key == #Delete) ifTrue:[ |
|
849 |
self doDelete. |
|
850 |
^ true |
|
851 |
]. |
|
852 |
(key == #Cut) ifTrue:[ |
|
853 |
self doCut. |
|
854 |
^ true |
|
855 |
]. |
|
856 |
(key == #Paste) ifTrue:[ |
|
857 |
self pasteFiles. |
|
858 |
^ true |
|
859 |
]. |
|
860 |
(key == #Copy) ifTrue:[ |
|
861 |
self doCopy. |
|
862 |
^ true |
|
863 |
]. |
|
3892 | 864 |
]. |
865 |
^ false |
|
866 |
! ! |
|
867 |
||
3982 | 868 |
!DirectoryTreeBrowser methodsFor:'file actions'! |
3892 | 869 |
|
3982 | 870 |
doCopy |
871 |
"copy current selected files/directories |
|
872 |
" |
|
873 |
||
874 |
self copyFilesToClipBoard:self selectedItems. |
|
875 |
! |
|
3892 | 876 |
|
3982 | 877 |
doCut |
878 |
"cut current selected files/directories |
|
879 |
" |
|
880 |
self cutFilesToClipBoard:self selectedItems. |
|
881 |
! |
|
882 |
||
883 |
doDelete |
|
884 |
"delete current selected files/directories |
|
885 |
" |
|
886 |
||
887 |
self deleteFiles:self selectedFiles. |
|
3892 | 888 |
! ! |
889 |
||
890 |
!DirectoryTreeBrowser methodsFor:'queries'! |
|
891 |
||
892 |
masterIsFileBrowser |
|
893 |
||
894 |
^ self masterApplication class = FileBrowserV2 |
|
895 |
! |
|
896 |
||
3982 | 897 |
selectedFilesIncludesNonRootDirectory |
898 |
||
899 |
| directories| |
|
900 |
||
901 |
directories := self selectedDirectories. |
|
902 |
directories isEmpty ifTrue:[^ false]. |
|
903 |
directories do:[:aDir| |
|
904 |
(aDir asString) ~= (self rootHolder value) ifTrue:[ |
|
905 |
^ true |
|
906 |
] |
|
907 |
]. |
|
908 |
^ false |
|
909 |
! ! |
|
910 |
||
911 |
!DirectoryTreeBrowser methodsFor:'selection'! |
|
912 |
||
913 |
firstSelectedDirectory |
|
914 |
||
915 |
| selection dirs dirIndices| |
|
916 |
||
917 |
selection := self selectedItems. |
|
918 |
selection isEmpty ifTrue:[ ^ nil ]. |
|
3892 | 919 |
|
3982 | 920 |
dirs := selection collect:[:item| item isDirectory]. |
921 |
dirs isEmpty ifTrue:[^ nil]. |
|
922 |
dirIndices := selection collect:[:item | |
|
4008 | 923 |
self fileList identityIndexOf:item. |
3982 | 924 |
]. |
925 |
^ (self fileList at:(dirIndices min)) fileName. |
|
926 |
! |
|
927 |
||
928 |
rootSelected |
|
929 |
||
930 |
| selectedItems | |
|
931 |
selectedItems := self selectedItems. |
|
932 |
selectedItems isEmpty ifTrue:[^ false]. |
|
933 |
^ selectedItems includesIdentical:self fileList root |
|
934 |
! |
|
935 |
||
936 |
selectFiles:aColOfFileOrDirectory |
|
937 |
"selects a file; if the file is not included in my |
|
938 |
root directory, the root will be changed |
|
939 |
" |
|
940 |
|items directory item newRoot| |
|
941 |
||
942 |
aColOfFileOrDirectory isEmpty ifTrue:[ self selectItems:#()]. |
|
943 |
||
944 |
items := OrderedCollection new. |
|
945 |
aColOfFileOrDirectory do:[:file| |
|
946 |
file exists ifTrue:[ |
|
947 |
item := self fileList findLastForFile:file. |
|
948 |
item isNil ifTrue:[ |
|
949 |
newRoot := self getCommonForCurrentFiles. |
|
950 |
newRoot := self getDirWithoutFileName:newRoot. |
|
951 |
self rootHolder value:newRoot. |
|
952 |
item := self fileList root. |
|
3892 | 953 |
|
3982 | 954 |
file isDirectory ifTrue:[ directory := file ] |
955 |
ifFalse:[ directory := file directory ] |
|
956 |
. |
|
957 |
directory == file ifFalse:[ |
|
958 |
item := item detect:[:el| el fileName = file ] ifNone:item. |
|
959 |
]. |
|
960 |
]. |
|
961 |
"/ set a new root directory |
|
962 |
items add:item. |
|
963 |
]. |
|
964 |
]. |
|
965 |
self selectItems:items |
|
966 |
! |
|
967 |
||
968 |
selectItems:aColOfItems |
|
969 |
||
4011 | 970 |
|currentSelection newSelection| |
3982 | 971 |
|
4011 | 972 |
currentSelection := self selectedItems. |
973 |
self multipleSelect ifTrue:[ |
|
974 |
currentSelection notNil ifTrue:[ |
|
975 |
aColOfItems size == currentSelection size ifTrue:[ |
|
976 |
(aColOfItems findFirst:[:item | (currentSelection includesIdentical:item) not ]) ~~ 0 ifFalse:[ |
|
977 |
^ self |
|
978 |
]. |
|
979 |
] |
|
980 |
]. |
|
981 |
newSelection := aColOfItems. |
|
982 |
] ifFalse:[ |
|
983 |
newSelection := aColOfItems isEmpty ifTrue:[nil] ifFalse:[aColOfItems first]. |
|
984 |
newSelection == currentSelection ifTrue:[ |
|
985 |
^ self |
|
986 |
] |
|
987 |
]. |
|
988 |
||
3982 | 989 |
aColOfItems notEmpty ifTrue:[ |
990 |
aColOfItems first makeVisible. |
|
991 |
]. |
|
4011 | 992 |
self updateToExternFileHolderLock doLocked:[ |
993 |
self treeSelectionHolder value:newSelection. |
|
3989 | 994 |
]. |
3982 | 995 |
! |
996 |
||
997 |
selectedDirectories |
|
998 |
||
999 |
| selItems | |
|
1000 |
||
1001 |
selItems := self selectedDirectoryItems. |
|
1002 |
^ selItems collect:[: el | el fileName ]. |
|
1003 |
! |
|
1004 |
||
1005 |
selectedDirectoryItems |
|
1006 |
||
1007 |
| sel | |
|
1008 |
sel := self selectedItems. |
|
1009 |
^ sel select:[: el | el isDirectory ]. |
|
1010 |
! |
|
1011 |
||
1012 |
selectedFilenameDirectories |
|
1013 |
||
1014 |
| selectedItems setOfDirectories| |
|
1015 |
selectedItems := self selectedItems. |
|
1016 |
setOfDirectories := Set new. |
|
1017 |
selectedItems do:[:item| |
|
1018 |
| filename| |
|
1019 |
filename := self getDirWithoutFileName:(item fileName). |
|
1020 |
setOfDirectories add:filename. |
|
1021 |
]. |
|
1022 |
^ setOfDirectories. |
|
1023 |
! |
|
1024 |
||
1025 |
selectedFiles |
|
1026 |
||
1027 |
^ self selectedItems collect:[:item| item fileName]. |
|
1028 |
! |
|
1029 |
||
1030 |
selectedItems |
|
1031 |
||
1032 |
| selection | |
|
1033 |
||
1034 |
selection := self treeSelectionHolder value. |
|
1035 |
selection isNil ifTrue:[ ^ #() ]. |
|
4002 | 1036 |
multipleSelect ifTrue:[^ selection ]. |
1037 |
^ Array with:selection. "Wrap single value into Array" |
|
3892 | 1038 |
! ! |
1039 |
||
1040 |
!DirectoryTreeBrowser methodsFor:'startup & release'! |
|
1041 |
||
3952 | 1042 |
initialize |
1043 |
||
1044 |
inDropMode := false. |
|
3961 | 1045 |
^ super initialize. |
3952 | 1046 |
! |
1047 |
||
3892 | 1048 |
makeDependent |
1049 |
||
4008 | 1050 |
super makeDependent. |
3892 | 1051 |
self currentFileNameHolder addDependent:self. |
4071 | 1052 |
self rootHolder addDependent:self. |
3892 | 1053 |
self viewFilesInDirectoryTree addDependent:self. |
4011 | 1054 |
self filterBlockHolder addDependent:self. |
3964 | 1055 |
self sortBlockHolder addDependent:self. |
3892 | 1056 |
! |
1057 |
||
1058 |
postBuildAsSubcanvasWith:aBuilder |
|
1059 |
||
1060 |
super postBuildAsSubcanvasWith:aBuilder. |
|
1061 |
! |
|
1062 |
||
1063 |
postBuildDirBrowser:aWidget |
|
1064 |
||
1065 |
dirBrowser := aWidget scrolledView. |
|
3968 | 1066 |
dirBrowser hasConstantHeight:true. |
1067 |
||
3892 | 1068 |
dirBrowser openEditorAction:[:ln :aGC| |field item filename newFileString rename newFilename| |
3957 | 1069 |
self allowFileOperations value ifTrue:[ |
1070 |
item := self fileList at:ln. |
|
3892 | 1071 |
|
3957 | 1072 |
item label isString ifFalse:[ |
1073 |
field := nil |
|
1074 |
] ifTrue:[ |
|
1075 |
field := EditField new. |
|
1076 |
field level:0. |
|
1077 |
field acceptOnReturn:true. |
|
4009 | 1078 |
field acceptOnLeave:false. |
3957 | 1079 |
field acceptAction:[:x| |
1080 |
filename := item fileName. |
|
1081 |
newFileString := x at:1. |
|
1082 |
filename baseName = newFileString ifFalse:[ |
|
1083 |
(self renameFile:filename to:newFileString update:false) ifTrue:[ |
|
1084 |
newFilename := filename directory construct:newFileString. |
|
1085 |
item fileName:newFilename. |
|
1086 |
self updateAndSelect:(OrderedCollection with:newFilename). |
|
1087 |
]. |
|
3892 | 1088 |
]. |
3957 | 1089 |
aGC closeEditor. |
3892 | 1090 |
]. |
3957 | 1091 |
field font:(aGC font). |
1092 |
field contents:(item label). |
|
3892 | 1093 |
]. |
3957 | 1094 |
field |
3892 | 1095 |
]. |
1096 |
]. |
|
1097 |
! |
|
1098 |
||
1099 |
postBuildWith:aBuilder |
|
1100 |
||
1101 |
super postBuildWith:aBuilder. |
|
1102 |
! |
|
1103 |
||
4071 | 1104 |
postOpen |
1105 |
||
1106 |
self rootHolderChanged. |
|
1107 |
self abstractCurrentFileNameHolderChanged. |
|
1108 |
self currentFileNameHolderChanged. |
|
1109 |
self windowGroup addPreEventHook:self. |
|
1110 |
! |
|
1111 |
||
3892 | 1112 |
postOpenAsSubcanvasWith:aBuilder |
1113 |
||
4071 | 1114 |
super postOpenAsSubcanvasWith:aBuilder. |
1115 |
self postOpen. |
|
3892 | 1116 |
! |
1117 |
||
1118 |
postOpenWith:aBuilder |
|
4071 | 1119 |
"only invoked if the application not started from a master" |
3892 | 1120 |
|
4071 | 1121 |
super postOpenWith:aBuilder. |
1122 |
self postOpen. |
|
3892 | 1123 |
! |
1124 |
||
1125 |
preBuildWith:aBuilder |
|
1126 |
||
1127 |
self masterApplication isNil ifTrue:[ |
|
1128 |
self masterApplication:nil. |
|
1129 |
]. |
|
1130 |
^ super preBuildWith:aBuilder. |
|
1131 |
! |
|
1132 |
||
1133 |
release |
|
1134 |
||
1135 |
self fileList stopMonitoringTask. |
|
1136 |
^ super release. |
|
1137 |
! ! |
|
1138 |
||
1139 |
!DirectoryTreeBrowser::DirTreeBrowserHFL methodsFor:'accessing'! |
|
1140 |
||
3952 | 1141 |
draggedItem |
3892 | 1142 |
|
3952 | 1143 |
^ draggedItem |
1144 |
! |
|
3892 | 1145 |
|
3952 | 1146 |
draggedItem:anItemOrNil |
1147 |
||
1148 |
draggedItem := anItemOrNil. |
|
3892 | 1149 |
! ! |
1150 |
||
1151 |
!DirectoryTreeBrowser::DirTreeBrowserHFL methodsFor:'protocol'! |
|
1152 |
||
3969 | 1153 |
grayDirectoryIcon |
1154 |
||
1155 |
grayDirectoryIcon isNil ifTrue:[ |
|
1156 |
grayDirectoryIcon := (FileBrowser iconForKeyMatching:#directoryOpenGray). |
|
1157 |
]. |
|
1158 |
^ grayDirectoryIcon |
|
1159 |
! |
|
1160 |
||
1161 |
iconFor:anItem |
|
1162 |
"returns the icon for an item |
|
1163 |
" |
|
3892 | 1164 |
|
1165 |
draggedItem == anItem ifTrue:[ |
|
3969 | 1166 |
^ self grayDirectoryIcon. |
3892 | 1167 |
]. |
3969 | 1168 |
^ super iconFor:anItem. |
3892 | 1169 |
! ! |
1170 |
||
1171 |
!DirectoryTreeBrowser class methodsFor:'documentation'! |
|
1172 |
||
1173 |
version |
|
4080 | 1174 |
^ '$Header: /cvs/stx/stx/libtool/DirectoryTreeBrowser.st,v 1.31 2002-10-28 12:37:06 penk Exp $' |
3892 | 1175 |
! ! |