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