author | Claus Gittinger <cg@exept.de> |
Thu, 10 Feb 2011 16:58:13 +0100 | |
changeset 9756 | 5a1787bbf85e |
parent 9683 | 83fb945b7a5a |
child 9765 | 4ef52da2b6d4 |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
8250 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
3892 | 14 |
SimpleDialog subclass:#FileDialog |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
15 |
instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
16 |
multipleSelect doubleClickAction cancelLabelHolder okLabelHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
17 |
startFilename result filterField filenameField viewFiles |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
18 |
filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
19 |
appendButtonVisibleHolder appendWasPressed |
6065 | 20 |
buttonPanelVisibleHolder appendLabelHolder browseVisibleHolder |
9678 | 21 |
selectedDeviceDrive listOfDeviceDrives rootDirectoryHolder |
22 |
initialRoot' |
|
5931 | 23 |
classVariableNames:'LastExtent' |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
24 |
poolDictionaries:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
25 |
category:'Interface-Tools-File' |
3892 | 26 |
! |
27 |
||
28 |
!FileDialog class methodsFor:'documentation'! |
|
29 |
||
5140 | 30 |
copyright |
31 |
" |
|
32 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
3892 | 44 |
documentation |
45 |
" |
|
46 |
documentation to be added. |
|
47 |
||
48 |
[author:] |
|
49 |
Martin Walser (martin@vercingetorix) |
|
50 |
||
51 |
[instance variables:] |
|
52 |
||
53 |
[class variables:] |
|
54 |
||
55 |
[see also:] |
|
56 |
||
57 |
" |
|
58 |
! |
|
59 |
||
60 |
examples |
|
61 |
" |
|
62 |
[exBegin] |
|
63 |
FileDialog open |
|
64 |
[exEnd] |
|
65 |
||
66 |
[exBegin] |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
67 |
FileDialog |
4804 | 68 |
requestFileName:'enter a fileName:' |
69 |
default:'' |
|
70 |
version:nil |
|
71 |
ifFail:['none'] |
|
72 |
pattern:'*.conf' |
|
73 |
fromDirectory:'/etc' |
|
74 |
whenBoxCreatedEvaluate:nil. |
|
75 |
[exEnd] |
|
76 |
[exBegin] |
|
77 |
|fd| |
|
78 |
||
79 |
fd := FileDialog new. |
|
80 |
fd multipleSelect:true. |
|
81 |
fd open |
|
3892 | 82 |
[exEnd] |
83 |
" |
|
5062 | 84 |
! |
85 |
||
86 |
todo |
|
87 |
" |
|
88 |
- make the filedialog windows like f |
|
89 |
filename entry field shows only the filename not the whole directory |
|
90 |
the tree allways starts in currrent directory |
|
91 |
the parent tree is shown in a compobox where the perents are selectable |
|
92 |
- do not expand the ~ or relative pathnames to absolute pathnames |
|
93 |
" |
|
3892 | 94 |
! ! |
95 |
||
96 |
!FileDialog class methodsFor:'instance creation'! |
|
97 |
||
98 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
99 |
"same as requestFileName, but only show directories" |
|
100 |
||
4795 | 101 |
^ self |
102 |
requestDirectoryName:title |
|
103 |
default:aFileName |
|
104 |
ok:nil |
|
105 |
abort:nil |
|
106 |
version:nil |
|
107 |
pattern:nil |
|
108 |
fromDirectory:nil |
|
109 |
ifFail:failBlock |
|
110 |
whenBoxCreatedEvaluate:nil |
|
111 |
asLoadDialog:nil. |
|
3892 | 112 |
|
113 |
" |
|
3904 | 114 |
FileDialog |
3892 | 115 |
requestDirectoryName:'which directory ?' |
4627 | 116 |
default:Filename currentDirectory pathName |
3892 | 117 |
ifFail:'none' |
118 |
" |
|
119 |
! |
|
120 |
||
5336 | 121 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
122 |
"same as requestFileName, but only show directories" |
|
123 |
||
124 |
^ self |
|
125 |
requestDirectoryName:title |
|
126 |
default:aFileName |
|
127 |
ok:okText |
|
128 |
abort:abortText |
|
129 |
version:nil |
|
130 |
pattern:nil |
|
131 |
fromDirectory:nil |
|
132 |
ifFail:failBlock |
|
133 |
whenBoxCreatedEvaluate:nil |
|
134 |
asLoadDialog:nil. |
|
135 |
||
136 |
" |
|
137 |
FileDialog |
|
138 |
requestDirectoryName:'which directory ?' |
|
139 |
default:Filename currentDirectory pathName |
|
140 |
ok:'Yes' |
|
141 |
abort:'No' |
|
142 |
ifFail:'none' |
|
143 |
" |
|
144 |
! |
|
145 |
||
5823 | 146 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
147 |
"same as requestFileName, but only show directories" |
|
148 |
||
149 |
^ self |
|
150 |
requestDirectoryName:title |
|
151 |
default:aFileName |
|
152 |
ok:okText |
|
153 |
abort:abortText |
|
154 |
version:nil |
|
155 |
pattern:nil |
|
156 |
fromDirectory:nil |
|
157 |
ifFail:failBlock |
|
158 |
whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
|
159 |
asLoadDialog:nil. |
|
160 |
||
161 |
" |
|
162 |
FileDialog |
|
163 |
requestDirectoryName:'which directory ?' |
|
164 |
default:Filename currentDirectory pathName |
|
165 |
ok:'Yes' |
|
166 |
abort:'No' |
|
167 |
ifFail:'none' |
|
168 |
" |
|
169 |
! |
|
170 |
||
3956 | 171 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 172 |
"same as requestFileName, but only show directories" |
173 |
||
3956 | 174 |
|enteredFileName instance enteredFileNameString| |
3892 | 175 |
|
4795 | 176 |
instance := self |
177 |
startApplicationFor:titleString |
|
178 |
default:aFileName |
|
179 |
ok:okText |
|
180 |
abort:abortText |
|
181 |
ifFail:failBlock |
|
182 |
pattern:pattern |
|
183 |
fromDirectory:aDirectoryPath |
|
184 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
185 |
asLoadDialog:aBoolean |
|
5329 | 186 |
viewFiles:false |
4795 | 187 |
multipleSelect:false. |
3892 | 188 |
|
189 |
enteredFileNameString := instance result. |
|
190 |
enteredFileNameString isNil ifTrue:[ |
|
191 |
^ failBlock value |
|
192 |
]. |
|
193 |
enteredFileName := enteredFileNameString asFilename. |
|
194 |
enteredFileNameString := enteredFileName asString. |
|
195 |
(enteredFileName notNil |
|
196 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
197 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
198 |
versionSymbol == #mustBeNew ifTrue:[ |
|
199 |
"/ file may not exist |
|
200 |
enteredFileName exists ifTrue:[^ '']. |
|
201 |
]. |
|
202 |
versionSymbol == #new ifTrue:[ |
|
203 |
"/ file may not exist |
|
204 |
enteredFileName exists ifTrue:[ |
|
6356 | 205 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 206 |
ifFalse:[^ '']. |
207 |
]. |
|
208 |
]. |
|
209 |
versionSymbol == #mustBeOld ifTrue:[ |
|
210 |
enteredFileName exists ifFalse:[^ '']. |
|
211 |
]. |
|
212 |
versionSymbol == #old ifTrue:[ |
|
213 |
"/ file may not exist |
|
214 |
enteredFileName exists ifFalse:[ |
|
6356 | 215 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 216 |
ifFalse:[^ '']. |
217 |
]. |
|
218 |
]. |
|
219 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
220 |
]. |
|
221 |
^ enteredFileNameString |
|
222 |
||
223 |
" |
|
224 |
FileDialog |
|
225 |
requestDirectoryName:'which directory ?' |
|
4627 | 226 |
default:Filename currentDirectory pathName |
3892 | 227 |
ifFail:nil |
228 |
" |
|
3956 | 229 |
" |
230 |
FileDialog |
|
231 |
requestDirectoryName:'which directory ?' |
|
4627 | 232 |
default:Filename currentDirectory pathName |
3956 | 233 |
ok:nil |
234 |
abort:nil |
|
235 |
version:nil |
|
236 |
pattern:nil |
|
237 |
fromDirectory:nil |
|
238 |
ifFail:nil |
|
239 |
whenBoxCreatedEvaluate:nil |
|
240 |
asLoadDialog:true |
|
241 |
" |
|
3892 | 242 |
! |
243 |
||
5336 | 244 |
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
245 |
"same as requestFileName, but only show directories" |
|
246 |
||
247 |
^ self |
|
248 |
requestDirectoryName:title |
|
249 |
default:aFileName |
|
250 |
ok:okText |
|
251 |
abort:nil |
|
252 |
version:nil |
|
253 |
pattern:nil |
|
254 |
fromDirectory:nil |
|
255 |
ifFail:failBlock |
|
256 |
whenBoxCreatedEvaluate:nil |
|
257 |
asLoadDialog:nil. |
|
258 |
||
259 |
" |
|
260 |
FileDialog |
|
261 |
requestDirectoryName:'which directory ?' |
|
262 |
default:Filename currentDirectory pathName |
|
263 |
ok:'Yes' |
|
264 |
ifFail:'none' |
|
265 |
" |
|
266 |
! |
|
267 |
||
3892 | 268 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
269 |
||
4795 | 270 |
^ self |
271 |
requestFileName:titleString |
|
272 |
default:defaultName |
|
273 |
ok:okText |
|
274 |
abort:abortText |
|
275 |
version:nil |
|
276 |
ifFail:nil |
|
277 |
pattern:pattern |
|
278 |
fromDirectory:aDirectoryPathOrNil |
|
279 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 280 |
! |
281 |
||
282 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
283 |
"launch a Dialog, which allows user to enter a filename. |
|
284 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
285 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
286 |
The box will show okText in its okButton, abortText in the abortButton. |
|
287 |
The matchPattern is set to pattern initially. |
|
288 |
Return the string, or nil if cancel was pressed |
|
289 |
The version argument allows validation of the files existance; |
|
290 |
it may be any of: |
|
291 |
#mustBeNew - fail (return empty string) if the file exists |
|
292 |
#new - confirm if the file exists |
|
293 |
#mustBeOld - fail if the file does not exist |
|
294 |
#old - confirm if the file does not exist |
|
295 |
#any (other) - no validation |
|
296 |
" |
|
297 |
||
4795 | 298 |
^ self |
299 |
requestFileName:titleString |
|
300 |
default:defaultName |
|
301 |
ok:okText |
|
302 |
abort:abortText |
|
303 |
version:versionSymbol |
|
304 |
ifFail:failBlock |
|
305 |
pattern:pattern |
|
306 |
fromDirectory:aDirectoryPath |
|
307 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
308 |
asLoadDialog:nil |
|
3956 | 309 |
! |
310 |
||
311 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
312 |
"launch a Dialog, which allows user to enter a filename. |
|
313 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
314 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
315 |
The box will show okText in its okButton, abortText in the abortButton. |
|
316 |
The matchPattern is set to pattern initially. |
|
317 |
Return the string, or nil if cancel was pressed |
|
318 |
The version argument allows validation of the files existance; |
|
319 |
it may be any of: |
|
320 |
#mustBeNew - fail (return empty string) if the file exists |
|
321 |
#new - confirm if the file exists |
|
322 |
#mustBeOld - fail if the file does not exist |
|
323 |
#old - confirm if the file does not exist |
|
324 |
#any (other) - no validation |
|
325 |
" |
|
326 |
||
3892 | 327 |
|
3904 | 328 |
| instance enteredFileName enteredFileNameString| |
3892 | 329 |
|
4795 | 330 |
instance := self |
331 |
startApplicationFor:titleString |
|
332 |
default:defaultName |
|
333 |
ok:okText |
|
334 |
abort:abortText |
|
335 |
ifFail:failBlock |
|
336 |
pattern:pattern |
|
337 |
fromDirectory:aDirectoryPath |
|
338 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
339 |
asLoadDialog:aBoolean |
|
5329 | 340 |
viewFiles:true |
4795 | 341 |
multipleSelect:false. |
3892 | 342 |
|
343 |
enteredFileNameString := instance result. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
344 |
(enteredFileNameString isEmptyOrNil) ifTrue:[ |
3892 | 345 |
^ failBlock value |
346 |
]. |
|
347 |
enteredFileName := enteredFileNameString asFilename. |
|
5867 | 348 |
enteredFileNameString := enteredFileName asString. |
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
349 |
|
3892 | 350 |
(enteredFileName notNil |
351 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
4666 | 352 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
3892 | 353 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
354 |
versionSymbol == #mustBeNew ifTrue:[ |
|
355 |
"/ file may not exist |
|
356 |
enteredFileName exists ifTrue:[^ '']. |
|
357 |
]. |
|
358 |
versionSymbol == #new ifTrue:[ |
|
359 |
"/ file may not exist |
|
360 |
enteredFileName exists ifTrue:[ |
|
6356 | 361 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 362 |
ifFalse:[^ '']. |
363 |
]. |
|
364 |
]. |
|
365 |
versionSymbol == #mustBeOld ifTrue:[ |
|
366 |
enteredFileName exists ifFalse:[^ '']. |
|
367 |
]. |
|
368 |
versionSymbol == #old ifTrue:[ |
|
369 |
"/ file may not exist |
|
370 |
enteredFileName exists ifFalse:[ |
|
6356 | 371 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 372 |
ifFalse:[^ '']. |
373 |
]. |
|
374 |
]. |
|
375 |
]. |
|
376 |
^ enteredFileNameString |
|
3956 | 377 |
" |
378 |
FileDialog |
|
379 |
requestFileName:'enter a fileName:' |
|
380 |
default:'' |
|
381 |
ok:nil |
|
382 |
abort:nil |
|
383 |
version:nil |
|
384 |
ifFail:['none'] |
|
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
385 |
pattern:'*' |
4627 | 386 |
fromDirectory:Filename currentDirectory pathName |
3956 | 387 |
whenBoxCreatedEvaluate:nil |
388 |
asLoadDialog:true |
|
389 |
" |
|
3892 | 390 |
! |
391 |
||
392 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
393 |
||
4795 | 394 |
^ self |
395 |
requestFileName:titleString |
|
396 |
default:defaultName |
|
397 |
ok:nil |
|
398 |
abort:nil |
|
399 |
version:versionSymbol |
|
400 |
ifFail:failBlock |
|
401 |
pattern:pattern |
|
402 |
fromDirectory:aDirectoryPathOrNil |
|
403 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 404 |
|
405 |
" |
|
406 |
FileDialog |
|
407 |
requestFileName:'enter a fileName:' |
|
408 |
default:'' |
|
409 |
version:nil |
|
410 |
ifFail:['none'] |
|
411 |
pattern:'*.conf' |
|
4627 | 412 |
fromDirectory:Filename currentDirectory pathName |
3892 | 413 |
whenBoxCreatedEvaluate:nil. |
414 |
Dialog |
|
415 |
requestFileName:'enter a fileName:' |
|
416 |
default:'' |
|
417 |
version:nil |
|
418 |
ifFail:['none'] |
|
419 |
pattern:'*.conf' |
|
4627 | 420 |
fromDirectory:Filename currentDirectory pathName |
3892 | 421 |
whenBoxCreatedEvaluate:nil |
422 |
" |
|
423 |
" |
|
424 |
FileDialog |
|
425 |
requestFileName:'enter a fileName:' |
|
426 |
default:'' |
|
427 |
version:#old |
|
428 |
ifFail:['none'] |
|
429 |
pattern:'*.conf' |
|
4627 | 430 |
fromDirectory:Filename currentDirectory pathName |
3892 | 431 |
whenBoxCreatedEvaluate:nil |
432 |
" |
|
433 |
" |
|
434 |
FileDialog |
|
435 |
requestFileName:'enter a fileName:' |
|
436 |
default:'' |
|
437 |
version:#mustBeNew |
|
438 |
ifFail:['none'] |
|
439 |
pattern:'*.conf' |
|
4627 | 440 |
fromDirectory:Filename currentDirectory pathName |
3892 | 441 |
whenBoxCreatedEvaluate:nil |
442 |
" |
|
3904 | 443 |
! |
444 |
||
445 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
446 |
"launch a Dialog, which allows user to enter a filename. |
|
447 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
448 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
449 |
The box will show okText in its okButton, abortText in the abortButton. |
|
450 |
The matchPattern is set to pattern initially. |
|
3905 | 451 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 452 |
" |
453 |
||
454 |
||
4795 | 455 |
^ self |
456 |
requestFileNames:titleString |
|
457 |
default:defaultName |
|
458 |
ok:okText |
|
459 |
abort:abortText |
|
460 |
ifFail:failBlock |
|
461 |
pattern:pattern |
|
462 |
fromDirectory:aDirectoryPath |
|
463 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
464 |
asLoadDialog:nil. |
|
3956 | 465 |
|
466 |
||
467 |
" |
|
468 |
FileDialog |
|
469 |
requestFileNames:'enter a fileName:' |
|
470 |
default:'' |
|
471 |
ok:nil |
|
472 |
abort:nil |
|
473 |
ifFail:['none'] |
|
474 |
pattern:'*.conf' |
|
4627 | 475 |
fromDirectory:Filename currentDirectory pathName |
3956 | 476 |
whenBoxCreatedEvaluate:nil. |
477 |
" |
|
478 |
! |
|
479 |
||
480 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
481 |
"launch a Dialog, which allows user to enter a filename. |
|
482 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
483 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
484 |
The box will show okText in its okButton, abortText in the abortButton. |
|
485 |
The matchPattern is set to pattern initially. |
|
486 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
487 |
" |
|
488 |
||
489 |
||
3904 | 490 |
| instance enteredFileNames lastDirectory| |
491 |
||
4795 | 492 |
instance := self |
493 |
startApplicationFor:titleString |
|
494 |
default:defaultName |
|
495 |
ok:okText |
|
496 |
abort:abortText |
|
497 |
ifFail:failBlock |
|
498 |
pattern:pattern |
|
499 |
fromDirectory:aDirectoryPath |
|
500 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
501 |
asLoadDialog:asLoadDialog |
|
5329 | 502 |
viewFiles:true |
4795 | 503 |
multipleSelect:true. |
3904 | 504 |
|
3996 | 505 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 506 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
507 |
^ failBlock value |
|
508 |
]. |
|
509 |
lastDirectory := enteredFileNames first. |
|
510 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
511 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
512 |
^ enteredFileNames |
|
513 |
||
514 |
" |
|
515 |
FileDialog |
|
516 |
requestFileNames:'enter a fileName:' |
|
517 |
default:'' |
|
518 |
ok:nil |
|
519 |
abort:nil |
|
520 |
ifFail:['none'] |
|
521 |
pattern:'*.conf' |
|
4627 | 522 |
fromDirectory:Filename currentDirectory pathName |
3956 | 523 |
whenBoxCreatedEvaluate:nil |
524 |
asLoadDialog:true. |
|
3904 | 525 |
" |
526 |
! |
|
527 |
||
5790 | 528 |
startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
3904 | 529 |
"launch a Dialog, which allows user to enter a filename. |
530 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
531 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
532 |
The box will show okText in its okButton, abortText in the abortButton. |
|
533 |
The matchPattern is set to pattern initially. |
|
534 |
Return the string, or nil if cancel was pressed |
|
535 |
The version argument allows validation of the files existance; |
|
536 |
it may be any of: |
|
537 |
#mustBeNew - fail (return empty string) if the file exists |
|
538 |
#new - confirm if the file exists |
|
539 |
#mustBeOld - fail if the file does not exist |
|
540 |
#old - confirm if the file does not exist |
|
541 |
#any (other) - no validation |
|
542 |
" |
|
543 |
||
544 |
||
5790 | 545 |
|defaultDir instance defaultFile okText abortText initialDefaultFileName| |
546 |
||
547 |
initialDefaultFileName := initialDefaultFileNameArg. |
|
548 |
initialDefaultFileName notNil ifTrue:[ |
|
549 |
initialDefaultFileName := initialDefaultFileName asFilename |
|
550 |
]. |
|
5163 | 551 |
|
552 |
okText := okTextArg. |
|
553 |
okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
|
554 |
abortText := abortTextArg. |
|
555 |
abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
|
3904 | 556 |
|
557 |
defaultDir := aDirectoryPath. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
558 |
"/ defaultDir isNil ifTrue:[ |
5790 | 559 |
"/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
560 |
"/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
561 |
"/ ] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
562 |
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
563 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
564 |
"/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
565 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
566 |
"/ defaultDir asFilename exists ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
567 |
"/ defaultDir := nil |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
568 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
569 |
"/ ] |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
570 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
571 |
(initialDefaultFileName notNil |
5790 | 572 |
and:[initialDefaultFileName isAbsolute |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
573 |
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
5790 | 574 |
defaultDir := initialDefaultFileName asAbsoluteFilename. |
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
575 |
true "viewFiles" ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
576 |
defaultFile := defaultDir asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
577 |
defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
578 |
]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
579 |
] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
580 |
defaultDir isNil ifTrue:[ |
5193 | 581 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
582 |
defaultDir isNil ifTrue:[ |
|
583 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
584 |
]. |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
585 |
defaultDir asFilename exists ifFalse:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
586 |
defaultDir := nil |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
587 |
]. |
3956 | 588 |
] |
3904 | 589 |
]. |
4206 | 590 |
defaultDir := defaultDir asFilename asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
591 |
"/ [defaultDir exists] whileFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
592 |
"/ defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
593 |
"/ ]. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
594 |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
595 |
defaultFile isNil ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
596 |
viewFiles ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
597 |
defaultFile := defaultDir asAbsoluteFilename. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
598 |
] ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
599 |
(initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
600 |
defaultFile := defaultDir construct:initialDefaultFileName baseName. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
601 |
] ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
602 |
defaultFile := defaultDir. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
603 |
]. |
3956 | 604 |
]. |
3904 | 605 |
]. |
3956 | 606 |
|
3904 | 607 |
instance := self new. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
608 |
defaultDir notNil ifTrue:[instance directory:defaultDir]. |
3958 | 609 |
instance multipleSelect:multipleSelect ? false. |
3904 | 610 |
instance startFilename:defaultFile. |
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
611 |
instance pattern:((pattern isEmptyOrNil) ifTrue:['*'] ifFalse:[pattern]). |
3904 | 612 |
instance initialText:titleString. |
613 |
instance okLabelHolder value:okText. |
|
614 |
instance cancelLabelHolder value:abortText. |
|
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
615 |
|
4804 | 616 |
instance beLoadDialog:asLoadDialog ? false. |
5329 | 617 |
instance viewFiles:viewFiles ? true. |
3953 | 618 |
self setDoubleClickActionFor:instance. |
3904 | 619 |
instance allButOpenInterface:#windowSpec. |
620 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
621 |
|
8661
086147f751d0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8586
diff
changeset
|
622 |
"/ Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
7571 | 623 |
instance treeBrowser sortCaselessInTreeBrowser value: (Filename isCaseSensitive not). |
3904 | 624 |
instance openWindowModal. |
625 |
^ instance |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
626 |
|
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
627 |
"Modified: / 23-08-2006 / 12:24:54 / cg" |
7571 | 628 |
"Modified: / 13-12-2006 / 16:25:42 / User" |
3892 | 629 |
! ! |
630 |
||
631 |
!FileDialog class methodsFor:'accessing'! |
|
632 |
||
6650 | 633 |
classResources |
9110 | 634 |
^ (FileBrowserV2 ? AbstractFileBrowser) classResources |
6650 | 635 |
! |
636 |
||
5931 | 637 |
lastExtent |
638 |
^ LastExtent |
|
639 |
! |
|
640 |
||
641 |
lastExtent:anExtent |
|
642 |
LastExtent := anExtent |
|
643 |
! |
|
644 |
||
3953 | 645 |
setDoubleClickActionFor:instance |
646 |
||
647 |
instance doubleClickAction:[:anIndex| |
|
648 |
| item | |
|
649 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
650 |
item notNil ifTrue:[ |
|
5329 | 651 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 652 |
instance doAccept. |
653 |
] |
|
654 |
] |
|
655 |
]. |
|
3892 | 656 |
! ! |
657 |
||
8585 | 658 |
!FileDialog class methodsFor:'help specs'! |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
659 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
660 |
flyByHelpSpec |
8585 | 661 |
"This resource specification was automatically generated |
662 |
by the UIHelpTool of ST/X." |
|
663 |
||
664 |
"Do not manually edit this!! If it is corrupted, |
|
665 |
the UIHelpTool may not be able to read the specification." |
|
666 |
||
667 |
" |
|
668 |
UIHelpTool openOnClass:FileDialog |
|
669 |
" |
|
670 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
671 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
672 |
|
8585 | 673 |
^ FileBrowserV2 flyByHelpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
674 |
|
8585 | 675 |
#openFileBrowser |
676 |
'Open a FileBrowser on the selected Directory' |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
677 |
|
8585 | 678 |
) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
679 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
680 |
|
3892 | 681 |
!FileDialog class methodsFor:'interface specs'! |
682 |
||
683 |
windowSpec |
|
684 |
"This resource specification was automatically generated |
|
685 |
by the UIPainter of ST/X." |
|
686 |
||
687 |
"Do not manually edit this!! If it is corrupted, |
|
688 |
the UIPainter may not be able to read the specification." |
|
689 |
||
690 |
" |
|
691 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
692 |
FileDialog new openInterface:#windowSpec |
|
693 |
FileDialog open |
|
694 |
" |
|
695 |
||
696 |
<resource: #canvas> |
|
697 |
||
698 |
^ |
|
5229 | 699 |
#(FullSpec |
700 |
name: windowSpec |
|
701 |
window: |
|
702 |
(WindowSpec |
|
703 |
label: 'FileDialog' |
|
704 |
name: 'FileDialog' |
|
705 |
min: (Point 10 10) |
|
5873 | 706 |
bounds: (Rectangle 0 0 407 400) |
9113 | 707 |
menu: mainMenu |
708 |
performer: treeBrowser |
|
3892 | 709 |
) |
5229 | 710 |
component: |
711 |
(SpecCollection |
|
712 |
collection: ( |
|
713 |
(ViewSpec |
|
714 |
name: 'FilePart' |
|
715 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
716 |
component: |
|
717 |
(SpecCollection |
|
718 |
collection: ( |
|
719 |
(MenuPanelSpec |
|
720 |
name: 'ToolBar1' |
|
8250 | 721 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0) |
5229 | 722 |
tabable: true |
723 |
menu: toolBarMenu |
|
724 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
725 |
) |
5229 | 726 |
(VariableHorizontalPanelSpec |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
727 |
name: 'DeviceAndFilterPanel' |
8250 | 728 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0) |
5229 | 729 |
level: 1 |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
730 |
showHandle: true |
5229 | 731 |
component: |
732 |
(SpecCollection |
|
733 |
collection: ( |
|
734 |
(ViewSpec |
|
735 |
name: 'Box1' |
|
6065 | 736 |
component: |
737 |
(SpecCollection |
|
738 |
collection: ( |
|
739 |
(ComboListSpec |
|
740 |
name: 'ComboList1' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
741 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1) |
6065 | 742 |
visibilityChannel: driveSelectorVisible |
743 |
model: selectedDeviceDrive |
|
744 |
comboList: listOfDeviceDrives |
|
745 |
useIndex: false |
|
746 |
hidePullDownMenuButton: false |
|
747 |
) |
|
748 |
) |
|
749 |
||
750 |
) |
|
4804 | 751 |
) |
5229 | 752 |
(ViewSpec |
753 |
name: 'Box2' |
|
754 |
component: |
|
755 |
(SpecCollection |
|
756 |
collection: ( |
|
757 |
(LabelSpec |
|
758 |
label: 'Filter:' |
|
759 |
name: 'FilterLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
760 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1) |
5229 | 761 |
translateLabel: true |
762 |
adjust: right |
|
4804 | 763 |
) |
5229 | 764 |
(InputFieldSpec |
765 |
name: 'FilterEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
766 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1) |
5229 | 767 |
model: filterHolder |
768 |
immediateAccept: true |
|
769 |
acceptOnReturn: true |
|
770 |
acceptOnTab: true |
|
771 |
acceptOnLostFocus: true |
|
772 |
acceptOnPointerLeave: false |
|
773 |
postBuildCallback: postBuildFilterField: |
|
4804 | 774 |
) |
775 |
) |
|
776 |
||
777 |
) |
|
778 |
) |
|
779 |
) |
|
780 |
||
781 |
) |
|
9113 | 782 |
handles: (Any 0.2972972972973 1.0) |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
783 |
) |
8250 | 784 |
(SubCanvasSpec |
785 |
name: 'DirectoryTreeBrowser' |
|
786 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -30 1) |
|
787 |
tabable: true |
|
788 |
hasHorizontalScrollBar: false |
|
789 |
hasVerticalScrollBar: false |
|
790 |
majorKey: DirectoryTreeBrowser |
|
791 |
subAspectHolders: |
|
792 |
(Array |
|
793 |
||
794 |
(SubChannelInfoSpec |
|
795 |
subAspect: filterModel |
|
796 |
aspect: filterHolder |
|
797 |
) |
|
798 |
(SubChannelInfoSpec |
|
799 |
subAspect: rootHolder |
|
800 |
aspect: rootDirectoryHolder |
|
801 |
) |
|
9113 | 802 |
|
9110 | 803 |
(SubChannelInfoSpec |
804 |
subAspect: showHiddenFiles |
|
805 |
aspect: showHiddenFiles |
|
9113 | 806 |
) |
8250 | 807 |
) |
808 |
createNewApplication: true |
|
809 |
createNewBuilder: true |
|
810 |
postBuildCallback: postBuildTreeBrowser: |
|
811 |
) |
|
5230 | 812 |
(LabelSpec |
813 |
label: 'Filename:' |
|
814 |
name: 'FilenameLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
815 |
layout: (LayoutFrame 3 0 -25 1 73 0 -1 1) |
5230 | 816 |
translateLabel: true |
817 |
labelChannel: filenameLabelHolder |
|
818 |
adjust: left |
|
819 |
) |
|
820 |
(FilenameInputFieldSpec |
|
821 |
name: 'FilenameEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
822 |
layout: (LayoutFrame 70 0 -25 1 -4 1 -1 1) |
5230 | 823 |
tabable: true |
824 |
model: filenameHolder |
|
825 |
immediateAccept: false |
|
826 |
acceptOnPointerLeave: false |
|
5853 | 827 |
hasKeyboardFocusInitially: true |
5230 | 828 |
postBuildCallback: postBuildFileNameField: |
829 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
830 |
) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
831 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
832 |
) |
3892 | 833 |
) |
5229 | 834 |
(HorizontalPanelViewSpec |
835 |
name: 'ButtonPanel' |
|
836 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
837 |
visibilityChannel: buttonPanelVisibleHolder |
|
838 |
horizontalLayout: fitSpace |
|
839 |
verticalLayout: center |
|
840 |
horizontalSpace: 3 |
|
841 |
verticalSpace: 3 |
|
842 |
reverseOrderIfOKAtLeft: true |
|
843 |
component: |
|
844 |
(SpecCollection |
|
845 |
collection: ( |
|
846 |
(ActionButtonSpec |
|
847 |
label: 'Cancel' |
|
848 |
name: 'cancelButton' |
|
849 |
translateLabel: true |
|
850 |
labelChannel: cancelLabelHolder |
|
851 |
tabable: true |
|
852 |
model: doCancel |
|
5873 | 853 |
extent: (Point 131 22) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
854 |
) |
5229 | 855 |
(ActionButtonSpec |
856 |
label: 'Append' |
|
857 |
name: 'appendButton' |
|
858 |
visibilityChannel: appendButtonVisibleHolder |
|
859 |
translateLabel: true |
|
860 |
labelChannel: appendLabelHolder |
|
861 |
tabable: true |
|
862 |
model: appendPressed |
|
5873 | 863 |
extent: (Point 132 22) |
3892 | 864 |
) |
5229 | 865 |
(ActionButtonSpec |
866 |
label: 'OK' |
|
867 |
name: 'okButton' |
|
868 |
translateLabel: true |
|
869 |
labelChannel: okLabelHolder |
|
870 |
tabable: true |
|
871 |
model: okPressed |
|
872 |
isDefault: true |
|
5873 | 873 |
extent: (Point 132 22) |
3892 | 874 |
) |
875 |
) |
|
876 |
||
877 |
) |
|
878 |
) |
|
879 |
) |
|
880 |
||
881 |
) |
|
882 |
) |
|
883 |
! ! |
|
884 |
||
885 |
!FileDialog class methodsFor:'menu specs'! |
|
886 |
||
9113 | 887 |
mainMenu |
888 |
"This resource specification was automatically generated |
|
889 |
by the MenuEditor of ST/X." |
|
890 |
||
891 |
"Do not manually edit this!! If it is corrupted, |
|
892 |
the MenuEditor may not be able to read the specification." |
|
893 |
||
894 |
" |
|
895 |
MenuEditor new openOnClass:FileDialog andSelector:#mainMenu |
|
896 |
(Menu new fromLiteralArrayEncoding:(FileDialog mainMenu)) startUp |
|
897 |
" |
|
898 |
||
899 |
<resource: #menu> |
|
900 |
||
901 |
^ |
|
902 |
#(Menu |
|
903 |
( |
|
904 |
(MenuItem |
|
905 |
label: 'Directory' |
|
906 |
translateLabel: true |
|
907 |
submenu: |
|
908 |
(Menu |
|
909 |
( |
|
910 |
(MenuItem |
|
911 |
label: 'Up' |
|
912 |
itemValue: doGoDirectoryUp |
|
913 |
translateLabel: true |
|
914 |
) |
|
915 |
(MenuItem |
|
916 |
label: '-' |
|
917 |
) |
|
918 |
(MenuItem |
|
919 |
activeHelpKey: directoryBack |
|
920 |
enabled: enableBack |
|
921 |
label: 'Back' |
|
922 |
itemValue: doBack |
|
923 |
translateLabel: true |
|
924 |
) |
|
925 |
(MenuItem |
|
926 |
activeHelpKey: directoryBack |
|
927 |
enabled: enableForward |
|
928 |
label: 'Forward' |
|
929 |
itemValue: doForward |
|
930 |
translateLabel: true |
|
931 |
) |
|
932 |
(MenuItem |
|
933 |
label: '-' |
|
934 |
) |
|
935 |
(MenuItem |
|
936 |
enabled: enableHome |
|
937 |
label: 'Home Directory' |
|
938 |
itemValue: doGotoHomeDirectory |
|
939 |
translateLabel: true |
|
940 |
) |
|
941 |
(MenuItem |
|
942 |
label: 'Bookmarks' |
|
943 |
translateLabel: true |
|
944 |
submenuChannel: bookmarksMenu |
|
945 |
) |
|
946 |
(MenuItem |
|
947 |
label: 'Visited Directories' |
|
948 |
translateLabel: true |
|
949 |
submenuChannel: visitedDirectoriesMenu |
|
950 |
) |
|
951 |
) |
|
952 |
nil |
|
953 |
nil |
|
954 |
) |
|
955 |
) |
|
956 |
(MenuItem |
|
957 |
label: 'View' |
|
958 |
translateLabel: true |
|
959 |
submenu: |
|
960 |
(Menu |
|
961 |
( |
|
962 |
(MenuItem |
|
963 |
label: 'Sort' |
|
964 |
translateLabel: true |
|
965 |
submenuChannel: sortMenu |
|
966 |
) |
|
967 |
(MenuItem |
|
968 |
label: 'Show' |
|
969 |
translateLabel: true |
|
970 |
submenuChannel: showMenuSpecForDialog |
|
971 |
) |
|
972 |
(MenuItem |
|
973 |
label: '-' |
|
974 |
) |
|
975 |
(MenuItem |
|
976 |
label: 'Update' |
|
977 |
itemValue: updateCurrentDirectory |
|
978 |
translateLabel: true |
|
979 |
) |
|
980 |
) |
|
981 |
nil |
|
982 |
nil |
|
983 |
) |
|
984 |
) |
|
985 |
) |
|
986 |
nil |
|
987 |
nil |
|
988 |
) |
|
989 |
! |
|
990 |
||
3892 | 991 |
toolBarMenu |
992 |
"This resource specification was automatically generated |
|
993 |
by the MenuEditor of ST/X." |
|
994 |
||
995 |
"Do not manually edit this!! If it is corrupted, |
|
996 |
the MenuEditor may not be able to read the specification." |
|
997 |
||
998 |
" |
|
999 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
1000 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
1001 |
" |
|
1002 |
||
1003 |
<resource: #menu> |
|
1004 |
||
1005 |
^ |
|
5873 | 1006 |
#(Menu |
1007 |
( |
|
1008 |
(MenuItem |
|
1009 |
activeHelpKey: directoryBack |
|
1010 |
enabled: enableBack |
|
1011 |
label: 'Back' |
|
1012 |
itemValue: doBack |
|
1013 |
translateLabel: true |
|
1014 |
isButton: true |
|
1015 |
submenuChannel: menuDirHistoryBack |
|
6087 | 1016 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 1017 |
keepLinkedMenu: true |
3892 | 1018 |
) |
5873 | 1019 |
(MenuItem |
1020 |
label: '' |
|
3892 | 1021 |
) |
5873 | 1022 |
(MenuItem |
1023 |
activeHelpKey: directoryForward |
|
1024 |
enabled: enableForward |
|
1025 |
label: 'Forward' |
|
1026 |
itemValue: doForward |
|
1027 |
translateLabel: true |
|
1028 |
isButton: true |
|
1029 |
submenuChannel: menuDirHistoryForward |
|
6087 | 1030 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 1031 |
keepLinkedMenu: true |
3892 | 1032 |
) |
5873 | 1033 |
(MenuItem |
6462 | 1034 |
label: '-' |
1035 |
) |
|
1036 |
(MenuItem |
|
1037 |
activeHelpKey: directoryUp |
|
1038 |
enabled: enableDirectoryUp |
|
1039 |
label: 'DirectoryUp' |
|
1040 |
itemValue: doGoDirectoryUp |
|
1041 |
translateLabel: true |
|
1042 |
isButton: true |
|
1043 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 1044 |
) |
5873 | 1045 |
(MenuItem |
1046 |
activeHelpKey: fileHome |
|
1047 |
enabled: enableHome |
|
1048 |
label: 'Home' |
|
1049 |
itemValue: doGotoHomeDirectory |
|
1050 |
translateLabel: true |
|
1051 |
isButton: true |
|
6096 | 1052 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 1053 |
) |
5873 | 1054 |
(MenuItem |
8092 | 1055 |
activeHelpKey: fileDesktop |
8586 | 1056 |
enabled: enableGotoDesktop |
8092 | 1057 |
label: 'Desktop' |
1058 |
itemValue: doGotoDesktopDirectory |
|
1059 |
translateLabel: true |
|
1060 |
isButton: true |
|
1061 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
1062 |
) |
|
1063 |
(MenuItem |
|
6098 | 1064 |
activeHelpKey: fileGotoBookmark |
1065 |
label: 'Bookmarks' |
|
1066 |
translateLabel: true |
|
1067 |
isButton: true |
|
9113 | 1068 |
submenuChannel: gotoBookmarksMenu |
6098 | 1069 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
1070 |
) |
|
1071 |
(MenuItem |
|
5873 | 1072 |
label: '-' |
1073 |
isVisible: newDirectoryVisibilityHolder |
|
3923 | 1074 |
) |
5873 | 1075 |
(MenuItem |
6122 | 1076 |
label: 'New Directory...' |
5873 | 1077 |
itemValue: newDirectory |
1078 |
translateLabel: true |
|
1079 |
isButton: true |
|
1080 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 1081 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 1082 |
) |
8585 | 1083 |
(MenuItem |
1084 |
label: '-' |
|
1085 |
isVisible: browseVisibleHolder |
|
1086 |
) |
|
1087 |
(MenuItem |
|
1088 |
activeHelpKey: openFileBrowser |
|
1089 |
label: 'Browse' |
|
1090 |
itemValue: doBrowseDirectory |
|
1091 |
translateLabel: true |
|
1092 |
isButton: true |
|
1093 |
isVisible: browseVisibleHolder |
|
1094 |
labelImage: (ResourceRetriever ToolbarIconLibrary startFileBrowserIcon) |
|
1095 |
) |
|
3892 | 1096 |
) |
1097 |
nil |
|
1098 |
nil |
|
1099 |
) |
|
9113 | 1100 |
! |
1101 |
||
1102 |
viewInContentsBrowserMenu |
|
1103 |
^ DirectoryContentsBrowser showMenuSpec |
|
3892 | 1104 |
! ! |
1105 |
||
8182 | 1106 |
!FileDialog class methodsFor:'plugIn spec'! |
1107 |
||
1108 |
aspectSelectors |
|
1109 |
"This resource specification was automatically generated |
|
1110 |
by the UIPainter of ST/X." |
|
1111 |
||
1112 |
"Do not manually edit this. If it is corrupted, |
|
1113 |
the UIPainter may not be able to read the specification." |
|
1114 |
||
1115 |
"Return a description of exported aspects; |
|
1116 |
these can be connected to aspects of an embedding application |
|
1117 |
(if this app is embedded in a subCanvas)." |
|
1118 |
||
1119 |
^ #( |
|
1120 |
#filenameHolder |
|
1121 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1122 |
#rootDirectoryHolder |
8182 | 1123 |
). |
1124 |
||
1125 |
! ! |
|
1126 |
||
3892 | 1127 |
!FileDialog methodsFor:'accessing'! |
1128 |
||
3996 | 1129 |
currentSelectedFiles |
1130 |
||
1131 |
| selectedFiles| |
|
1132 |
||
1133 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1134 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
1135 |
! |
|
1136 |
||
3892 | 1137 |
directory |
1138 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1139 |
||
1140 |
^ directory |
|
1141 |
! |
|
1142 |
||
1143 |
directory:something |
|
1144 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1145 |
||
1146 |
directory := something. |
|
1147 |
! |
|
1148 |
||
1149 |
initialText |
|
1150 |
||
5598 | 1151 |
initialText isNil ifTrue:[ |
1152 |
^ resources string:'File Dialog'. |
|
1153 |
]. |
|
1154 |
^ resources string:initialText |
|
3892 | 1155 |
! |
1156 |
||
1157 |
initialText:something |
|
1158 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
1159 |
||
1160 |
initialText := something. |
|
1161 |
! |
|
1162 |
||
1163 |
pattern |
|
1164 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1165 |
||
1166 |
^ pattern |
|
1167 |
! |
|
1168 |
||
1169 |
pattern:something |
|
1170 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1171 |
||
1172 |
pattern := something. |
|
1173 |
! |
|
1174 |
||
1175 |
result |
|
1176 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1177 |
||
1178 |
^ result |
|
1179 |
! |
|
1180 |
||
1181 |
result:something |
|
1182 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1183 |
||
1184 |
result := something. |
|
1185 |
! |
|
1186 |
||
3904 | 1187 |
selectedDirectories |
1188 |
||
1189 |
| selectedFiles| |
|
1190 |
||
1191 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1192 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1193 |
! |
|
1194 |
||
3892 | 1195 |
startFilename |
1196 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
1197 |
||
1198 |
startFilename isNil ifTrue:[ |
|
1199 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1200 |
]. |
|
1201 |
^ startFilename |
|
1202 |
! |
|
1203 |
||
1204 |
startFilename:something |
|
1205 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
1206 |
||
1207 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1208 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1209 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1210 |
!FileDialog methodsFor:'accessing-behavior'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1211 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1212 |
asLoadDialog |
4804 | 1213 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1214 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1215 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1216 |
asLoadDialog:aBoolean |
4804 | 1217 |
self beLoadDialog:aBoolean |
1218 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1219 |
|
4804 | 1220 |
beLoadDialog:aBoolean |
1221 |
||
1222 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1223 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1224 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1225 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1226 |
"return the value of the instance variable 'doubleClickAction' (automatically generated)" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1227 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1228 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1229 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1230 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1231 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1232 |
"set the value of the instance variable 'doubleClickAction' (automatically generated)" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1233 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1234 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1235 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1236 |
|
4804 | 1237 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1238 |
|
4804 | 1239 |
^ isLoadDialog ? true |
1240 |
! |
|
1241 |
||
1242 |
multipleSelect |
|
1243 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1244 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1245 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1246 |
multipleSelect:aBoolean |
4804 | 1247 |
multipleSelect := aBoolean. |
1248 |
treeBrowser notNil ifTrue:[ |
|
1249 |
treeBrowser multipleSelect:aBoolean. |
|
1250 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1251 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1252 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1253 |
!FileDialog methodsFor:'accessing-components'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1254 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1255 |
addButton:aButton |
6068 | 1256 |
|buttonPanel okButton| |
1257 |
||
1258 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1259 |
okButton := self okButton. |
|
1260 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1261 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1262 |
buttonPanel addSubView:aButton before:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1263 |
] ifFalse:[ |
6068 | 1264 |
buttonPanel addSubView:aButton after:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1265 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1266 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1267 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1268 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1269 |
^ (self componentAt:#okButton) |
3892 | 1270 |
! |
1271 |
||
3904 | 1272 |
treeBrowser |
1273 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1274 |
||
1275 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1276 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1277 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1278 |
!FileDialog methodsFor:'accessing-look'! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1279 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1280 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1281 |
self buttonPanelVisibleHolder value:false |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1282 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1283 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1284 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1285 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1286 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1287 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1288 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1289 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1290 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1291 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1292 |
self buttonPanelVisibleHolder value:true |
3904 | 1293 |
! |
1294 |
||
3892 | 1295 |
viewFiles |
1296 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1297 |
||
1298 |
^ viewFiles |
|
1299 |
! |
|
1300 |
||
1301 |
viewFiles:something |
|
1302 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1303 |
||
1304 |
viewFiles := something. |
|
1305 |
! ! |
|
1306 |
||
1307 |
!FileDialog methodsFor:'aspects'! |
|
1308 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1309 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1310 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1311 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1312 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1313 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1314 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1315 |
|
5193 | 1316 |
appendLabelHolder |
1317 |
appendLabelHolder isNil ifTrue:[ |
|
1318 |
appendLabelHolder := 'Append' asValue. |
|
1319 |
]. |
|
1320 |
^ appendLabelHolder |
|
1321 |
! |
|
1322 |
||
4804 | 1323 |
aspectOrNil:aKey forSubApplication:aSubApp |
1324 |
"this hook provides an aspect for a subApp" |
|
1325 |
||
1326 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1327 |
directory notNil ifTrue:[ |
|
1328 |
^ (OrderedCollection with:directory) asValue |
|
1329 |
] |
|
1330 |
]. |
|
1331 |
^ nil |
|
1332 |
! |
|
1333 |
||
5969 | 1334 |
browseVisibleHolder |
1335 |
browseVisibleHolder isNil ifTrue:[ |
|
8585 | 1336 |
browseVisibleHolder := true "false" asValue. |
5969 | 1337 |
]. |
1338 |
^ browseVisibleHolder. |
|
1339 |
! |
|
1340 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1341 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1342 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1343 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1344 |
buttonPanelVisibleHolder onChangeSend:#buttonPanelVisibilityChanged to:self. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1345 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1346 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1347 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1348 |
|
3892 | 1349 |
cancelLabelHolder |
1350 |
||
1351 |
cancelLabelHolder isNil ifTrue:[ |
|
1352 |
cancelLabelHolder := 'Cancel' asValue. |
|
1353 |
]. |
|
1354 |
^ cancelLabelHolder. |
|
1355 |
! |
|
1356 |
||
1357 |
enableBack |
|
4804 | 1358 |
^ treeBrowser enableBack. |
3892 | 1359 |
! |
1360 |
||
1361 |
enableDirectoryUp |
|
4804 | 1362 |
^ treeBrowser enableDirectoryUp. |
3892 | 1363 |
! |
1364 |
||
1365 |
enableForward |
|
4804 | 1366 |
^ treeBrowser enableForward. |
3892 | 1367 |
! |
1368 |
||
8169 | 1369 |
enableGotoDesktop |
1370 |
^ treeBrowser enableGotoDesktop. |
|
1371 |
! |
|
1372 |
||
3892 | 1373 |
enableHome |
4804 | 1374 |
^ treeBrowser enableHome. |
3892 | 1375 |
! |
1376 |
||
9269
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1377 |
fileEntryFieldHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1378 |
"for directoryTreeBrowser" |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1379 |
|
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1380 |
^ self filenameHolder |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1381 |
! |
4d09efee3752
added: #fileEntryFieldHolder
Claus Gittinger <cg@exept.de>
parents:
9113
diff
changeset
|
1382 |
|
3892 | 1383 |
filenameHolder |
1384 |
"Return a value holder with the filename. |
|
1385 |
Shown in the filename input-field. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1386 |
Being the selection in the tree." |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1387 |
|
3892 | 1388 |
|holder| |
7581 | 1389 |
|
3892 | 1390 |
holder := builder bindingAt:#filenameHolder. |
1391 |
||
7581 | 1392 |
holder isNil ifTrue:[ |
3892 | 1393 |
holder := ValueHolder new. |
1394 |
holder addDependent:self. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1395 |
builder aspectAt:#filenameHolder put:holder. |
3892 | 1396 |
]. |
1397 |
||
1398 |
^ holder. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1399 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1400 |
"Modified: / 09-07-2010 / 19:25:15 / cg" |
3892 | 1401 |
! |
1402 |
||
8183 | 1403 |
filenameHolder:aHolder |
8182 | 1404 |
"needed when used as subcanvas" |
8183 | 1405 |
|
1406 |
|holder| |
|
8182 | 1407 |
|
8183 | 1408 |
holder := builder aspectAt:#filenameHolder. |
1409 |
holder notNil ifTrue:[ |
|
1410 |
holder removeDependent:self |
|
1411 |
]. |
|
8182 | 1412 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1413 |
aHolder addDependent:self |
8182 | 1414 |
! |
1415 |
||
3904 | 1416 |
filenameLabelHolder |
1417 |
"Return a value holder for the input string. |
|
1418 |
" |
|
1419 |
filenameLabelHolder isNil ifTrue:[ |
|
1420 |
filenameLabelHolder := 'Filename:' asValue. |
|
1421 |
]. |
|
1422 |
^ filenameLabelHolder |
|
1423 |
! |
|
1424 |
||
3892 | 1425 |
filterHolder |
8183 | 1426 |
"Return a value holder for filter" |
3892 | 1427 |
|
1428 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1429 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1430 |
]. |
1431 |
^ filterHolder |
|
1432 |
! |
|
1433 |
||
8183 | 1434 |
filterHolder:aHolder |
1435 |
"needed when used as subcanvas" |
|
1436 |
||
1437 |
filterHolder := aHolder. |
|
1438 |
! |
|
1439 |
||
9113 | 1440 |
gotoBookmarksMenu |
6098 | 1441 |
<resource: #programMenu> |
1442 |
||
9113 | 1443 |
^ treeBrowser gotoBookmarksMenu |
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1444 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1445 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1446 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1447 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1448 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1449 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1450 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1451 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1452 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1453 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1454 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1455 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1456 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1457 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1458 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1459 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1460 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1461 |
"/ ^ menu |
6098 | 1462 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1463 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1464 |
! |
1465 |
||
6065 | 1466 |
listOfDeviceDrives |
1467 |
||
1468 |
listOfDeviceDrives isNil ifTrue:[ |
|
1469 |
listOfDeviceDrives := Filename volumes. |
|
1470 |
]. |
|
1471 |
^ listOfDeviceDrives |
|
1472 |
! |
|
1473 |
||
3892 | 1474 |
okLabelHolder |
1475 |
"automatically generated by UIPainter ..." |
|
1476 |
||
1477 |
"*** the code below creates a default model when invoked." |
|
1478 |
"*** (which may not be the one you wanted)" |
|
1479 |
"*** Please change as required and accept it in the browser." |
|
1480 |
"*** (and replace this comment by something more useful ;-)" |
|
1481 |
||
1482 |
okLabelHolder isNil ifTrue:[ |
|
1483 |
okLabelHolder := 'OK' asValue. |
|
1484 |
]. |
|
1485 |
^ okLabelHolder. |
|
6065 | 1486 |
! |
1487 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1488 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1489 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1490 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1491 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1492 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1493 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1494 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1495 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1496 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1497 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1498 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1499 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1500 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1501 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1502 |
|
6065 | 1503 |
selectedDeviceDrive |
1504 |
||
1505 |
selectedDeviceDrive isNil ifTrue:[ |
|
1506 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1507 |
selectedDeviceDrive addDependent:self. |
|
1508 |
]. |
|
1509 |
^ selectedDeviceDrive |
|
9110 | 1510 |
! |
1511 |
||
9113 | 1512 |
showDirectoryTree |
1513 |
^ false |
|
1514 |
! |
|
1515 |
||
1516 |
showDiskUsageHolder |
|
1517 |
^ treeBrowser showDiskUsageHolder |
|
1518 |
! |
|
1519 |
||
9110 | 1520 |
showHiddenFiles |
9113 | 1521 |
^ treeBrowser showHiddenFiles |
1522 |
! |
|
1523 |
||
1524 |
shownFiles |
|
1525 |
^ treeBrowser shownFiles |
|
1526 |
! |
|
1527 |
||
1528 |
sortCaselessInTreeBrowser |
|
1529 |
^ treeBrowser sortCaselessInTreeBrowser |
|
1530 |
! |
|
1531 |
||
1532 |
sortInTreeVisibilityHolder |
|
1533 |
^ true |
|
1534 |
! |
|
1535 |
||
1536 |
sortPropertyInTree |
|
1537 |
^ treeBrowser sortBlockProperty |
|
1538 |
! |
|
1539 |
||
1540 |
viewDirsInContentsBrowser |
|
1541 |
^ false |
|
1542 |
! |
|
1543 |
||
1544 |
viewFilesInDirectoryTree |
|
1545 |
^ false |
|
1546 |
! |
|
1547 |
||
1548 |
viewNoteBookApplicationHolder |
|
9110 | 1549 |
^ false |
3892 | 1550 |
! ! |
1551 |
||
1552 |
!FileDialog methodsFor:'change & update'! |
|
1553 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1554 |
buttonPanelVisibilityChanged |
5598 | 1555 |
|filePart| |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1556 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1557 |
filePart := builder componentAt:#FilePart. |
5598 | 1558 |
filePart notNil ifTrue:[ |
1559 |
buttonPanelVisibleHolder value ifTrue:[ |
|
1560 |
filePart layout bottomOffset:-40 |
|
1561 |
] ifFalse:[ |
|
1562 |
filePart layout bottomOffset:0 |
|
1563 |
]. |
|
1564 |
filePart containerChangedSize "/ force resize |
|
1565 |
] |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1566 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1567 |
|
6065 | 1568 |
selectedDeviceDriveChanged |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1569 |
|newDrive curSel newFile| |
6065 | 1570 |
|
1571 |
newDrive := self selectedDeviceDrive value. |
|
1572 |
curSel := treeBrowser currentFileNameHolder value. |
|
1573 |
curSel notEmpty ifTrue:[ |
|
1574 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1575 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1576 |
|
6065 | 1577 |
newDrive notNil ifTrue:[ |
1578 |
newFile := newDrive asFilename. |
|
1579 |
newFile isReadable ifTrue:[ |
|
1580 |
treeBrowser gotoFile:newFile. |
|
1581 |
^self. |
|
1582 |
]. |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1583 |
self warn:'Cannot open drive %1' with:newFile asFilename volume. |
6065 | 1584 |
]. |
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1585 |
|
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1586 |
newDrive := curSel notEmpty ifTrue:[ curSel first volume ] ifFalse:[ 'C:' ]. |
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1587 |
self selectedDeviceDrive value:newDrive. |
6065 | 1588 |
! |
1589 |
||
3892 | 1590 |
update:something with:aParameter from:changedObject |
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1591 |
|files newFile newLabel fn entryFieldFilename filenameHolder| |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1592 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1593 |
filenameHolder := self filenameHolder. |
3892 | 1594 |
|
1595 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1596 |
files := changedObject value. |
3892 | 1597 |
|
1598 |
(files isEmpty) ifTrue:[ |
|
4804 | 1599 |
newFile := nil. |
3892 | 1600 |
] ifFalse:[ |
1601 |
files size == 1 ifTrue:[ |
|
4804 | 1602 |
newFile := files first. |
3892 | 1603 |
] ifFalse:[ |
4804 | 1604 |
newFile := ''. |
3892 | 1605 |
]. |
1606 |
]. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1607 |
(filenameHolder value notNil |
5924 | 1608 |
and:[newFile notNil |
1609 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1610 |
entryFieldFilename := filenameHolder value asFilename. |
5867 | 1611 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6122
diff
changeset
|
1612 |
entryFieldFilename isDirectory ifFalse:[ |
5867 | 1613 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
1614 |
]. |
|
1615 |
]. |
|
1616 |
]. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1617 |
filenameHolder value:newFile withoutNotifying:self. |
6065 | 1618 |
OperatingSystem supportsVolumes ifTrue:[ |
1619 |
| volume | |
|
1620 |
volume := (files size >= 1) |
|
1621 |
ifTrue:[files first volume] |
|
1622 |
ifFalse:nil. |
|
1623 |
self selectedDeviceDrive value:volume. |
|
1624 |
]. |
|
3892 | 1625 |
]. |
4804 | 1626 |
|
6065 | 1627 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1628 |
self selectedDeviceDriveChanged. |
|
1629 |
^ self. |
|
1630 |
]. |
|
3904 | 1631 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1632 |
changedObject value ifTrue:[ |
|
4804 | 1633 |
newLabel := 'Filename:'. |
3904 | 1634 |
] ifFalse:[ |
4804 | 1635 |
newLabel := 'Directory:'. |
1636 |
]. |
|
1637 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1638 |
]. |
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1639 |
changedObject == filenameHolder ifTrue:[ |
4804 | 1640 |
fn := changedObject value asFilename. |
1641 |
(fn exists) ifFalse:[^ self]. |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1642 |
treeBrowser currentFileNameHolder |
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1643 |
value:(OrderedCollection with:fn) withoutNotifying:self. |
5949 | 1644 |
fn isDirectory ifTrue:[ |
1645 |
treeBrowser expandEnforceSelectedItems. |
|
1646 |
]. |
|
3892 | 1647 |
]. |
1648 |
^ super update:something with:aParameter from:changedObject |
|
9514
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1649 |
|
c818ca8969f7
comment/format in: #filenameHolder
Claus Gittinger <cg@exept.de>
parents:
9476
diff
changeset
|
1650 |
"Modified: / 09-07-2010 / 19:34:55 / cg" |
3892 | 1651 |
! ! |
1652 |
||
1653 |
!FileDialog methodsFor:'event handling'! |
|
1654 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1655 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1656 |
"valid after the dialog has been closed: true if append was pressed" |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1657 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1658 |
^ appendWasPressed |
3892 | 1659 |
! ! |
1660 |
||
1661 |
!FileDialog methodsFor:'initialization & release'! |
|
1662 |
||
5932 | 1663 |
closeDownViews |
1664 |
self remarkExtent. |
|
1665 |
super closeDownViews. |
|
1666 |
! |
|
1667 |
||
1668 |
closeWindow |
|
1669 |
self remarkExtent. |
|
1670 |
super closeWindow. |
|
1671 |
! |
|
1672 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1673 |
commonPostOpen |
8182 | 1674 |
|selection| |
3892 | 1675 |
|
1676 |
"/ self windowGroup addPreEventHook:self. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1677 |
|
3892 | 1678 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1679 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1680 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1681 |
|
6409 | 1682 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1683 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1684 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1685 |
|
1686 |
self isLoadDialog ifTrue:[ |
|
4796 | 1687 |
treeBrowser newVisibilityHolder value:false. |
1688 |
treeBrowser allowFileOperations value:false. |
|
1689 |
self newDirectoryVisibilityHolder value:false. |
|
1690 |
]. |
|
5927 | 1691 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1692 |
|
1693 |
selection := treeBrowser treeSelectionHolder value. |
|
1694 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1695 |
selection := selection asCollection first. |
5929 | 1696 |
selection enforcedExpand. |
1697 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1698 |
]. |
|
4796 | 1699 |
! |
1700 |
||
6409 | 1701 |
initialRootDirectory |
1702 |
"returns the directory the browser is open on |
|
1703 |
" |
|
1704 |
|root| |
|
1705 |
||
9678 | 1706 |
initialRoot isNil ifTrue:[ |
6409 | 1707 |
|
9678 | 1708 |
(root := self directory) notNil ifTrue:[ |
1709 |
root := root asFilename. |
|
6409 | 1710 |
|
1711 |
root isDirectory ifFalse:[ |
|
9678 | 1712 |
root := root directory. |
1713 |
root isDirectory ifFalse:[ |
|
1714 |
root := nil. |
|
1715 |
] |
|
6409 | 1716 |
] |
9678 | 1717 |
]. |
1718 |
root isNil ifTrue:[ |
|
1719 |
root := Filename currentDirectory. |
|
1720 |
]. |
|
1721 |
initialRoot := root asAbsoluteFilename. |
|
6409 | 1722 |
]. |
9678 | 1723 |
^ initialRoot |
1724 |
||
1725 |
"Modified: / 27-12-2010 / 09:56:30 / cg" |
|
6409 | 1726 |
! |
1727 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1728 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1729 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1730 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1731 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1732 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1733 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1734 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1735 |
filterField := aWidget. |
4796 | 1736 |
! |
1737 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1738 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1739 |
treeBrowser := aSubCanvasView client. |
6409 | 1740 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
9113 | 1741 |
treeBrowser sortPropertyInTree:(treeBrowser sortBlockProperty). |
9553 | 1742 |
treeBrowser showHiddenFiles value:true. |
1743 |
||
1744 |
"Modified: / 24-08-2010 / 16:07:16 / sr" |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1745 |
! |
4796 | 1746 |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1747 |
postBuildWith:aBuilder |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1748 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1749 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1750 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1751 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1752 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1753 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1754 |
|
6632 | 1755 |
super postBuildWith:aBuilder |
5932 | 1756 |
! |
1757 |
||
8182 | 1758 |
postOpenAsSubcanvasWith:aBuilder |
1759 |
super postOpenAsSubcanvasWith:aBuilder. |
|
1760 |
||
1761 |
"No ok and cancel buttons, when dialog is part of a larger dialog" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1762 |
self hideButtonPanel. |
8183 | 1763 |
|
1764 |
"filenameHolder contains the initial file name" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1765 |
self startFilename:self filenameHolder value. |
8183 | 1766 |
treeBrowser currentFileNameHolder value:(Array with:self filenameHolder value). |
8182 | 1767 |
! |
1768 |
||
1769 |
postOpenWith:aBuilder |
|
1770 |
|lastExtent| |
|
1771 |
||
1772 |
super postOpenWith:aBuilder. |
|
8183 | 1773 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename). |
8182 | 1774 |
|
1775 |
lastExtent := self class lastExtent. |
|
1776 |
lastExtent notNil ifTrue:[ |
|
1777 |
self window topView extent:lastExtent. |
|
1778 |
]. |
|
1779 |
self window label:self initialText. |
|
1780 |
! |
|
1781 |
||
5932 | 1782 |
remarkExtent |
1783 |
self class lastExtent:self window topView extent. |
|
4796 | 1784 |
! ! |
1785 |
||
9113 | 1786 |
!FileDialog methodsFor:'menus'! |
1787 |
||
1788 |
bookmarksMenu |
|
1789 |
^ treeBrowser bookmarksMenu |
|
1790 |
! |
|
1791 |
||
1792 |
directoryMenu |
|
1793 |
self halt. |
|
1794 |
^ treeBrowser directoryMenu |
|
1795 |
! |
|
1796 |
||
1797 |
showMenuSpecForDialog |
|
1798 |
^ treeBrowser class showMenuSpecForDialog |
|
1799 |
! |
|
1800 |
||
1801 |
sortMenu |
|
1802 |
^ treeBrowser class sortInTreeMenu |
|
1803 |
! |
|
1804 |
||
1805 |
visitedDirectoriesMenu |
|
1806 |
^ treeBrowser visitedDirectoriesMenu |
|
1807 |
! ! |
|
1808 |
||
4796 | 1809 |
!FileDialog methodsFor:'private'! |
1810 |
||
1811 |
returnWasPressedInFilterField |
|
8663 | 1812 |
|wg ev| |
4796 | 1813 |
|
8663 | 1814 |
((wg := self windowGroup) notNil |
1815 |
and:[ (ev := wg lastEvent) notNil |
|
1816 |
and:[ ev isKeyEvent |
|
1817 |
and:[ ev key == #Return |
|
1818 |
and:[ (ev targetView isSameOrComponentOf:filterField) |
|
1819 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]]) ifTrue:[ |
|
4796 | 1820 |
^ true |
1821 |
]. |
|
1822 |
^ false |
|
1823 |
! |
|
1824 |
||
1825 |
returnWasPressedInFilterOrFilenameField |
|
1826 |
|ev| |
|
1827 |
||
1828 |
ev := self windowGroup lastEvent. |
|
1829 |
(ev notNil |
|
1830 |
and:[ev isKeyEvent |
|
1831 |
and:[ev key == #Return |
|
1832 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1833 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1834 |
^ true |
|
1835 |
]. |
|
1836 |
^ false |
|
1837 |
! ! |
|
1838 |
||
6065 | 1839 |
!FileDialog methodsFor:'queries'! |
1840 |
||
1841 |
driveSelectorVisible |
|
1842 |
^ OperatingSystem isMSDOSlike |
|
1843 |
! ! |
|
1844 |
||
4796 | 1845 |
!FileDialog methodsFor:'user actions'! |
1846 |
||
1847 |
appendPressed |
|
1848 |
appendWasPressed := true. |
|
1849 |
self commonAcceptAction. |
|
1850 |
! |
|
1851 |
||
1852 |
commonAcceptAction |
|
1853 |
filenameField accept. |
|
1854 |
self result:(self filenameHolder value asString). |
|
1855 |
||
1856 |
^ super doAccept |
|
1857 |
! |
|
1858 |
||
1859 |
doAccept |
|
1860 |
"force accept - ignore in filterField" |
|
1861 |
||
1862 |
self returnWasPressedInFilterField ifTrue:[ |
|
1863 |
^ self |
|
1864 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1865 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1866 |
"/ have to send the event to the TreeView |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1867 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1868 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1869 |
]. |
4796 | 1870 |
appendWasPressed := false. |
1871 |
self commonAcceptAction. |
|
1872 |
! |
|
1873 |
||
1874 |
doBack |
|
1875 |
||
1876 |
treeBrowser doBack. |
|
1877 |
! |
|
1878 |
||
5966 | 1879 |
doBrowseDirectory |
1880 |
UserPreferences fileBrowserClass openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
|
1881 |
||
1882 |
||
1883 |
! |
|
1884 |
||
4796 | 1885 |
doCancel |
1886 |
||
1887 |
self result:nil. |
|
1888 |
^ super doCancel. |
|
1889 |
! |
|
1890 |
||
1891 |
doForward |
|
1892 |
||
1893 |
treeBrowser doForward. |
|
1894 |
! |
|
1895 |
||
1896 |
doGoDirectoryUp |
|
1897 |
||
1898 |
treeBrowser doGoDirectoryUp. |
|
1899 |
! |
|
1900 |
||
8092 | 1901 |
doGotoDesktopDirectory |
1902 |
||
1903 |
treeBrowser doGotoDesktopDirectory. |
|
1904 |
! |
|
1905 |
||
4796 | 1906 |
doGotoHomeDirectory |
1907 |
||
1908 |
treeBrowser doGotoHomeDirectory. |
|
1909 |
! |
|
1910 |
||
1911 |
menuDirHistory:backOrForward |
|
1912 |
||
1913 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1914 |
! |
|
1915 |
||
1916 |
menuDirHistoryBack |
|
1917 |
||
1918 |
^ treeBrowser menuDirHistory:#back. |
|
1919 |
! |
|
1920 |
||
1921 |
menuDirHistoryForward |
|
1922 |
||
1923 |
^ treeBrowser menuDirHistory:#forward. |
|
1924 |
! |
|
1925 |
||
1926 |
newDirectory |
|
1927 |
||
1928 |
^ treeBrowser newDirectory |
|
1929 |
! |
|
1930 |
||
1931 |
okPressed |
|
1932 |
self doAccept |
|
9113 | 1933 |
! |
1934 |
||
1935 |
updateCurrentDirectory |
|
1936 |
treeBrowser updateCurrentDirectory |
|
4796 | 1937 |
! ! |
1938 |
||
1939 |
!FileDialog class methodsFor:'documentation'! |
|
1940 |
||
1941 |
version |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1942 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.112 2011-01-14 12:53:49 cg Exp $' |
9110 | 1943 |
! |
1944 |
||
1945 |
version_CVS |
|
9683
83fb945b7a5a
changed: #selectedDeviceDriveChanged
Claus Gittinger <cg@exept.de>
parents:
9678
diff
changeset
|
1946 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.112 2011-01-14 12:53:49 cg Exp $' |
4796 | 1947 |
! ! |