author | penk |
Tue, 16 Mar 2004 16:59:49 +0100 | |
changeset 5740 | fd67f31da836 |
parent 5617 | 2b10cdfc8b38 |
child 5790 | a20cb6fcb74b |
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 |
" |
|
12 |
||
3892 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
15 |
SimpleDialog subclass:#FileDialog |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
16 |
instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
17 |
multipleSelect doubleClickAction cancelLabelHolder okLabelHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
18 |
startFilename result filterField filenameField viewFiles |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
19 |
filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
20 |
appendButtonVisibleHolder appendWasPressed |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
21 |
buttonPanelVisibleHolder appendLabelHolder' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
22 |
classVariableNames:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
23 |
poolDictionaries:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
24 |
category:'Interface-Tools-File' |
3892 | 25 |
! |
26 |
||
27 |
!FileDialog class methodsFor:'documentation'! |
|
28 |
||
5140 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
3892 | 43 |
documentation |
44 |
" |
|
45 |
documentation to be added. |
|
46 |
||
47 |
[author:] |
|
48 |
Martin Walser (martin@vercingetorix) |
|
49 |
||
50 |
[instance variables:] |
|
51 |
||
52 |
[class variables:] |
|
53 |
||
54 |
[see also:] |
|
55 |
||
56 |
" |
|
57 |
! |
|
58 |
||
59 |
examples |
|
60 |
" |
|
61 |
[exBegin] |
|
62 |
FileDialog open |
|
63 |
[exEnd] |
|
64 |
||
65 |
[exBegin] |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
66 |
FileDialog |
4804 | 67 |
requestFileName:'enter a fileName:' |
68 |
default:'' |
|
69 |
version:nil |
|
70 |
ifFail:['none'] |
|
71 |
pattern:'*.conf' |
|
72 |
fromDirectory:'/etc' |
|
73 |
whenBoxCreatedEvaluate:nil. |
|
74 |
[exEnd] |
|
75 |
[exBegin] |
|
76 |
|fd| |
|
77 |
||
78 |
fd := FileDialog new. |
|
79 |
fd multipleSelect:true. |
|
80 |
fd open |
|
3892 | 81 |
[exEnd] |
82 |
" |
|
5062 | 83 |
! |
84 |
||
85 |
todo |
|
86 |
" |
|
87 |
- make the filedialog windows like f |
|
88 |
filename entry field shows only the filename not the whole directory |
|
89 |
the tree allways starts in currrent directory |
|
90 |
the parent tree is shown in a compobox where the perents are selectable |
|
91 |
- do not expand the ~ or relative pathnames to absolute pathnames |
|
92 |
" |
|
3892 | 93 |
! ! |
94 |
||
95 |
!FileDialog class methodsFor:'instance creation'! |
|
96 |
||
97 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
98 |
"same as requestFileName, but only show directories" |
|
99 |
||
4795 | 100 |
^ self |
101 |
requestDirectoryName:title |
|
102 |
default:aFileName |
|
103 |
ok:nil |
|
104 |
abort:nil |
|
105 |
version:nil |
|
106 |
pattern:nil |
|
107 |
fromDirectory:nil |
|
108 |
ifFail:failBlock |
|
109 |
whenBoxCreatedEvaluate:nil |
|
110 |
asLoadDialog:nil. |
|
3892 | 111 |
|
112 |
" |
|
3904 | 113 |
FileDialog |
3892 | 114 |
requestDirectoryName:'which directory ?' |
4627 | 115 |
default:Filename currentDirectory pathName |
3892 | 116 |
ifFail:'none' |
117 |
" |
|
118 |
! |
|
119 |
||
5336 | 120 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
121 |
"same as requestFileName, but only show directories" |
|
122 |
||
123 |
^ self |
|
124 |
requestDirectoryName:title |
|
125 |
default:aFileName |
|
126 |
ok:okText |
|
127 |
abort:abortText |
|
128 |
version:nil |
|
129 |
pattern:nil |
|
130 |
fromDirectory:nil |
|
131 |
ifFail:failBlock |
|
132 |
whenBoxCreatedEvaluate:nil |
|
133 |
asLoadDialog:nil. |
|
134 |
||
135 |
" |
|
136 |
FileDialog |
|
137 |
requestDirectoryName:'which directory ?' |
|
138 |
default:Filename currentDirectory pathName |
|
139 |
ok:'Yes' |
|
140 |
abort:'No' |
|
141 |
ifFail:'none' |
|
142 |
" |
|
143 |
! |
|
144 |
||
3956 | 145 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 146 |
"same as requestFileName, but only show directories" |
147 |
||
3956 | 148 |
|enteredFileName instance enteredFileNameString| |
3892 | 149 |
|
4795 | 150 |
instance := self |
151 |
startApplicationFor:titleString |
|
152 |
default:aFileName |
|
153 |
ok:okText |
|
154 |
abort:abortText |
|
155 |
ifFail:failBlock |
|
156 |
pattern:pattern |
|
157 |
fromDirectory:aDirectoryPath |
|
158 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
159 |
asLoadDialog:aBoolean |
|
5329 | 160 |
viewFiles:false |
4795 | 161 |
multipleSelect:false. |
3892 | 162 |
|
163 |
enteredFileNameString := instance result. |
|
164 |
enteredFileNameString isNil ifTrue:[ |
|
165 |
^ failBlock value |
|
166 |
]. |
|
167 |
enteredFileName := enteredFileNameString asFilename. |
|
168 |
enteredFileNameString := enteredFileName asString. |
|
169 |
(enteredFileName notNil |
|
170 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
171 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
172 |
versionSymbol == #mustBeNew ifTrue:[ |
|
173 |
"/ file may not exist |
|
174 |
enteredFileName exists ifTrue:[^ '']. |
|
175 |
]. |
|
176 |
versionSymbol == #new ifTrue:[ |
|
177 |
"/ file may not exist |
|
178 |
enteredFileName exists ifTrue:[ |
|
179 |
(Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
180 |
ifFalse:[^ '']. |
|
181 |
]. |
|
182 |
]. |
|
183 |
versionSymbol == #mustBeOld ifTrue:[ |
|
184 |
enteredFileName exists ifFalse:[^ '']. |
|
185 |
]. |
|
186 |
versionSymbol == #old ifTrue:[ |
|
187 |
"/ file may not exist |
|
188 |
enteredFileName exists ifFalse:[ |
|
189 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
190 |
ifFalse:[^ '']. |
|
191 |
]. |
|
192 |
]. |
|
193 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
194 |
]. |
|
195 |
^ enteredFileNameString |
|
196 |
||
197 |
" |
|
198 |
FileDialog |
|
199 |
requestDirectoryName:'which directory ?' |
|
4627 | 200 |
default:Filename currentDirectory pathName |
3892 | 201 |
ifFail:nil |
202 |
" |
|
3956 | 203 |
" |
204 |
FileDialog |
|
205 |
requestDirectoryName:'which directory ?' |
|
4627 | 206 |
default:Filename currentDirectory pathName |
3956 | 207 |
ok:nil |
208 |
abort:nil |
|
209 |
version:nil |
|
210 |
pattern:nil |
|
211 |
fromDirectory:nil |
|
212 |
ifFail:nil |
|
213 |
whenBoxCreatedEvaluate:nil |
|
214 |
asLoadDialog:true |
|
215 |
" |
|
3892 | 216 |
! |
217 |
||
5336 | 218 |
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
219 |
"same as requestFileName, but only show directories" |
|
220 |
||
221 |
^ self |
|
222 |
requestDirectoryName:title |
|
223 |
default:aFileName |
|
224 |
ok:okText |
|
225 |
abort:nil |
|
226 |
version:nil |
|
227 |
pattern:nil |
|
228 |
fromDirectory:nil |
|
229 |
ifFail:failBlock |
|
230 |
whenBoxCreatedEvaluate:nil |
|
231 |
asLoadDialog:nil. |
|
232 |
||
233 |
" |
|
234 |
FileDialog |
|
235 |
requestDirectoryName:'which directory ?' |
|
236 |
default:Filename currentDirectory pathName |
|
237 |
ok:'Yes' |
|
238 |
ifFail:'none' |
|
239 |
" |
|
240 |
! |
|
241 |
||
3892 | 242 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
243 |
||
4795 | 244 |
^ self |
245 |
requestFileName:titleString |
|
246 |
default:defaultName |
|
247 |
ok:okText |
|
248 |
abort:abortText |
|
249 |
version:nil |
|
250 |
ifFail:nil |
|
251 |
pattern:pattern |
|
252 |
fromDirectory:aDirectoryPathOrNil |
|
253 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 254 |
! |
255 |
||
256 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
257 |
"launch a Dialog, which allows user to enter a filename. |
|
258 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
259 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
260 |
The box will show okText in its okButton, abortText in the abortButton. |
|
261 |
The matchPattern is set to pattern initially. |
|
262 |
Return the string, or nil if cancel was pressed |
|
263 |
The version argument allows validation of the files existance; |
|
264 |
it may be any of: |
|
265 |
#mustBeNew - fail (return empty string) if the file exists |
|
266 |
#new - confirm if the file exists |
|
267 |
#mustBeOld - fail if the file does not exist |
|
268 |
#old - confirm if the file does not exist |
|
269 |
#any (other) - no validation |
|
270 |
" |
|
271 |
||
4795 | 272 |
^ self |
273 |
requestFileName:titleString |
|
274 |
default:defaultName |
|
275 |
ok:okText |
|
276 |
abort:abortText |
|
277 |
version:versionSymbol |
|
278 |
ifFail:failBlock |
|
279 |
pattern:pattern |
|
280 |
fromDirectory:aDirectoryPath |
|
281 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
282 |
asLoadDialog:nil |
|
3956 | 283 |
! |
284 |
||
285 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
286 |
"launch a Dialog, which allows user to enter a filename. |
|
287 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
288 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
289 |
The box will show okText in its okButton, abortText in the abortButton. |
|
290 |
The matchPattern is set to pattern initially. |
|
291 |
Return the string, or nil if cancel was pressed |
|
292 |
The version argument allows validation of the files existance; |
|
293 |
it may be any of: |
|
294 |
#mustBeNew - fail (return empty string) if the file exists |
|
295 |
#new - confirm if the file exists |
|
296 |
#mustBeOld - fail if the file does not exist |
|
297 |
#old - confirm if the file does not exist |
|
298 |
#any (other) - no validation |
|
299 |
" |
|
300 |
||
3892 | 301 |
|
3904 | 302 |
| instance enteredFileName enteredFileNameString| |
3892 | 303 |
|
4795 | 304 |
instance := self |
305 |
startApplicationFor:titleString |
|
306 |
default:defaultName |
|
307 |
ok:okText |
|
308 |
abort:abortText |
|
309 |
ifFail:failBlock |
|
310 |
pattern:pattern |
|
311 |
fromDirectory:aDirectoryPath |
|
312 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
313 |
asLoadDialog:aBoolean |
|
5329 | 314 |
viewFiles:true |
4795 | 315 |
multipleSelect:false. |
3892 | 316 |
|
317 |
enteredFileNameString := instance result. |
|
3938 | 318 |
(enteredFileNameString isNil or:[enteredFileNameString isEmpty]) ifTrue:[ |
3892 | 319 |
^ failBlock value |
320 |
]. |
|
321 |
enteredFileName := enteredFileNameString asFilename. |
|
322 |
enteredFileNameString := enteredFileName asString. |
|
4666 | 323 |
|
3892 | 324 |
(enteredFileName notNil |
325 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
4666 | 326 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
3892 | 327 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
328 |
versionSymbol == #mustBeNew ifTrue:[ |
|
329 |
"/ file may not exist |
|
330 |
enteredFileName exists ifTrue:[^ '']. |
|
331 |
]. |
|
332 |
versionSymbol == #new ifTrue:[ |
|
333 |
"/ file may not exist |
|
334 |
enteredFileName exists ifTrue:[ |
|
335 |
(Dialog confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
336 |
ifFalse:[^ '']. |
|
337 |
]. |
|
338 |
]. |
|
339 |
versionSymbol == #mustBeOld ifTrue:[ |
|
340 |
enteredFileName exists ifFalse:[^ '']. |
|
341 |
]. |
|
342 |
versionSymbol == #old ifTrue:[ |
|
343 |
"/ file may not exist |
|
344 |
enteredFileName exists ifFalse:[ |
|
345 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString) withCRs) |
|
346 |
ifFalse:[^ '']. |
|
347 |
]. |
|
348 |
]. |
|
349 |
]. |
|
350 |
^ enteredFileNameString |
|
3956 | 351 |
" |
352 |
FileDialog |
|
353 |
requestFileName:'enter a fileName:' |
|
354 |
default:'' |
|
355 |
ok:nil |
|
356 |
abort:nil |
|
357 |
version:nil |
|
358 |
ifFail:['none'] |
|
359 |
pattern:'*.conf' |
|
4627 | 360 |
fromDirectory:Filename currentDirectory pathName |
3956 | 361 |
whenBoxCreatedEvaluate:nil |
362 |
asLoadDialog:true |
|
363 |
" |
|
3892 | 364 |
! |
365 |
||
366 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
367 |
||
4795 | 368 |
^ self |
369 |
requestFileName:titleString |
|
370 |
default:defaultName |
|
371 |
ok:nil |
|
372 |
abort:nil |
|
373 |
version:versionSymbol |
|
374 |
ifFail:failBlock |
|
375 |
pattern:pattern |
|
376 |
fromDirectory:aDirectoryPathOrNil |
|
377 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 378 |
|
379 |
" |
|
380 |
FileDialog |
|
381 |
requestFileName:'enter a fileName:' |
|
382 |
default:'' |
|
383 |
version:nil |
|
384 |
ifFail:['none'] |
|
385 |
pattern:'*.conf' |
|
4627 | 386 |
fromDirectory:Filename currentDirectory pathName |
3892 | 387 |
whenBoxCreatedEvaluate:nil. |
388 |
Dialog |
|
389 |
requestFileName:'enter a fileName:' |
|
390 |
default:'' |
|
391 |
version:nil |
|
392 |
ifFail:['none'] |
|
393 |
pattern:'*.conf' |
|
4627 | 394 |
fromDirectory:Filename currentDirectory pathName |
3892 | 395 |
whenBoxCreatedEvaluate:nil |
396 |
" |
|
397 |
" |
|
398 |
FileDialog |
|
399 |
requestFileName:'enter a fileName:' |
|
400 |
default:'' |
|
401 |
version:#old |
|
402 |
ifFail:['none'] |
|
403 |
pattern:'*.conf' |
|
4627 | 404 |
fromDirectory:Filename currentDirectory pathName |
3892 | 405 |
whenBoxCreatedEvaluate:nil |
406 |
" |
|
407 |
" |
|
408 |
FileDialog |
|
409 |
requestFileName:'enter a fileName:' |
|
410 |
default:'' |
|
411 |
version:#mustBeNew |
|
412 |
ifFail:['none'] |
|
413 |
pattern:'*.conf' |
|
4627 | 414 |
fromDirectory:Filename currentDirectory pathName |
3892 | 415 |
whenBoxCreatedEvaluate:nil |
416 |
" |
|
3904 | 417 |
! |
418 |
||
419 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
420 |
"launch a Dialog, which allows user to enter a filename. |
|
421 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
422 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
423 |
The box will show okText in its okButton, abortText in the abortButton. |
|
424 |
The matchPattern is set to pattern initially. |
|
3905 | 425 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 426 |
" |
427 |
||
428 |
||
4795 | 429 |
^ self |
430 |
requestFileNames:titleString |
|
431 |
default:defaultName |
|
432 |
ok:okText |
|
433 |
abort:abortText |
|
434 |
ifFail:failBlock |
|
435 |
pattern:pattern |
|
436 |
fromDirectory:aDirectoryPath |
|
437 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
438 |
asLoadDialog:nil. |
|
3956 | 439 |
|
440 |
||
441 |
" |
|
442 |
FileDialog |
|
443 |
requestFileNames:'enter a fileName:' |
|
444 |
default:'' |
|
445 |
ok:nil |
|
446 |
abort:nil |
|
447 |
ifFail:['none'] |
|
448 |
pattern:'*.conf' |
|
4627 | 449 |
fromDirectory:Filename currentDirectory pathName |
3956 | 450 |
whenBoxCreatedEvaluate:nil. |
451 |
" |
|
452 |
! |
|
453 |
||
454 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
455 |
"launch a Dialog, which allows user to enter a filename. |
|
456 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
457 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
458 |
The box will show okText in its okButton, abortText in the abortButton. |
|
459 |
The matchPattern is set to pattern initially. |
|
460 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
461 |
" |
|
462 |
||
463 |
||
3904 | 464 |
| instance enteredFileNames lastDirectory| |
465 |
||
4795 | 466 |
instance := self |
467 |
startApplicationFor:titleString |
|
468 |
default:defaultName |
|
469 |
ok:okText |
|
470 |
abort:abortText |
|
471 |
ifFail:failBlock |
|
472 |
pattern:pattern |
|
473 |
fromDirectory:aDirectoryPath |
|
474 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
475 |
asLoadDialog:asLoadDialog |
|
5329 | 476 |
viewFiles:true |
4795 | 477 |
multipleSelect:true. |
3904 | 478 |
|
3996 | 479 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 480 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
481 |
^ failBlock value |
|
482 |
]. |
|
483 |
lastDirectory := enteredFileNames first. |
|
484 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
485 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
486 |
^ enteredFileNames |
|
487 |
||
488 |
" |
|
489 |
FileDialog |
|
490 |
requestFileNames:'enter a fileName:' |
|
491 |
default:'' |
|
492 |
ok:nil |
|
493 |
abort:nil |
|
494 |
ifFail:['none'] |
|
495 |
pattern:'*.conf' |
|
4627 | 496 |
fromDirectory:Filename currentDirectory pathName |
3956 | 497 |
whenBoxCreatedEvaluate:nil |
498 |
asLoadDialog:true. |
|
3904 | 499 |
" |
500 |
! |
|
501 |
||
5329 | 502 |
startApplicationFor:titleString default:initialDefaultFileName ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
3904 | 503 |
"launch a Dialog, which allows user to enter a filename. |
504 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
505 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
506 |
The box will show okText in its okButton, abortText in the abortButton. |
|
507 |
The matchPattern is set to pattern initially. |
|
508 |
Return the string, or nil if cancel was pressed |
|
509 |
The version argument allows validation of the files existance; |
|
510 |
it may be any of: |
|
511 |
#mustBeNew - fail (return empty string) if the file exists |
|
512 |
#new - confirm if the file exists |
|
513 |
#mustBeOld - fail if the file does not exist |
|
514 |
#old - confirm if the file does not exist |
|
515 |
#any (other) - no validation |
|
516 |
" |
|
517 |
||
518 |
||
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
519 |
|defaultDir instance defaultFile okText abortText| |
5163 | 520 |
|
521 |
okText := okTextArg. |
|
522 |
okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
|
523 |
abortText := abortTextArg. |
|
524 |
abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
|
3904 | 525 |
|
526 |
defaultDir := aDirectoryPath. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
527 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
528 |
"/ (initialDefaultFileName size > 0 and:[initialDefaultFileName asFilename exists]) ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
529 |
"/ defaultDir := initialDefaultFileName asFilename asAbsoluteFilename directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
530 |
"/ ] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
531 |
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
532 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
533 |
"/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
534 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
535 |
"/ defaultDir asFilename exists ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
536 |
"/ defaultDir := nil |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
537 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
538 |
"/ ] |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
539 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
540 |
(initialDefaultFileName notNil |
5375 | 541 |
and:[initialDefaultFileName asFilename isAbsolute |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
542 |
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
543 |
defaultDir := initialDefaultFileName asFilename asAbsoluteFilename. |
5329 | 544 |
viewFiles ifTrue:[ |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
545 |
defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
546 |
]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
547 |
] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
548 |
defaultDir isNil ifTrue:[ |
5193 | 549 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
550 |
defaultDir isNil ifTrue:[ |
|
551 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
552 |
]. |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
553 |
defaultDir asFilename exists ifFalse:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
554 |
defaultDir := nil |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
555 |
]. |
3956 | 556 |
] |
3904 | 557 |
]. |
4206 | 558 |
defaultDir := defaultDir asFilename asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
559 |
"/ [defaultDir exists] whileFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
560 |
"/ defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
561 |
"/ ]. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
562 |
|
5329 | 563 |
viewFiles ifFalse:[ |
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
564 |
defaultFile := defaultDir asFilename asAbsoluteFilename. |
5329 | 565 |
] ifTrue:[ |
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
566 |
(initialDefaultFileName notNil and:[initialDefaultFileName asFilename withoutSuffix baseName ~= '*']) ifTrue:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
567 |
defaultFile := defaultDir construct:initialDefaultFileName asFilename baseName. |
3956 | 568 |
]. |
3904 | 569 |
]. |
4562 | 570 |
defaultFile isNil ifTrue:[ |
571 |
defaultFile := defaultDir. |
|
572 |
]. |
|
3956 | 573 |
|
3904 | 574 |
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
|
575 |
defaultDir notNil ifTrue:[instance directory:defaultDir]. |
3958 | 576 |
instance multipleSelect:multipleSelect ? false. |
3904 | 577 |
instance startFilename:defaultFile. |
578 |
instance pattern:((pattern isNil or:[pattern isEmpty]) ifTrue:['*'] ifFalse:[pattern]). |
|
579 |
instance initialText:titleString. |
|
580 |
instance okLabelHolder value:okText. |
|
581 |
instance cancelLabelHolder value:abortText. |
|
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
582 |
|
4804 | 583 |
instance beLoadDialog:asLoadDialog ? false. |
5329 | 584 |
instance viewFiles:viewFiles ? true. |
3953 | 585 |
self setDoubleClickActionFor:instance. |
3904 | 586 |
instance allButOpenInterface:#windowSpec. |
587 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
588 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
589 |
Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
3904 | 590 |
instance openWindowModal. |
591 |
^ instance |
|
3892 | 592 |
! ! |
593 |
||
594 |
!FileDialog class methodsFor:'accessing'! |
|
595 |
||
3953 | 596 |
setDoubleClickActionFor:instance |
597 |
||
598 |
instance doubleClickAction:[:anIndex| |
|
599 |
| item | |
|
600 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
601 |
item notNil ifTrue:[ |
|
5329 | 602 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 603 |
instance doAccept. |
604 |
] |
|
605 |
] |
|
606 |
]. |
|
3892 | 607 |
! ! |
608 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
609 |
!FileDialog class methodsFor:'active help'! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
610 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
611 |
flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
612 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
613 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
614 |
|spec hist| |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
615 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
616 |
spec := super flyByHelpSpec addPairsFrom:#( |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
617 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
618 |
#directoryUp |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
619 |
'Directory Up' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
620 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
621 |
#directoryBack |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
622 |
'Directory Back' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
623 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
624 |
#directoryForward |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
625 |
'Directory Forward' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
626 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
627 |
#directoryHistory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
628 |
'Directory' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
629 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
630 |
#fileHome |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
631 |
'Home Directory' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
632 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
633 |
#fileGotoDefault |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
634 |
'Default Directory (ST/X Start Directory)' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
635 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
636 |
#fileHistory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
637 |
'File History' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
638 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
639 |
). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
640 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
641 |
"/ hist := self directoryHistory. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
642 |
"/ hist notNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
643 |
"/ hist canForward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
644 |
"/ spec at:#directoryForward put:(self classResources string:'Forward to: %1' with:hist nextForwardItem). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
645 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
646 |
"/ hist canBackward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
647 |
"/ spec at:#directoryBack put:(self classResources string:'Back to: %1' with:hist nextBackwardItem). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
648 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
649 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
650 |
^ spec. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
651 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
652 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
653 |
self flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
654 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
655 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
656 |
|
3892 | 657 |
!FileDialog class methodsFor:'interface specs'! |
658 |
||
659 |
windowSpec |
|
660 |
"This resource specification was automatically generated |
|
661 |
by the UIPainter of ST/X." |
|
662 |
||
663 |
"Do not manually edit this!! If it is corrupted, |
|
664 |
the UIPainter may not be able to read the specification." |
|
665 |
||
666 |
" |
|
667 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
668 |
FileDialog new openInterface:#windowSpec |
|
669 |
FileDialog open |
|
670 |
" |
|
671 |
||
672 |
<resource: #canvas> |
|
673 |
||
674 |
^ |
|
5229 | 675 |
#(FullSpec |
676 |
name: windowSpec |
|
677 |
window: |
|
678 |
(WindowSpec |
|
679 |
label: 'FileDialog' |
|
680 |
name: 'FileDialog' |
|
681 |
min: (Point 10 10) |
|
682 |
max: (Point 1024 768) |
|
683 |
bounds: (Rectangle 16 52 416 452) |
|
3892 | 684 |
) |
5229 | 685 |
component: |
686 |
(SpecCollection |
|
687 |
collection: ( |
|
688 |
(ViewSpec |
|
689 |
name: 'FilePart' |
|
690 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
691 |
component: |
|
692 |
(SpecCollection |
|
693 |
collection: ( |
|
694 |
(MenuPanelSpec |
|
695 |
name: 'ToolBar1' |
|
696 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0) |
|
697 |
tabable: true |
|
698 |
menu: toolBarMenu |
|
699 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
700 |
) |
5229 | 701 |
(SubCanvasSpec |
702 |
name: 'DirectoryTreeBrowser' |
|
703 |
layout: (LayoutFrame 0 0.0 55 0 0 1.0 -30 1) |
|
704 |
tabable: true |
|
705 |
hasHorizontalScrollBar: false |
|
706 |
hasVerticalScrollBar: false |
|
707 |
majorKey: DirectoryTreeBrowser |
|
708 |
createNewApplication: true |
|
709 |
createNewBuilder: true |
|
710 |
postBuildCallback: postBuildTreeBrowser: |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
711 |
) |
5229 | 712 |
(VariableHorizontalPanelSpec |
713 |
name: 'VariableHorizontalPanel1' |
|
714 |
layout: (LayoutFrame 0 0 30 0 0 1 55 0) |
|
715 |
level: 1 |
|
716 |
showHandle: false |
|
717 |
barLevel: 0 |
|
718 |
component: |
|
719 |
(SpecCollection |
|
720 |
collection: ( |
|
721 |
(ViewSpec |
|
722 |
name: 'Box1' |
|
4804 | 723 |
) |
5229 | 724 |
(ViewSpec |
725 |
name: 'Box2' |
|
726 |
component: |
|
727 |
(SpecCollection |
|
728 |
collection: ( |
|
729 |
(LabelSpec |
|
730 |
label: 'Filter:' |
|
731 |
name: 'FilterLabel' |
|
732 |
layout: (LayoutFrame 8 0 2 0 59 0 -2 1) |
|
733 |
translateLabel: true |
|
734 |
adjust: right |
|
4804 | 735 |
) |
5229 | 736 |
(InputFieldSpec |
737 |
name: 'FilterEntryField' |
|
738 |
layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1) |
|
739 |
model: filterHolder |
|
740 |
immediateAccept: true |
|
741 |
acceptOnReturn: true |
|
742 |
acceptOnTab: true |
|
743 |
acceptOnLostFocus: true |
|
744 |
acceptOnPointerLeave: false |
|
745 |
postBuildCallback: postBuildFilterField: |
|
4804 | 746 |
) |
747 |
) |
|
748 |
||
749 |
) |
|
750 |
) |
|
751 |
) |
|
752 |
||
753 |
) |
|
5229 | 754 |
handles: (Any 0.5 1.0) |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
755 |
) |
5230 | 756 |
(LabelSpec |
757 |
label: 'Filename:' |
|
758 |
name: 'FilenameLabel' |
|
759 |
layout: (LayoutFrame 3 0 -21 1 73 0 -1 1) |
|
760 |
translateLabel: true |
|
761 |
labelChannel: filenameLabelHolder |
|
762 |
adjust: left |
|
763 |
) |
|
764 |
(FilenameInputFieldSpec |
|
765 |
name: 'FilenameEntryField' |
|
766 |
layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1) |
|
767 |
tabable: true |
|
768 |
model: filenameHolder |
|
769 |
immediateAccept: false |
|
770 |
acceptOnPointerLeave: false |
|
771 |
postBuildCallback: postBuildFileNameField: |
|
772 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
773 |
) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
774 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
775 |
) |
3892 | 776 |
) |
5229 | 777 |
(HorizontalPanelViewSpec |
778 |
name: 'ButtonPanel' |
|
779 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
780 |
visibilityChannel: buttonPanelVisibleHolder |
|
781 |
horizontalLayout: fitSpace |
|
782 |
verticalLayout: center |
|
783 |
horizontalSpace: 3 |
|
784 |
verticalSpace: 3 |
|
785 |
reverseOrderIfOKAtLeft: true |
|
786 |
component: |
|
787 |
(SpecCollection |
|
788 |
collection: ( |
|
789 |
(ActionButtonSpec |
|
790 |
label: 'Cancel' |
|
791 |
name: 'cancelButton' |
|
792 |
translateLabel: true |
|
793 |
labelChannel: cancelLabelHolder |
|
794 |
tabable: true |
|
795 |
model: doCancel |
|
796 |
extent: (Point 129 22) |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
797 |
) |
5229 | 798 |
(ActionButtonSpec |
799 |
label: 'Append' |
|
800 |
name: 'appendButton' |
|
801 |
visibilityChannel: appendButtonVisibleHolder |
|
802 |
translateLabel: true |
|
803 |
labelChannel: appendLabelHolder |
|
804 |
tabable: true |
|
805 |
model: appendPressed |
|
806 |
extent: (Point 129 22) |
|
3892 | 807 |
) |
5229 | 808 |
(ActionButtonSpec |
809 |
label: 'OK' |
|
810 |
name: 'okButton' |
|
811 |
translateLabel: true |
|
812 |
labelChannel: okLabelHolder |
|
813 |
tabable: true |
|
814 |
model: okPressed |
|
815 |
isDefault: true |
|
816 |
extent: (Point 130 22) |
|
3892 | 817 |
) |
818 |
) |
|
819 |
||
820 |
) |
|
821 |
) |
|
822 |
) |
|
823 |
||
824 |
) |
|
825 |
) |
|
826 |
! ! |
|
827 |
||
828 |
!FileDialog class methodsFor:'menu specs'! |
|
829 |
||
830 |
toolBarMenu |
|
831 |
"This resource specification was automatically generated |
|
832 |
by the MenuEditor of ST/X." |
|
833 |
||
834 |
"Do not manually edit this!! If it is corrupted, |
|
835 |
the MenuEditor may not be able to read the specification." |
|
836 |
||
837 |
" |
|
838 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
839 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
840 |
" |
|
841 |
||
842 |
<resource: #menu> |
|
843 |
||
844 |
^ |
|
845 |
#(#Menu |
|
846 |
#( |
|
847 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
848 |
#activeHelpKey: #directoryUp |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
849 |
#enabled: #enableDirectoryUp |
3892 | 850 |
#label: 'DirectoryUp' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
851 |
#itemValue: #doGoDirectoryUp |
3892 | 852 |
#translateLabel: true |
853 |
#isButton: true |
|
854 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrow20x20Icon) |
|
855 |
) |
|
856 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
857 |
#label: '' |
3892 | 858 |
) |
859 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
860 |
#activeHelpKey: #directoryBack |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
861 |
#enabled: #enableBack |
3892 | 862 |
#label: 'Back' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
863 |
#itemValue: #doBack |
3892 | 864 |
#translateLabel: true |
865 |
#isButton: true |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
866 |
#submenuChannel: #menuDirHistoryBack |
3904 | 867 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrow20x20Icon) |
3892 | 868 |
) |
869 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
870 |
#label: '' |
3892 | 871 |
) |
872 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
873 |
#activeHelpKey: #directoryForward |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
874 |
#enabled: #enableForward |
3892 | 875 |
#label: 'Forward' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
876 |
#itemValue: #doForward |
3892 | 877 |
#translateLabel: true |
878 |
#isButton: true |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
879 |
#submenuChannel: #menuDirHistoryForward |
3904 | 880 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrow20x20Icon) |
3892 | 881 |
) |
882 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
883 |
#label: '' |
3892 | 884 |
) |
885 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
886 |
#activeHelpKey: #fileHome |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
887 |
#enabled: #enableHome |
3892 | 888 |
#label: 'Home' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
889 |
#itemValue: #doGotoHomeDirectory |
3892 | 890 |
#translateLabel: true |
891 |
#isButton: true |
|
892 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon) |
|
893 |
) |
|
3923 | 894 |
#(#MenuItem |
895 |
#label: '-' |
|
896 |
) |
|
897 |
#(#MenuItem |
|
898 |
#label: 'New Directory' |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
899 |
#itemValue: #newDirectory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
900 |
#translateLabel: true |
3923 | 901 |
#isButton: true |
3956 | 902 |
#isVisible: #newDirectoryVisibilityHolder |
3923 | 903 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #newDirectory20x20Icon) |
904 |
) |
|
3892 | 905 |
) |
906 |
nil |
|
907 |
nil |
|
908 |
) |
|
909 |
! ! |
|
910 |
||
911 |
!FileDialog methodsFor:'accessing'! |
|
912 |
||
3996 | 913 |
currentSelectedFiles |
914 |
||
915 |
| selectedFiles| |
|
916 |
||
917 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
918 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
919 |
! |
|
920 |
||
3892 | 921 |
directory |
922 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
923 |
||
924 |
^ directory |
|
925 |
! |
|
926 |
||
927 |
directory:something |
|
928 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
929 |
||
930 |
directory := something. |
|
931 |
! |
|
932 |
||
933 |
initialText |
|
934 |
||
5598 | 935 |
initialText isNil ifTrue:[ |
936 |
^ resources string:'File Dialog'. |
|
937 |
]. |
|
938 |
^ resources string:initialText |
|
3892 | 939 |
! |
940 |
||
941 |
initialText:something |
|
942 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
943 |
||
944 |
initialText := something. |
|
945 |
! |
|
946 |
||
947 |
pattern |
|
948 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
949 |
||
950 |
^ pattern |
|
951 |
! |
|
952 |
||
953 |
pattern:something |
|
954 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
955 |
||
956 |
pattern := something. |
|
957 |
! |
|
958 |
||
959 |
result |
|
960 |
"return the value of the instance variable 'result' (automatically generated)" |
|
961 |
||
962 |
^ result |
|
963 |
! |
|
964 |
||
965 |
result:something |
|
966 |
"set the value of the instance variable 'result' (automatically generated)" |
|
967 |
||
968 |
result := something. |
|
969 |
! |
|
970 |
||
3904 | 971 |
selectedDirectories |
972 |
||
973 |
| selectedFiles| |
|
974 |
||
975 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
976 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
977 |
! |
|
978 |
||
3892 | 979 |
startFilename |
980 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
981 |
||
982 |
startFilename isNil ifTrue:[ |
|
983 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
984 |
]. |
|
985 |
^ startFilename |
|
986 |
! |
|
987 |
||
988 |
startFilename:something |
|
989 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
990 |
||
991 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
992 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
993 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
994 |
!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
|
995 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
996 |
asLoadDialog |
4804 | 997 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
998 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
999 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1000 |
asLoadDialog:aBoolean |
4804 | 1001 |
self beLoadDialog:aBoolean |
1002 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1003 |
|
4804 | 1004 |
beLoadDialog:aBoolean |
1005 |
||
1006 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1007 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1008 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1009 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1010 |
"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
|
1011 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1012 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1013 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1014 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1015 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1016 |
"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
|
1017 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1018 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1019 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1020 |
|
4804 | 1021 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1022 |
|
4804 | 1023 |
^ isLoadDialog ? true |
1024 |
! |
|
1025 |
||
1026 |
multipleSelect |
|
1027 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1028 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1029 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1030 |
multipleSelect:aBoolean |
4804 | 1031 |
multipleSelect := aBoolean. |
1032 |
treeBrowser notNil ifTrue:[ |
|
1033 |
treeBrowser multipleSelect:aBoolean. |
|
1034 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1035 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1036 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1037 |
!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
|
1038 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1039 |
addButton:aButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1040 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1041 |
(self componentAt:#ButtonPanel) addSubView:aButton before:(self okButton) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1042 |
] ifFalse:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1043 |
(self componentAt:#ButtonPanel) addSubView:aButton after:(self okButton) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1044 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1045 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1046 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1047 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1048 |
^ (self componentAt:#okButton) |
3892 | 1049 |
! |
1050 |
||
3904 | 1051 |
treeBrowser |
1052 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1053 |
||
1054 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1055 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1056 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1057 |
!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
|
1058 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1059 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1060 |
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
|
1061 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1062 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1063 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1064 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1065 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1066 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1067 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1068 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1069 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1070 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1071 |
self buttonPanelVisibleHolder value:true |
3904 | 1072 |
! |
1073 |
||
3892 | 1074 |
viewFiles |
1075 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1076 |
||
1077 |
^ viewFiles |
|
1078 |
! |
|
1079 |
||
1080 |
viewFiles:something |
|
1081 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1082 |
||
1083 |
viewFiles := something. |
|
1084 |
! ! |
|
1085 |
||
1086 |
!FileDialog methodsFor:'aspects'! |
|
1087 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1088 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1089 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1090 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1091 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1092 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1093 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1094 |
|
5193 | 1095 |
appendLabelHolder |
1096 |
appendLabelHolder isNil ifTrue:[ |
|
1097 |
appendLabelHolder := 'Append' asValue. |
|
1098 |
]. |
|
1099 |
^ appendLabelHolder |
|
1100 |
! |
|
1101 |
||
4804 | 1102 |
aspectOrNil:aKey forSubApplication:aSubApp |
1103 |
"this hook provides an aspect for a subApp" |
|
1104 |
||
1105 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1106 |
directory notNil ifTrue:[ |
|
1107 |
^ (OrderedCollection with:directory) asValue |
|
1108 |
] |
|
1109 |
]. |
|
1110 |
^ nil |
|
1111 |
! |
|
1112 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1113 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1114 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1115 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1116 |
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
|
1117 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1118 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1119 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1120 |
|
3892 | 1121 |
cancelLabelHolder |
1122 |
"automatically generated by UIPainter ..." |
|
1123 |
||
1124 |
"*** the code below creates a default model when invoked." |
|
1125 |
"*** (which may not be the one you wanted)" |
|
1126 |
"*** Please change as required and accept it in the browser." |
|
1127 |
"*** (and replace this comment by something more useful ;-)" |
|
1128 |
||
1129 |
cancelLabelHolder isNil ifTrue:[ |
|
1130 |
cancelLabelHolder := 'Cancel' asValue. |
|
1131 |
]. |
|
1132 |
^ cancelLabelHolder. |
|
1133 |
! |
|
1134 |
||
1135 |
enableBack |
|
4804 | 1136 |
^ treeBrowser enableBack. |
3892 | 1137 |
! |
1138 |
||
1139 |
enableDirectoryUp |
|
4804 | 1140 |
^ treeBrowser enableDirectoryUp. |
3892 | 1141 |
! |
1142 |
||
1143 |
enableForward |
|
4804 | 1144 |
^ treeBrowser enableForward. |
3892 | 1145 |
! |
1146 |
||
1147 |
enableHome |
|
4804 | 1148 |
^ treeBrowser enableHome. |
3892 | 1149 |
! |
1150 |
||
1151 |
filenameHolder |
|
1152 |
"Return a value holder with the filename. |
|
1153 |
Shown in the filename input-field. |
|
1154 |
Being the selection in the tree. |
|
1155 |
" |
|
1156 |
|holder| |
|
1157 |
holder := builder bindingAt:#filenameHolder. |
|
1158 |
||
1159 |
holder ifNil:[ |
|
1160 |
holder := ValueHolder new. |
|
1161 |
holder addDependent:self. |
|
1162 |
builder aspectAt:#filenameHolder |
|
1163 |
put:holder. |
|
1164 |
]. |
|
1165 |
||
1166 |
^ holder. |
|
1167 |
! |
|
1168 |
||
3904 | 1169 |
filenameLabelHolder |
1170 |
"Return a value holder for the input string. |
|
1171 |
" |
|
1172 |
filenameLabelHolder isNil ifTrue:[ |
|
1173 |
filenameLabelHolder := 'Filename:' asValue. |
|
1174 |
]. |
|
1175 |
^ filenameLabelHolder |
|
1176 |
! |
|
1177 |
||
3892 | 1178 |
filterHolder |
4011 | 1179 |
"Return a value holder for filter |
3892 | 1180 |
" |
1181 |
||
1182 |
filterHolder isNil ifTrue:[ |
|
1183 |
filterHolder := treeBrowser filterModel. |
|
1184 |
self pattern notNil ifTrue:[ |
|
1185 |
filterHolder value:pattern. |
|
1186 |
] |
|
1187 |
]. |
|
1188 |
^ filterHolder |
|
1189 |
! |
|
1190 |
||
1191 |
okLabelHolder |
|
1192 |
"automatically generated by UIPainter ..." |
|
1193 |
||
1194 |
"*** the code below creates a default model when invoked." |
|
1195 |
"*** (which may not be the one you wanted)" |
|
1196 |
"*** Please change as required and accept it in the browser." |
|
1197 |
"*** (and replace this comment by something more useful ;-)" |
|
1198 |
||
1199 |
okLabelHolder isNil ifTrue:[ |
|
1200 |
okLabelHolder := 'OK' asValue. |
|
1201 |
]. |
|
1202 |
^ okLabelHolder. |
|
1203 |
! ! |
|
1204 |
||
1205 |
!FileDialog methodsFor:'change & update'! |
|
1206 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1207 |
buttonPanelVisibilityChanged |
5598 | 1208 |
|filePart| |
4728
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 |
filePart := builder componentAt:#FilePart. |
5598 | 1211 |
filePart notNil ifTrue:[ |
1212 |
buttonPanelVisibleHolder value ifTrue:[ |
|
1213 |
filePart layout bottomOffset:-40 |
|
1214 |
] ifFalse:[ |
|
1215 |
filePart layout bottomOffset:0 |
|
1216 |
]. |
|
1217 |
filePart containerChangedSize "/ force resize |
|
1218 |
] |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1219 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1220 |
|
3892 | 1221 |
update:something with:aParameter from:changedObject |
4804 | 1222 |
|files newFile newLabel fn| |
3892 | 1223 |
|
1224 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1225 |
files := changedObject value. |
3892 | 1226 |
|
1227 |
(files isEmpty) ifTrue:[ |
|
4804 | 1228 |
newFile := nil. |
3892 | 1229 |
] ifFalse:[ |
1230 |
files size == 1 ifTrue:[ |
|
4804 | 1231 |
newFile := files first. |
3892 | 1232 |
] ifFalse:[ |
4804 | 1233 |
newFile := ''. |
3892 | 1234 |
]. |
1235 |
]. |
|
4804 | 1236 |
self filenameHolder value:newFile withoutNotifying:self. |
3892 | 1237 |
]. |
4804 | 1238 |
|
3904 | 1239 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1240 |
changedObject value ifTrue:[ |
|
4804 | 1241 |
newLabel := 'Filename:'. |
3904 | 1242 |
] ifFalse:[ |
4804 | 1243 |
newLabel := 'Directory:'. |
1244 |
]. |
|
1245 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1246 |
]. |
3892 | 1247 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1248 |
fn := changedObject value asFilename. |
1249 |
(fn exists) ifFalse:[^ self]. |
|
1250 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
|
3892 | 1251 |
]. |
1252 |
^ super update:something with:aParameter from:changedObject |
|
1253 |
! ! |
|
1254 |
||
1255 |
!FileDialog methodsFor:'event handling'! |
|
1256 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1257 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1258 |
"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
|
1259 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1260 |
^ appendWasPressed |
3892 | 1261 |
! ! |
1262 |
||
1263 |
!FileDialog methodsFor:'initialization & release'! |
|
1264 |
||
1265 |
postBuildFileNameField:aWidget |
|
1266 |
||
1267 |
filenameField := aWidget. |
|
1268 |
! |
|
1269 |
||
1270 |
postBuildFilterField:aWidget |
|
1271 |
||
1272 |
filterField := aWidget. |
|
1273 |
! |
|
1274 |
||
1275 |
postBuildTreeBrowser:aSubCanvasView |
|
1276 |
||
1277 |
treeBrowser := aSubCanvasView client. |
|
1278 |
! |
|
1279 |
||
4005
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1280 |
postBuildWith:aBuilder |
4804 | 1281 |
treeBrowser multipleSelect:multipleSelect. |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1282 |
appendWasPressed := false. |
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
1283 |
|
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
1284 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
1285 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
1286 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
1287 |
|
4005
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1288 |
^ super postBuildWith:aBuilder |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1289 |
! |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1290 |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1291 |
postOpen |
3892 | 1292 |
|
1293 |
"/ 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
|
1294 |
|
5617
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1295 |
"No ok and cancel buttons, when dialog is part of a larger dialog" |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1296 |
self window topView isModal ifFalse:[ |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1297 |
self hideButtonPanel |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1298 |
]. |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1299 |
|
3892 | 1300 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1301 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1302 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
3982 | 1303 |
treeBrowser rootHolder value:((self directory) ? (Filename currentDirectory asAbsoluteFilename)). |
4804 | 1304 |
|
1305 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
|
4796 | 1306 |
treeBrowser viewFilesInDirectoryTree changed. |
5598 | 1307 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename). |
4804 | 1308 |
|
1309 |
self isLoadDialog ifTrue:[ |
|
4796 | 1310 |
treeBrowser newVisibilityHolder value:false. |
1311 |
treeBrowser allowFileOperations value:false. |
|
1312 |
self newDirectoryVisibilityHolder value:false. |
|
1313 |
]. |
|
5598 | 1314 |
self filenameHolder value:self startFilename. |
1315 |
self window label:self initialText. |
|
4796 | 1316 |
! |
1317 |
||
1318 |
postOpenAsSubcanvasWith:aBuilder |
|
1319 |
self postOpen. |
|
1320 |
^ super postOpenAsSubcanvasWith:aBuilder |
|
1321 |
! |
|
1322 |
||
1323 |
postOpenWith:aBuilder |
|
1324 |
||
1325 |
self postOpen. |
|
1326 |
^ super postOpenWith:aBuilder. |
|
1327 |
! ! |
|
1328 |
||
1329 |
!FileDialog methodsFor:'private'! |
|
1330 |
||
1331 |
returnWasPressedInFilterField |
|
1332 |
|ev| |
|
1333 |
||
1334 |
ev := self windowGroup lastEvent. |
|
1335 |
(ev notNil |
|
1336 |
and:[ev isKeyEvent |
|
1337 |
and:[ev key == #Return |
|
1338 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1339 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1340 |
^ true |
|
1341 |
]. |
|
1342 |
^ false |
|
1343 |
! |
|
1344 |
||
1345 |
returnWasPressedInFilterOrFilenameField |
|
1346 |
|ev| |
|
1347 |
||
1348 |
ev := self windowGroup lastEvent. |
|
1349 |
(ev notNil |
|
1350 |
and:[ev isKeyEvent |
|
1351 |
and:[ev key == #Return |
|
1352 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1353 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1354 |
^ true |
|
1355 |
]. |
|
1356 |
^ false |
|
1357 |
! ! |
|
1358 |
||
1359 |
!FileDialog methodsFor:'user actions'! |
|
1360 |
||
1361 |
appendPressed |
|
1362 |
appendWasPressed := true. |
|
1363 |
self commonAcceptAction. |
|
1364 |
! |
|
1365 |
||
1366 |
commonAcceptAction |
|
1367 |
filenameField accept. |
|
1368 |
self result:(self filenameHolder value asString). |
|
1369 |
||
1370 |
^ super doAccept |
|
1371 |
! |
|
1372 |
||
1373 |
doAccept |
|
1374 |
"force accept - ignore in filterField" |
|
1375 |
||
1376 |
self returnWasPressedInFilterField ifTrue:[ |
|
1377 |
^ self |
|
1378 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1379 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1380 |
"/ 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
|
1381 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1382 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1383 |
]. |
4796 | 1384 |
appendWasPressed := false. |
1385 |
self commonAcceptAction. |
|
1386 |
! |
|
1387 |
||
1388 |
doBack |
|
1389 |
||
1390 |
treeBrowser doBack. |
|
1391 |
! |
|
1392 |
||
1393 |
doCancel |
|
1394 |
||
1395 |
self result:nil. |
|
1396 |
^ super doCancel. |
|
1397 |
! |
|
1398 |
||
1399 |
doForward |
|
1400 |
||
1401 |
treeBrowser doForward. |
|
1402 |
! |
|
1403 |
||
1404 |
doGoDirectoryUp |
|
1405 |
||
1406 |
treeBrowser doGoDirectoryUp. |
|
1407 |
! |
|
1408 |
||
1409 |
doGotoHomeDirectory |
|
1410 |
||
1411 |
treeBrowser doGotoHomeDirectory. |
|
1412 |
! |
|
1413 |
||
1414 |
menuDirHistory:backOrForward |
|
1415 |
||
1416 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1417 |
! |
|
1418 |
||
1419 |
menuDirHistoryBack |
|
1420 |
||
1421 |
^ treeBrowser menuDirHistory:#back. |
|
1422 |
! |
|
1423 |
||
1424 |
menuDirHistoryForward |
|
1425 |
||
1426 |
^ treeBrowser menuDirHistory:#forward. |
|
1427 |
! |
|
1428 |
||
1429 |
newDirectory |
|
1430 |
||
1431 |
^ treeBrowser newDirectory |
|
1432 |
! |
|
1433 |
||
1434 |
okPressed |
|
1435 |
self doAccept |
|
1436 |
! ! |
|
1437 |
||
1438 |
!FileDialog class methodsFor:'documentation'! |
|
1439 |
||
1440 |
version |
|
5617
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1441 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.54 2004-03-02 10:22:38 cg Exp $' |
4796 | 1442 |
! ! |