author | penk |
Fri, 25 Oct 2002 13:11:24 +0200 | |
changeset 4057 | 73bc66a13c39 |
parent 4030 | 60697a642067 |
child 4080 | c32f68f51f47 |
permissions | -rw-r--r-- |
3892 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
SimpleDialog subclass:#FileDialog |
|
4 |
instanceVariableNames:'aspects treeBrowser enableBack enableDirectoryUp enableForward |
|
5 |
enableHome directory pattern filterHolder initialText |
|
3953 | 6 |
doubleClickAction cancelLabelHolder okLabelHolder startFilename |
3956 | 7 |
result filterField filenameField viewFiles filenameLabelHolder |
3958 | 8 |
asLoadDialog newDirectoryVisibilityHolder multipleSelect' |
3892 | 9 |
classVariableNames:'LastFileSelectionDirectory' |
10 |
poolDictionaries:'' |
|
11 |
category:'Interface-Tools-File' |
|
12 |
! |
|
13 |
||
14 |
!FileDialog class methodsFor:'documentation'! |
|
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
documentation to be added. |
|
19 |
||
20 |
[author:] |
|
21 |
Martin Walser (martin@vercingetorix) |
|
22 |
||
23 |
[instance variables:] |
|
24 |
||
25 |
[class variables:] |
|
26 |
||
27 |
[see also:] |
|
28 |
||
29 |
" |
|
30 |
! |
|
31 |
||
32 |
examples |
|
33 |
" |
|
34 |
Starting the application: |
|
35 |
[exBegin] |
|
36 |
FileDialog open |
|
37 |
||
38 |
[exEnd] |
|
39 |
||
40 |
more examples to be added: |
|
41 |
[exBegin] |
|
42 |
... add code fragment for |
|
43 |
... executable example here ... |
|
44 |
[exEnd] |
|
45 |
" |
|
46 |
! |
|
47 |
||
48 |
history |
|
49 |
"Created: / 19.9.2002 / 13:05:28 / martin" |
|
50 |
! ! |
|
51 |
||
52 |
!FileDialog class methodsFor:'instance creation'! |
|
53 |
||
54 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
55 |
"same as requestFileName, but only show directories" |
|
56 |
||
57 |
^ self requestDirectoryName:title |
|
58 |
default:aFileName |
|
59 |
ok:nil |
|
60 |
abort:nil |
|
61 |
version:nil |
|
62 |
pattern:nil |
|
63 |
fromDirectory:nil |
|
64 |
ifFail:failBlock |
|
3956 | 65 |
whenBoxCreatedEvaluate:nil |
66 |
asLoadDialog:nil. |
|
3892 | 67 |
|
68 |
" |
|
3904 | 69 |
FileDialog |
3892 | 70 |
requestDirectoryName:'which directory ?' |
71 |
default:'/etc' |
|
72 |
ifFail:'none' |
|
73 |
" |
|
74 |
! |
|
75 |
||
3956 | 76 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 77 |
"same as requestFileName, but only show directories" |
78 |
||
3956 | 79 |
|enteredFileName instance enteredFileNameString| |
3892 | 80 |
|
3956 | 81 |
instance := self startApplicationFor:titleString |
82 |
default:aFileName |
|
83 |
ok:okText |
|
84 |
abort:abortText |
|
85 |
ifFail:failBlock |
|
86 |
pattern:pattern |
|
87 |
fromDirectory:aDirectoryPath |
|
88 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
89 |
asLoadDialog:aBoolean |
|
3958 | 90 |
forDirectory:true |
91 |
multipleSelect:false. |
|
3892 | 92 |
|
93 |
enteredFileNameString := instance result. |
|
94 |
enteredFileNameString isNil ifTrue:[ |
|
95 |
^ failBlock value |
|
96 |
]. |
|
97 |
enteredFileName := enteredFileNameString asFilename. |
|
98 |
enteredFileNameString := enteredFileName asString. |
|
99 |
(enteredFileName notNil |
|
100 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
101 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
102 |
versionSymbol == #mustBeNew ifTrue:[ |
|
103 |
"/ file may not exist |
|
104 |
enteredFileName exists ifTrue:[^ '']. |
|
105 |
]. |
|
106 |
versionSymbol == #new ifTrue:[ |
|
107 |
"/ file may not exist |
|
108 |
enteredFileName exists ifTrue:[ |
|
109 |
(Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
110 |
ifFalse:[^ '']. |
|
111 |
]. |
|
112 |
]. |
|
113 |
versionSymbol == #mustBeOld ifTrue:[ |
|
114 |
enteredFileName exists ifFalse:[^ '']. |
|
115 |
]. |
|
116 |
versionSymbol == #old ifTrue:[ |
|
117 |
"/ file may not exist |
|
118 |
enteredFileName exists ifFalse:[ |
|
119 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
120 |
ifFalse:[^ '']. |
|
121 |
]. |
|
122 |
]. |
|
123 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
124 |
]. |
|
125 |
^ enteredFileNameString |
|
126 |
||
127 |
" |
|
128 |
FileDialog |
|
129 |
requestDirectoryName:'which directory ?' |
|
130 |
default:'/etc' |
|
131 |
ifFail:nil |
|
132 |
" |
|
3956 | 133 |
" |
134 |
FileDialog |
|
135 |
requestDirectoryName:'which directory ?' |
|
136 |
default:'/etc' |
|
137 |
ok:nil |
|
138 |
abort:nil |
|
139 |
version:nil |
|
140 |
pattern:nil |
|
141 |
fromDirectory:nil |
|
142 |
ifFail:nil |
|
143 |
whenBoxCreatedEvaluate:nil |
|
144 |
asLoadDialog:true |
|
145 |
" |
|
3892 | 146 |
! |
147 |
||
148 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
149 |
||
150 |
^ self requestFileName:titleString |
|
151 |
default:defaultName |
|
152 |
ok:okText |
|
153 |
abort:abortText |
|
154 |
version:nil |
|
155 |
ifFail:nil |
|
156 |
pattern:pattern |
|
157 |
fromDirectory:aDirectoryPathOrNil |
|
158 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
159 |
! |
|
160 |
||
161 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
162 |
"launch a Dialog, which allows user to enter a filename. |
|
163 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
164 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
165 |
The box will show okText in its okButton, abortText in the abortButton. |
|
166 |
The matchPattern is set to pattern initially. |
|
167 |
Return the string, or nil if cancel was pressed |
|
168 |
The version argument allows validation of the files existance; |
|
169 |
it may be any of: |
|
170 |
#mustBeNew - fail (return empty string) if the file exists |
|
171 |
#new - confirm if the file exists |
|
172 |
#mustBeOld - fail if the file does not exist |
|
173 |
#old - confirm if the file does not exist |
|
174 |
#any (other) - no validation |
|
175 |
" |
|
176 |
||
3960 | 177 |
^ self requestFileName:titleString |
3956 | 178 |
default:defaultName |
179 |
ok:okText |
|
180 |
abort:abortText |
|
181 |
version:versionSymbol |
|
182 |
ifFail:failBlock |
|
183 |
pattern:pattern |
|
184 |
fromDirectory:aDirectoryPath |
|
185 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
186 |
asLoadDialog:nil |
|
187 |
! |
|
188 |
||
189 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
190 |
"launch a Dialog, which allows user to enter a filename. |
|
191 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
192 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
193 |
The box will show okText in its okButton, abortText in the abortButton. |
|
194 |
The matchPattern is set to pattern initially. |
|
195 |
Return the string, or nil if cancel was pressed |
|
196 |
The version argument allows validation of the files existance; |
|
197 |
it may be any of: |
|
198 |
#mustBeNew - fail (return empty string) if the file exists |
|
199 |
#new - confirm if the file exists |
|
200 |
#mustBeOld - fail if the file does not exist |
|
201 |
#old - confirm if the file does not exist |
|
202 |
#any (other) - no validation |
|
203 |
" |
|
204 |
||
3892 | 205 |
|
3904 | 206 |
| instance enteredFileName enteredFileNameString| |
3892 | 207 |
|
3904 | 208 |
instance := self startApplicationFor:titleString |
209 |
default:defaultName |
|
210 |
ok:okText |
|
211 |
abort:abortText |
|
212 |
ifFail:failBlock |
|
213 |
pattern:pattern |
|
214 |
fromDirectory:aDirectoryPath |
|
3956 | 215 |
whenBoxCreatedEvaluate:boxCreatedCallback |
216 |
asLoadDialog:aBoolean |
|
3958 | 217 |
forDirectory:false |
218 |
multipleSelect:false. |
|
3892 | 219 |
|
220 |
enteredFileNameString := instance result. |
|
3938 | 221 |
(enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[ |
3892 | 222 |
^ failBlock value |
223 |
]. |
|
224 |
enteredFileName := enteredFileNameString asFilename. |
|
225 |
enteredFileNameString := enteredFileName asString. |
|
226 |
(enteredFileName notNil |
|
227 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
228 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
229 |
versionSymbol == #mustBeNew ifTrue:[ |
|
230 |
"/ file may not exist |
|
231 |
enteredFileName exists ifTrue:[^ '']. |
|
232 |
]. |
|
233 |
versionSymbol == #new ifTrue:[ |
|
234 |
"/ file may not exist |
|
235 |
enteredFileName exists ifTrue:[ |
|
236 |
(Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
237 |
ifFalse:[^ '']. |
|
238 |
]. |
|
239 |
]. |
|
240 |
versionSymbol == #mustBeOld ifTrue:[ |
|
241 |
enteredFileName exists ifFalse:[^ '']. |
|
242 |
]. |
|
243 |
versionSymbol == #old ifTrue:[ |
|
244 |
"/ file may not exist |
|
245 |
enteredFileName exists ifFalse:[ |
|
246 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
247 |
ifFalse:[^ '']. |
|
248 |
]. |
|
249 |
]. |
|
250 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
|
251 |
]. |
|
252 |
^ enteredFileNameString |
|
3956 | 253 |
" |
254 |
FileDialog |
|
255 |
requestFileName:'enter a fileName:' |
|
256 |
default:'' |
|
257 |
ok:nil |
|
258 |
abort:nil |
|
259 |
version:nil |
|
260 |
ifFail:['none'] |
|
261 |
pattern:'*.conf' |
|
262 |
fromDirectory:'/etc' |
|
263 |
whenBoxCreatedEvaluate:nil |
|
264 |
asLoadDialog:true |
|
265 |
" |
|
3892 | 266 |
! |
267 |
||
268 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
269 |
||
270 |
^ self requestFileName:titleString |
|
271 |
default:defaultName |
|
272 |
ok:nil |
|
273 |
abort:nil |
|
274 |
version:versionSymbol |
|
275 |
ifFail:failBlock |
|
276 |
pattern:pattern |
|
277 |
fromDirectory:aDirectoryPathOrNil |
|
278 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
279 |
||
280 |
" |
|
281 |
FileDialog |
|
282 |
requestFileName:'enter a fileName:' |
|
283 |
default:'' |
|
284 |
version:nil |
|
285 |
ifFail:['none'] |
|
286 |
pattern:'*.conf' |
|
287 |
fromDirectory:'/etc' |
|
288 |
whenBoxCreatedEvaluate:nil. |
|
289 |
Dialog |
|
290 |
requestFileName:'enter a fileName:' |
|
291 |
default:'' |
|
292 |
version:nil |
|
293 |
ifFail:['none'] |
|
294 |
pattern:'*.conf' |
|
295 |
fromDirectory:'/etc' |
|
296 |
whenBoxCreatedEvaluate:nil |
|
297 |
" |
|
298 |
" |
|
299 |
FileDialog |
|
300 |
requestFileName:'enter a fileName:' |
|
301 |
default:'' |
|
302 |
version:#old |
|
303 |
ifFail:['none'] |
|
304 |
pattern:'*.conf' |
|
305 |
fromDirectory:'/etc' |
|
306 |
whenBoxCreatedEvaluate:nil |
|
307 |
" |
|
308 |
" |
|
309 |
FileDialog |
|
310 |
requestFileName:'enter a fileName:' |
|
311 |
default:'' |
|
312 |
version:#mustBeNew |
|
313 |
ifFail:['none'] |
|
314 |
pattern:'*.conf' |
|
315 |
fromDirectory:'/etc' |
|
316 |
whenBoxCreatedEvaluate:nil |
|
317 |
" |
|
3904 | 318 |
! |
319 |
||
320 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
321 |
"launch a Dialog, which allows user to enter a filename. |
|
322 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
323 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
324 |
The box will show okText in its okButton, abortText in the abortButton. |
|
325 |
The matchPattern is set to pattern initially. |
|
3905 | 326 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 327 |
" |
328 |
||
329 |
||
3956 | 330 |
^ self requestFileNames:titleString |
331 |
default:defaultName |
|
332 |
ok:okText |
|
333 |
abort:abortText |
|
334 |
ifFail:failBlock |
|
335 |
pattern:pattern |
|
336 |
fromDirectory:aDirectoryPath |
|
337 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
338 |
asLoadDialog:nil. |
|
339 |
||
340 |
||
341 |
" |
|
342 |
FileDialog |
|
343 |
requestFileNames:'enter a fileName:' |
|
344 |
default:'' |
|
345 |
ok:nil |
|
346 |
abort:nil |
|
347 |
ifFail:['none'] |
|
348 |
pattern:'*.conf' |
|
349 |
fromDirectory:'/etc' |
|
350 |
whenBoxCreatedEvaluate:nil. |
|
351 |
" |
|
352 |
! |
|
353 |
||
354 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
355 |
"launch a Dialog, which allows user to enter a filename. |
|
356 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
357 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
358 |
The box will show okText in its okButton, abortText in the abortButton. |
|
359 |
The matchPattern is set to pattern initially. |
|
360 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
361 |
" |
|
362 |
||
363 |
||
3904 | 364 |
| instance enteredFileNames lastDirectory| |
365 |
||
366 |
instance := self startApplicationFor:titleString |
|
367 |
default:defaultName |
|
368 |
ok:okText |
|
369 |
abort:abortText |
|
370 |
ifFail:failBlock |
|
371 |
pattern:pattern |
|
372 |
fromDirectory:aDirectoryPath |
|
3956 | 373 |
whenBoxCreatedEvaluate:boxCreatedCallback |
374 |
asLoadDialog:asLoadDialog |
|
3958 | 375 |
forDirectory:false |
376 |
multipleSelect:true. |
|
3904 | 377 |
|
3996 | 378 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 379 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
380 |
^ failBlock value |
|
381 |
]. |
|
382 |
lastDirectory := enteredFileNames first. |
|
383 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
384 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
385 |
^ enteredFileNames |
|
386 |
||
387 |
" |
|
388 |
FileDialog |
|
389 |
requestFileNames:'enter a fileName:' |
|
390 |
default:'' |
|
391 |
ok:nil |
|
392 |
abort:nil |
|
393 |
ifFail:['none'] |
|
394 |
pattern:'*.conf' |
|
395 |
fromDirectory:'/etc' |
|
3956 | 396 |
whenBoxCreatedEvaluate:nil |
397 |
asLoadDialog:true. |
|
3904 | 398 |
" |
399 |
! |
|
400 |
||
3958 | 401 |
startApplicationFor:titleString default:aFileName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog forDirectory:forDirectory multipleSelect:multipleSelect |
3904 | 402 |
"launch a Dialog, which allows user to enter a filename. |
403 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
404 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
405 |
The box will show okText in its okButton, abortText in the abortButton. |
|
406 |
The matchPattern is set to pattern initially. |
|
407 |
Return the string, or nil if cancel was pressed |
|
408 |
The version argument allows validation of the files existance; |
|
409 |
it may be any of: |
|
410 |
#mustBeNew - fail (return empty string) if the file exists |
|
411 |
#new - confirm if the file exists |
|
412 |
#mustBeOld - fail if the file does not exist |
|
413 |
#old - confirm if the file does not exist |
|
414 |
#any (other) - no validation |
|
415 |
" |
|
416 |
||
417 |
||
418 |
| defaultDir defaultNm instance defaultFile| |
|
419 |
||
3956 | 420 |
defaultNm := aFileName. |
3904 | 421 |
defaultDir := aDirectoryPath. |
422 |
defaultDir isNil ifTrue:[ |
|
3956 | 423 |
(forDirectory not and:[defaultNm notNil]) ifTrue:[ |
4030 | 424 |
defaultDir := aFileName asFilename directory asAbsoluteFilename. |
3956 | 425 |
] ifFalse:[ |
426 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
|
427 |
defaultDir isNil ifTrue:[ |
|
428 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
429 |
]. |
|
430 |
] |
|
3904 | 431 |
]. |
432 |
defaultDir := defaultDir asFilename. |
|
433 |
[defaultDir exists not] whileTrue:[ |
|
434 |
defaultDir := defaultDir directory. |
|
435 |
]. |
|
3956 | 436 |
forDirectory not ifTrue:[ |
437 |
(aFileName notNil and:[aFileName asFilename withoutSuffix baseName ~= '*']) ifTrue:[ |
|
438 |
defaultFile := defaultDir construct:aFileName. |
|
439 |
] ifFalse:[ |
|
440 |
defaultFile := defaultDir. |
|
441 |
]. |
|
3904 | 442 |
]. |
3956 | 443 |
|
3904 | 444 |
instance := self new. |
445 |
defaultDir notNil ifTrue:[instance directory:(defaultDir asFilename)]. |
|
3958 | 446 |
instance multipleSelect:multipleSelect ? false. |
3904 | 447 |
instance startFilename:defaultFile. |
448 |
instance pattern:((pattern isNil or:[pattern isEmpty]) ifTrue:['*'] ifFalse:[pattern]). |
|
449 |
instance initialText:titleString. |
|
450 |
instance okLabelHolder value:okText. |
|
451 |
instance cancelLabelHolder value:abortText. |
|
3956 | 452 |
instance asLoadDialog:asLoadDialog ? false. |
453 |
instance viewFiles:(forDirectory isNil ifTrue:[true] ifFalse:[forDirectory not]). |
|
3953 | 454 |
self setDoubleClickActionFor:instance. |
3904 | 455 |
instance allButOpenInterface:#windowSpec. |
456 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
457 |
instance openWindowModal. |
|
458 |
^ instance |
|
3892 | 459 |
! ! |
460 |
||
461 |
!FileDialog class methodsFor:'accessing'! |
|
462 |
||
463 |
lastFileSelectionDirectory |
|
464 |
"return the name of the directory used in the previous |
|
465 |
fileSelection dialog. This will be used as default for the next dialog, |
|
466 |
if no explicit path is specified (see requestFileName:* methods)" |
|
467 |
||
468 |
|f| |
|
469 |
||
470 |
LastFileSelectionDirectory notNil ifTrue:[ |
|
471 |
((f := LastFileSelectionDirectory asFilename) exists |
|
472 |
and:[f isDirectory]) ifFalse:[ |
|
473 |
LastFileSelectionDirectory := nil. |
|
474 |
] |
|
475 |
]. |
|
476 |
^ LastFileSelectionDirectory |
|
477 |
! |
|
478 |
||
479 |
lastFileSelectionDirectory:aDirectoryString |
|
480 |
"set the name of the directory used in the previous |
|
481 |
fileSelection dialog. This will be used as default for the next dialog, |
|
482 |
if no explicit path is specified (see requestFileName:* methods)" |
|
483 |
||
484 |
LastFileSelectionDirectory := aDirectoryString |
|
3953 | 485 |
! |
486 |
||
487 |
setDoubleClickActionFor:instance |
|
488 |
||
489 |
instance doubleClickAction:[:anIndex| |
|
490 |
| item | |
|
491 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
492 |
item notNil ifTrue:[ |
|
493 |
((instance viewFiles and:[item isDirectory not]) or:[instance viewFiles not]) ifTrue:[ |
|
494 |
instance doAccept. |
|
495 |
] |
|
496 |
] |
|
497 |
]. |
|
3892 | 498 |
! ! |
499 |
||
500 |
!FileDialog class methodsFor:'interface specs'! |
|
501 |
||
502 |
windowSpec |
|
503 |
"This resource specification was automatically generated |
|
504 |
by the UIPainter of ST/X." |
|
505 |
||
506 |
"Do not manually edit this!! If it is corrupted, |
|
507 |
the UIPainter may not be able to read the specification." |
|
508 |
||
509 |
" |
|
510 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
511 |
FileDialog new openInterface:#windowSpec |
|
512 |
FileDialog open |
|
513 |
" |
|
514 |
||
515 |
<resource: #canvas> |
|
516 |
||
517 |
^ |
|
518 |
#(#FullSpec |
|
519 |
#name: #windowSpec |
|
520 |
#window: |
|
521 |
#(#WindowSpec |
|
522 |
#label: 'FileDialog' |
|
523 |
#name: 'FileDialog' |
|
524 |
#min: #(#Point 10 10) |
|
525 |
#max: #(#Point 1024 768) |
|
3959 | 526 |
#bounds: #(#Rectangle 25 188 425 588) |
3892 | 527 |
) |
528 |
#component: |
|
529 |
#(#SpecCollection |
|
530 |
#collection: #( |
|
531 |
#(#MenuPanelSpec |
|
532 |
#name: 'ToolBar1' |
|
533 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 30 0) |
|
534 |
#tabable: true |
|
535 |
#menu: #toolBarMenu |
|
536 |
#textDefault: true |
|
537 |
) |
|
538 |
#(#SubCanvasSpec |
|
539 |
#name: 'DirectoryTreeBrowser' |
|
540 |
#layout: #(#LayoutFrame 0 0.0 30 0 0 1.0 -107 1) |
|
541 |
#tabable: true |
|
542 |
#hasHorizontalScrollBar: false |
|
543 |
#hasVerticalScrollBar: false |
|
544 |
#majorKey: #DirectoryTreeBrowser |
|
545 |
#createNewApplication: true |
|
546 |
#createNewBuilder: true |
|
547 |
#postBuildCallback: #postBuildTreeBrowser: |
|
548 |
) |
|
549 |
#(#LabelSpec |
|
550 |
#label: 'Filename:' |
|
551 |
#name: 'FilenameLabel' |
|
552 |
#layout: #(#LayoutFrame 3 0 -97 1 73 0 -77 1) |
|
553 |
#translateLabel: true |
|
3904 | 554 |
#labelChannel: #filenameLabelHolder |
3892 | 555 |
#adjust: #left |
556 |
) |
|
557 |
#(#FilenameInputFieldSpec |
|
558 |
#name: 'FilenameEntryField' |
|
559 |
#layout: #(#LayoutFrame 70 0 -96 1 -10 1 -76 1) |
|
560 |
#tabable: true |
|
561 |
#model: #filenameHolder |
|
3959 | 562 |
#immediateAccept: false |
3892 | 563 |
#acceptOnPointerLeave: false |
564 |
#postBuildCallback: #postBuildFileNameField: |
|
565 |
) |
|
566 |
#(#LabelSpec |
|
567 |
#label: 'Filter:' |
|
568 |
#name: 'FilterLabel' |
|
569 |
#layout: #(#LayoutFrame 3 0 -70 1 67 0 -50 1) |
|
570 |
#translateLabel: true |
|
571 |
#adjust: #left |
|
572 |
) |
|
573 |
#(#InputFieldSpec |
|
574 |
#name: 'FilterEntryField' |
|
575 |
#layout: #(#LayoutFrame 70 0 -69 1 -10 1 -49 1) |
|
576 |
#model: #filterHolder |
|
3958 | 577 |
#immediateAccept: false |
3892 | 578 |
#acceptOnReturn: true |
579 |
#acceptOnTab: true |
|
580 |
#acceptOnLostFocus: true |
|
581 |
#acceptOnPointerLeave: false |
|
582 |
#postBuildCallback: #postBuildFilterField: |
|
583 |
) |
|
584 |
#(#HorizontalPanelViewSpec |
|
585 |
#name: 'ButtonPanel' |
|
586 |
#layout: #(#LayoutFrame 0 0.0 -40 1 0 1 0 1) |
|
587 |
#horizontalLayout: #spreadSpace |
|
588 |
#verticalLayout: #center |
|
589 |
#horizontalSpace: 3 |
|
590 |
#verticalSpace: 3 |
|
591 |
#reverseOrderIfOKAtLeft: true |
|
592 |
#component: |
|
593 |
#(#SpecCollection |
|
594 |
#collection: #( |
|
595 |
#(#ActionButtonSpec |
|
596 |
#label: 'Cancel' |
|
597 |
#name: 'cancelButton' |
|
598 |
#translateLabel: true |
|
599 |
#labelChannel: #cancelLabelHolder |
|
600 |
#tabable: true |
|
601 |
#model: #doCancel |
|
602 |
#extent: #(#Point 150 21) |
|
603 |
) |
|
604 |
#(#ActionButtonSpec |
|
605 |
#label: 'OK' |
|
606 |
#name: 'okButton' |
|
607 |
#translateLabel: true |
|
608 |
#labelChannel: #okLabelHolder |
|
609 |
#tabable: true |
|
610 |
#model: #doAccept |
|
611 |
#isDefault: true |
|
612 |
#extent: #(#Point 150 22) |
|
613 |
) |
|
614 |
) |
|
615 |
||
616 |
) |
|
617 |
) |
|
618 |
) |
|
619 |
||
620 |
) |
|
621 |
) |
|
622 |
! ! |
|
623 |
||
624 |
!FileDialog class methodsFor:'menu specs'! |
|
625 |
||
626 |
toolBarMenu |
|
627 |
"This resource specification was automatically generated |
|
628 |
by the MenuEditor of ST/X." |
|
629 |
||
630 |
"Do not manually edit this!! If it is corrupted, |
|
631 |
the MenuEditor may not be able to read the specification." |
|
632 |
||
633 |
" |
|
634 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
635 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
636 |
" |
|
637 |
||
638 |
<resource: #menu> |
|
639 |
||
640 |
^ |
|
641 |
#(#Menu |
|
642 |
#( |
|
643 |
#(#MenuItem |
|
644 |
#label: 'DirectoryUp' |
|
645 |
#translateLabel: true |
|
646 |
#isButton: true |
|
647 |
#value: #doGoDirectoryUp |
|
648 |
#activeHelpKey: #directoryUp |
|
649 |
#enabled: #enableDirectoryUp |
|
650 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrow20x20Icon) |
|
651 |
) |
|
652 |
#(#MenuItem |
|
653 |
#label: '-' |
|
654 |
) |
|
655 |
#(#MenuItem |
|
656 |
#label: 'Back' |
|
657 |
#translateLabel: true |
|
658 |
#isButton: true |
|
659 |
#value: #doBack |
|
660 |
#activeHelpKey: #directoryBack |
|
661 |
#enabled: #enableBack |
|
3904 | 662 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrow20x20Icon) |
3892 | 663 |
#submenuChannel: #menuDirHistoryBack |
664 |
) |
|
665 |
#(#MenuItem |
|
666 |
#label: '-' |
|
667 |
) |
|
668 |
#(#MenuItem |
|
669 |
#label: 'Forward' |
|
670 |
#translateLabel: true |
|
671 |
#isButton: true |
|
672 |
#value: #doForward |
|
673 |
#activeHelpKey: #directoryForward |
|
3904 | 674 |
#enabled: #enableForward |
675 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrow20x20Icon) |
|
3892 | 676 |
#submenuChannel: #menuDirHistoryForward |
677 |
) |
|
678 |
#(#MenuItem |
|
679 |
#label: '-' |
|
680 |
) |
|
681 |
#(#MenuItem |
|
682 |
#label: 'Home' |
|
683 |
#translateLabel: true |
|
684 |
#isButton: true |
|
685 |
#value: #doGotoHomeDirectory |
|
686 |
#activeHelpKey: #fileHome |
|
687 |
#enabled: #enableHome |
|
688 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon) |
|
689 |
) |
|
3923 | 690 |
#(#MenuItem |
691 |
#label: '-' |
|
692 |
) |
|
693 |
#(#MenuItem |
|
694 |
#label: 'New Directory' |
|
695 |
#isButton: true |
|
3956 | 696 |
#isVisible: #newDirectoryVisibilityHolder |
3923 | 697 |
#value: #newDirectory |
698 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #newDirectory20x20Icon) |
|
699 |
) |
|
3892 | 700 |
) |
701 |
nil |
|
702 |
nil |
|
703 |
) |
|
704 |
! ! |
|
705 |
||
706 |
!FileDialog methodsFor:'accessing'! |
|
707 |
||
3956 | 708 |
asLoadDialog |
709 |
||
710 |
^ asLoadDialog |
|
711 |
! |
|
712 |
||
713 |
asLoadDialog:aBoolean |
|
714 |
||
715 |
asLoadDialog := aBoolean |
|
716 |
! |
|
717 |
||
3996 | 718 |
currentSelectedFiles |
719 |
||
720 |
| selectedFiles| |
|
721 |
||
722 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
723 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
724 |
! |
|
725 |
||
3892 | 726 |
directory |
727 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
728 |
||
729 |
^ directory |
|
730 |
! |
|
731 |
||
732 |
directory:something |
|
733 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
734 |
||
735 |
directory := something. |
|
736 |
! |
|
737 |
||
3953 | 738 |
doubleClickAction |
739 |
"return the value of the instance variable 'doubleClickAction' (automatically generated)" |
|
740 |
||
741 |
^ doubleClickAction |
|
742 |
! |
|
743 |
||
744 |
doubleClickAction:something |
|
745 |
"set the value of the instance variable 'doubleClickAction' (automatically generated)" |
|
746 |
||
747 |
doubleClickAction := something. |
|
748 |
! |
|
749 |
||
3892 | 750 |
initialText |
751 |
"return the value of the instance variable 'initialText' (automatically generated)" |
|
752 |
||
753 |
^ initialText |
|
754 |
! |
|
755 |
||
756 |
initialText:something |
|
757 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
758 |
||
759 |
initialText := something. |
|
760 |
! |
|
761 |
||
3958 | 762 |
multipleSelect |
763 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
764 |
||
765 |
multipleSelect isNil ifTrue:[ |
|
766 |
multipleSelect := true. |
|
767 |
]. |
|
768 |
^ multipleSelect |
|
769 |
! |
|
770 |
||
771 |
multipleSelect:aBoolean |
|
772 |
"set the value of the instance variable 'multipleSelect' (automatically generated)" |
|
773 |
||
774 |
multipleSelect := aBoolean |
|
775 |
! |
|
776 |
||
3956 | 777 |
newDirectoryVisibilityHolder |
778 |
"return the value of the instance variable 'newDirectoryVisibilityHolder' (automatically generated)" |
|
779 |
||
780 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
|
781 |
newDirectoryVisibilityHolder := true asValue. |
|
782 |
]. |
|
783 |
^ newDirectoryVisibilityHolder |
|
784 |
! |
|
785 |
||
3892 | 786 |
pattern |
787 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
788 |
||
789 |
^ pattern |
|
790 |
! |
|
791 |
||
792 |
pattern:something |
|
793 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
794 |
||
795 |
pattern := something. |
|
796 |
! |
|
797 |
||
798 |
result |
|
799 |
"return the value of the instance variable 'result' (automatically generated)" |
|
800 |
||
801 |
^ result |
|
802 |
! |
|
803 |
||
804 |
result:something |
|
805 |
"set the value of the instance variable 'result' (automatically generated)" |
|
806 |
||
807 |
result := something. |
|
808 |
! |
|
809 |
||
3904 | 810 |
selectedDirectories |
811 |
||
812 |
| selectedFiles| |
|
813 |
||
814 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
815 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
816 |
! |
|
817 |
||
3892 | 818 |
startFilename |
819 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
820 |
||
821 |
startFilename isNil ifTrue:[ |
|
822 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
823 |
]. |
|
824 |
^ startFilename |
|
825 |
! |
|
826 |
||
827 |
startFilename:something |
|
828 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
829 |
||
830 |
startFilename := something. |
|
831 |
! |
|
832 |
||
3904 | 833 |
treeBrowser |
834 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
835 |
||
836 |
^ treeBrowser |
|
837 |
! |
|
838 |
||
3892 | 839 |
viewFiles |
840 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
841 |
||
842 |
^ viewFiles |
|
843 |
! |
|
844 |
||
845 |
viewFiles:something |
|
846 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
847 |
||
848 |
viewFiles := something. |
|
849 |
! ! |
|
850 |
||
851 |
!FileDialog methodsFor:'aspects'! |
|
852 |
||
853 |
cancelLabelHolder |
|
854 |
"automatically generated by UIPainter ..." |
|
855 |
||
856 |
"*** the code below creates a default model when invoked." |
|
857 |
"*** (which may not be the one you wanted)" |
|
858 |
"*** Please change as required and accept it in the browser." |
|
859 |
"*** (and replace this comment by something more useful ;-)" |
|
860 |
||
861 |
cancelLabelHolder isNil ifTrue:[ |
|
862 |
cancelLabelHolder := 'Cancel' asValue. |
|
863 |
]. |
|
864 |
^ cancelLabelHolder. |
|
865 |
! |
|
866 |
||
867 |
enableBack |
|
868 |
"Return a value holder for the input string. |
|
869 |
" |
|
870 |
enableBack isNil ifTrue:[ |
|
871 |
enableBack := treeBrowser enableBack. |
|
872 |
]. |
|
873 |
^ enableBack |
|
874 |
! |
|
875 |
||
876 |
enableDirectoryUp |
|
877 |
||
878 |
enableDirectoryUp isNil ifTrue:[ |
|
879 |
enableDirectoryUp := treeBrowser enableDirectoryUp. |
|
880 |
]. |
|
881 |
^ enableDirectoryUp |
|
882 |
! |
|
883 |
||
884 |
enableForward |
|
885 |
"Return a value holder for the input string. |
|
886 |
" |
|
887 |
enableForward isNil ifTrue:[ |
|
888 |
enableForward := treeBrowser enableForward. |
|
889 |
]. |
|
890 |
^ enableForward |
|
891 |
! |
|
892 |
||
893 |
enableHome |
|
894 |
"Return a value holder for the input string. |
|
895 |
" |
|
896 |
enableHome isNil ifTrue:[ |
|
897 |
enableHome := treeBrowser enableHome. |
|
898 |
]. |
|
899 |
^ enableHome |
|
900 |
! |
|
901 |
||
902 |
filenameHolder |
|
903 |
"Return a value holder with the filename. |
|
904 |
Shown in the filename input-field. |
|
905 |
Being the selection in the tree. |
|
906 |
" |
|
907 |
|holder| |
|
908 |
holder := builder bindingAt:#filenameHolder. |
|
909 |
||
910 |
holder ifNil:[ |
|
911 |
holder := ValueHolder new. |
|
912 |
holder addDependent:self. |
|
913 |
builder aspectAt:#filenameHolder |
|
914 |
put:holder. |
|
915 |
]. |
|
916 |
||
917 |
^ holder. |
|
918 |
! |
|
919 |
||
3904 | 920 |
filenameLabelHolder |
921 |
"Return a value holder for the input string. |
|
922 |
" |
|
923 |
filenameLabelHolder isNil ifTrue:[ |
|
924 |
filenameLabelHolder := 'Filename:' asValue. |
|
925 |
]. |
|
926 |
^ filenameLabelHolder |
|
927 |
! |
|
928 |
||
3892 | 929 |
filterHolder |
4011 | 930 |
"Return a value holder for filter |
3892 | 931 |
" |
932 |
||
933 |
filterHolder isNil ifTrue:[ |
|
934 |
filterHolder := treeBrowser filterModel. |
|
935 |
self pattern notNil ifTrue:[ |
|
936 |
filterHolder value:pattern. |
|
937 |
] |
|
938 |
]. |
|
939 |
^ filterHolder |
|
940 |
! |
|
941 |
||
942 |
okLabelHolder |
|
943 |
"automatically generated by UIPainter ..." |
|
944 |
||
945 |
"*** the code below creates a default model when invoked." |
|
946 |
"*** (which may not be the one you wanted)" |
|
947 |
"*** Please change as required and accept it in the browser." |
|
948 |
"*** (and replace this comment by something more useful ;-)" |
|
949 |
||
950 |
okLabelHolder isNil ifTrue:[ |
|
951 |
okLabelHolder := 'OK' asValue. |
|
952 |
]. |
|
953 |
^ okLabelHolder. |
|
954 |
! ! |
|
955 |
||
956 |
!FileDialog methodsFor:'change & update'! |
|
957 |
||
958 |
update:something with:aParameter from:changedObject |
|
959 |
"Invoked when an object that I depend upon sends a change notification." |
|
960 |
||
961 |
"stub code automatically generated - please change as required" |
|
962 |
||
963 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
964 |
| files newDir| |
|
965 |
files := treeBrowser currentFileNameHolder value. |
|
966 |
||
967 |
(files isEmpty) ifTrue:[ |
|
968 |
self filenameHolder value:nil withoutNotifying:self. |
|
969 |
] ifFalse:[ |
|
970 |
files size == 1 ifTrue:[ |
|
971 |
self filenameHolder value:(files first) withoutNotifying:self. |
|
972 |
] ifFalse:[ |
|
973 |
self filenameHolder value:'' withoutNotifying:self. |
|
974 |
]. |
|
975 |
]. |
|
976 |
]. |
|
3904 | 977 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
978 |
changedObject value ifTrue:[ |
|
979 |
self filenameLabelHolder value:'Filename:'. |
|
980 |
] ifFalse:[ |
|
981 |
self filenameLabelHolder value:'Directory:'. |
|
982 |
] |
|
983 |
]. |
|
3892 | 984 |
changedObject == self filenameHolder ifTrue:[ |
985 |
(changedObject value asFilename exists not) ifTrue:[^ self]. |
|
986 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:(changedObject value asFilename)) withoutNotifying:self. |
|
987 |
]. |
|
988 |
changedObject == treeBrowser enableBack ifTrue:[ |
|
989 |
self enableBack value:changedObject value. |
|
990 |
^ self. |
|
991 |
]. |
|
992 |
changedObject == treeBrowser enableForward ifTrue:[ |
|
993 |
self enableForward value:changedObject value. |
|
994 |
^ self. |
|
995 |
]. |
|
996 |
changedObject == treeBrowser enableHome ifTrue:[ |
|
997 |
self enableHome value:changedObject value. |
|
998 |
^ self. |
|
999 |
]. |
|
1000 |
changedObject == treeBrowser enableDirectoryUp ifTrue:[ |
|
1001 |
self enableDirectoryUp value:changedObject value. |
|
1002 |
^ self. |
|
1003 |
]. |
|
1004 |
^ super update:something with:aParameter from:changedObject |
|
1005 |
! ! |
|
1006 |
||
1007 |
!FileDialog methodsFor:'event handling'! |
|
1008 |
||
1009 |
processEvent:anEvent |
|
1010 |
"filter keyboard events. |
|
1011 |
Return true, if I have eaten the event" |
|
1012 |
||
1013 |
|focusView key rawKey| |
|
1014 |
||
1015 |
anEvent isKeyPressEvent ifTrue:[ |
|
1016 |
focusView := anEvent targetView. |
|
1017 |
key := anEvent key. |
|
1018 |
rawKey := anEvent rawKey. |
|
1019 |
||
1020 |
(focusView == filterField) ifTrue:[ |
|
1021 |
^ false. |
|
1022 |
]. |
|
1023 |
(focusView == filenameField) ifTrue:[ |
|
1024 |
^ false. |
|
1025 |
]. |
|
1026 |
]. |
|
1027 |
^ false |
|
1028 |
! ! |
|
1029 |
||
1030 |
!FileDialog methodsFor:'initialization & release'! |
|
1031 |
||
1032 |
postBuildFileNameField:aWidget |
|
1033 |
||
1034 |
filenameField := aWidget. |
|
1035 |
! |
|
1036 |
||
1037 |
postBuildFilterField:aWidget |
|
1038 |
||
1039 |
filterField := aWidget. |
|
1040 |
! |
|
1041 |
||
1042 |
postBuildTreeBrowser:aSubCanvasView |
|
1043 |
||
1044 |
treeBrowser := aSubCanvasView client. |
|
1045 |
! |
|
1046 |
||
4005
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1047 |
postBuildWith:aBuilder |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1048 |
|
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1049 |
treeBrowser multipleSelect:self multipleSelect. |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1050 |
^ super postBuildWith:aBuilder |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1051 |
! |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1052 |
|
3994 | 1053 |
postOpenWith:aBuilder |
3892 | 1054 |
|
1055 |
"/ self windowGroup addPreEventHook:self. |
|
1056 |
treeBrowser currentFileNameHolder addDependent:self. |
|
3953 | 1057 |
treeBrowser doubleClickAction:(self doubleClickAction). |
3892 | 1058 |
treeBrowser enableBack addDependent:self. |
1059 |
treeBrowser enableForward addDependent:self. |
|
1060 |
treeBrowser enableHome addDependent:self. |
|
1061 |
treeBrowser enableDirectoryUp addDependent:self. |
|
3904 | 1062 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
3982 | 1063 |
treeBrowser rootHolder value:((self directory) ? (Filename currentDirectory asAbsoluteFilename)). |
3904 | 1064 |
treeBrowser viewFilesInDirectoryTree value:(self viewFiles ? true). |
1065 |
treeBrowser viewFilesInDirectoryTree changed. |
|
3892 | 1066 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:(self startFilename)). |
3956 | 1067 |
self asLoadDialog ifTrue:[ |
1068 |
treeBrowser newVisibilityHolder value:false. |
|
1069 |
treeBrowser allowFileOperations value:false. |
|
1070 |
self newDirectoryVisibilityHolder value:false. |
|
1071 |
]. |
|
3892 | 1072 |
self filenameHolder value:(self startFilename asString). |
1073 |
self window label:(self initialText) ? 'File Dialog'. |
|
1074 |
^ super postOpenWith:aBuilder |
|
1075 |
! ! |
|
1076 |
||
1077 |
!FileDialog methodsFor:'user actions'! |
|
1078 |
||
1079 |
doAccept |
|
1080 |
"force accept - ignore in filterField" |
|
1081 |
||
1082 |
|ev| |
|
1083 |
||
1084 |
ev := self windowGroup lastEvent. |
|
1085 |
(ev notNil |
|
1086 |
and:[ev isKeyEvent |
|
1087 |
and:[ev key == #Return |
|
1088 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1089 |
or:[ev targetView isSameOrComponentOf:filenameField]]]]) ifTrue:[ |
|
1090 |
^ self |
|
1091 |
]. |
|
3959 | 1092 |
filenameField accept. |
3944 | 1093 |
self result:(self filenameHolder value asString). |
3892 | 1094 |
|
1095 |
^ super doAccept |
|
1096 |
! |
|
1097 |
||
1098 |
doBack |
|
1099 |
||
1100 |
treeBrowser doBack. |
|
1101 |
! |
|
1102 |
||
1103 |
doCancel |
|
1104 |
||
1105 |
self result:nil. |
|
1106 |
^ super doCancel. |
|
1107 |
! |
|
1108 |
||
1109 |
doForward |
|
1110 |
||
1111 |
treeBrowser doForward. |
|
1112 |
! |
|
1113 |
||
1114 |
doGoDirectoryUp |
|
1115 |
||
1116 |
treeBrowser doGoDirectoryUp. |
|
1117 |
! |
|
1118 |
||
1119 |
doGotoHomeDirectory |
|
1120 |
||
1121 |
treeBrowser doGotoHomeDirectory. |
|
1122 |
! |
|
1123 |
||
1124 |
menuDirHistory:backOrForward |
|
1125 |
||
1126 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1127 |
! |
|
1128 |
||
1129 |
menuDirHistoryBack |
|
1130 |
||
1131 |
^ treeBrowser menuDirHistory:#back. |
|
1132 |
! |
|
1133 |
||
1134 |
menuDirHistoryForward |
|
1135 |
||
1136 |
^ treeBrowser menuDirHistory:#forward. |
|
3923 | 1137 |
! |
1138 |
||
1139 |
newDirectory |
|
1140 |
||
1141 |
^ treeBrowser newDirectory |
|
3892 | 1142 |
! ! |
1143 |
||
1144 |
!FileDialog class methodsFor:'documentation'! |
|
1145 |
||
1146 |
version |
|
4030 | 1147 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.18 2002-10-23 09:58:01 penk Exp $' |
3892 | 1148 |
! ! |