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