author | Stefan Vogel <sv@exept.de> |
Mon, 24 Nov 2003 20:59:49 +0100 | |
changeset 5375 | 7148fcfa2019 |
parent 5336 | 6a28518b52a0 |
child 5571 | 333ee892a087 |
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. |
|
4804 | 582 |
instance beLoadDialog:asLoadDialog ? false. |
5329 | 583 |
instance viewFiles:viewFiles ? true. |
3953 | 584 |
self setDoubleClickActionFor:instance. |
3904 | 585 |
instance allButOpenInterface:#windowSpec. |
586 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
587 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
588 |
Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
3904 | 589 |
instance openWindowModal. |
590 |
^ instance |
|
3892 | 591 |
! ! |
592 |
||
593 |
!FileDialog class methodsFor:'accessing'! |
|
594 |
||
3953 | 595 |
setDoubleClickActionFor:instance |
596 |
||
597 |
instance doubleClickAction:[:anIndex| |
|
598 |
| item | |
|
599 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
600 |
item notNil ifTrue:[ |
|
5329 | 601 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 602 |
instance doAccept. |
603 |
] |
|
604 |
] |
|
605 |
]. |
|
3892 | 606 |
! ! |
607 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
608 |
!FileDialog class methodsFor:'active help'! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
609 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
610 |
flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
611 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
612 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
613 |
|spec hist| |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
614 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
615 |
spec := super flyByHelpSpec addPairsFrom:#( |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
616 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
617 |
#directoryUp |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
618 |
'Directory Up' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
619 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
620 |
#directoryBack |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
621 |
'Directory Back' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
622 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
623 |
#directoryForward |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
624 |
'Directory Forward' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
625 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
626 |
#directoryHistory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
627 |
'Directory' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
628 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
629 |
#fileHome |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
630 |
'Home Directory' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
631 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
632 |
#fileGotoDefault |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
633 |
'Default Directory (ST/X Start Directory)' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
634 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
635 |
#fileHistory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
636 |
'File History' |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
637 |
|
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 |
"/ hist := self directoryHistory. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
641 |
"/ hist notNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
642 |
"/ hist canForward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
643 |
"/ 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
|
644 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
645 |
"/ hist canBackward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
646 |
"/ 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
|
647 |
"/ ]. |
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 |
^ spec. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
650 |
|
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 |
self flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
653 |
" |
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 |
|
3892 | 656 |
!FileDialog class methodsFor:'interface specs'! |
657 |
||
658 |
windowSpec |
|
659 |
"This resource specification was automatically generated |
|
660 |
by the UIPainter of ST/X." |
|
661 |
||
662 |
"Do not manually edit this!! If it is corrupted, |
|
663 |
the UIPainter may not be able to read the specification." |
|
664 |
||
665 |
" |
|
666 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
667 |
FileDialog new openInterface:#windowSpec |
|
668 |
FileDialog open |
|
669 |
" |
|
670 |
||
671 |
<resource: #canvas> |
|
672 |
||
673 |
^ |
|
5229 | 674 |
#(FullSpec |
675 |
name: windowSpec |
|
676 |
window: |
|
677 |
(WindowSpec |
|
678 |
label: 'FileDialog' |
|
679 |
name: 'FileDialog' |
|
680 |
min: (Point 10 10) |
|
681 |
max: (Point 1024 768) |
|
682 |
bounds: (Rectangle 16 52 416 452) |
|
3892 | 683 |
) |
5229 | 684 |
component: |
685 |
(SpecCollection |
|
686 |
collection: ( |
|
687 |
(ViewSpec |
|
688 |
name: 'FilePart' |
|
689 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
690 |
component: |
|
691 |
(SpecCollection |
|
692 |
collection: ( |
|
693 |
(MenuPanelSpec |
|
694 |
name: 'ToolBar1' |
|
695 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 30 0) |
|
696 |
tabable: true |
|
697 |
menu: toolBarMenu |
|
698 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
699 |
) |
5229 | 700 |
(SubCanvasSpec |
701 |
name: 'DirectoryTreeBrowser' |
|
702 |
layout: (LayoutFrame 0 0.0 55 0 0 1.0 -30 1) |
|
703 |
tabable: true |
|
704 |
hasHorizontalScrollBar: false |
|
705 |
hasVerticalScrollBar: false |
|
706 |
majorKey: DirectoryTreeBrowser |
|
707 |
createNewApplication: true |
|
708 |
createNewBuilder: true |
|
709 |
postBuildCallback: postBuildTreeBrowser: |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
710 |
) |
5229 | 711 |
(VariableHorizontalPanelSpec |
712 |
name: 'VariableHorizontalPanel1' |
|
713 |
layout: (LayoutFrame 0 0 30 0 0 1 55 0) |
|
714 |
level: 1 |
|
715 |
showHandle: false |
|
716 |
barLevel: 0 |
|
717 |
component: |
|
718 |
(SpecCollection |
|
719 |
collection: ( |
|
720 |
(ViewSpec |
|
721 |
name: 'Box1' |
|
4804 | 722 |
) |
5229 | 723 |
(ViewSpec |
724 |
name: 'Box2' |
|
725 |
component: |
|
726 |
(SpecCollection |
|
727 |
collection: ( |
|
728 |
(LabelSpec |
|
729 |
label: 'Filter:' |
|
730 |
name: 'FilterLabel' |
|
731 |
layout: (LayoutFrame 8 0 2 0 59 0 -2 1) |
|
732 |
translateLabel: true |
|
733 |
adjust: right |
|
4804 | 734 |
) |
5229 | 735 |
(InputFieldSpec |
736 |
name: 'FilterEntryField' |
|
737 |
layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1) |
|
738 |
model: filterHolder |
|
739 |
immediateAccept: true |
|
740 |
acceptOnReturn: true |
|
741 |
acceptOnTab: true |
|
742 |
acceptOnLostFocus: true |
|
743 |
acceptOnPointerLeave: false |
|
744 |
postBuildCallback: postBuildFilterField: |
|
4804 | 745 |
) |
746 |
) |
|
747 |
||
748 |
) |
|
749 |
) |
|
750 |
) |
|
751 |
||
752 |
) |
|
5229 | 753 |
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
|
754 |
) |
5230 | 755 |
(LabelSpec |
756 |
label: 'Filename:' |
|
757 |
name: 'FilenameLabel' |
|
758 |
layout: (LayoutFrame 3 0 -21 1 73 0 -1 1) |
|
759 |
translateLabel: true |
|
760 |
labelChannel: filenameLabelHolder |
|
761 |
adjust: left |
|
762 |
) |
|
763 |
(FilenameInputFieldSpec |
|
764 |
name: 'FilenameEntryField' |
|
765 |
layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1) |
|
766 |
tabable: true |
|
767 |
model: filenameHolder |
|
768 |
immediateAccept: false |
|
769 |
acceptOnPointerLeave: false |
|
770 |
postBuildCallback: postBuildFileNameField: |
|
771 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
772 |
) |
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 |
) |
3892 | 775 |
) |
5229 | 776 |
(HorizontalPanelViewSpec |
777 |
name: 'ButtonPanel' |
|
778 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
779 |
visibilityChannel: buttonPanelVisibleHolder |
|
780 |
horizontalLayout: fitSpace |
|
781 |
verticalLayout: center |
|
782 |
horizontalSpace: 3 |
|
783 |
verticalSpace: 3 |
|
784 |
reverseOrderIfOKAtLeft: true |
|
785 |
component: |
|
786 |
(SpecCollection |
|
787 |
collection: ( |
|
788 |
(ActionButtonSpec |
|
789 |
label: 'Cancel' |
|
790 |
name: 'cancelButton' |
|
791 |
translateLabel: true |
|
792 |
labelChannel: cancelLabelHolder |
|
793 |
tabable: true |
|
794 |
model: doCancel |
|
795 |
extent: (Point 129 22) |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
796 |
) |
5229 | 797 |
(ActionButtonSpec |
798 |
label: 'Append' |
|
799 |
name: 'appendButton' |
|
800 |
visibilityChannel: appendButtonVisibleHolder |
|
801 |
translateLabel: true |
|
802 |
labelChannel: appendLabelHolder |
|
803 |
tabable: true |
|
804 |
model: appendPressed |
|
805 |
extent: (Point 129 22) |
|
3892 | 806 |
) |
5229 | 807 |
(ActionButtonSpec |
808 |
label: 'OK' |
|
809 |
name: 'okButton' |
|
810 |
translateLabel: true |
|
811 |
labelChannel: okLabelHolder |
|
812 |
tabable: true |
|
813 |
model: okPressed |
|
814 |
isDefault: true |
|
815 |
extent: (Point 130 22) |
|
3892 | 816 |
) |
817 |
) |
|
818 |
||
819 |
) |
|
820 |
) |
|
821 |
) |
|
822 |
||
823 |
) |
|
824 |
) |
|
825 |
! ! |
|
826 |
||
827 |
!FileDialog class methodsFor:'menu specs'! |
|
828 |
||
829 |
toolBarMenu |
|
830 |
"This resource specification was automatically generated |
|
831 |
by the MenuEditor of ST/X." |
|
832 |
||
833 |
"Do not manually edit this!! If it is corrupted, |
|
834 |
the MenuEditor may not be able to read the specification." |
|
835 |
||
836 |
" |
|
837 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
838 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
839 |
" |
|
840 |
||
841 |
<resource: #menu> |
|
842 |
||
843 |
^ |
|
844 |
#(#Menu |
|
845 |
#( |
|
846 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
847 |
#activeHelpKey: #directoryUp |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
848 |
#enabled: #enableDirectoryUp |
3892 | 849 |
#label: 'DirectoryUp' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
850 |
#itemValue: #doGoDirectoryUp |
3892 | 851 |
#translateLabel: true |
852 |
#isButton: true |
|
853 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #upArrow20x20Icon) |
|
854 |
) |
|
855 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
856 |
#label: '' |
3892 | 857 |
) |
858 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
859 |
#activeHelpKey: #directoryBack |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
860 |
#enabled: #enableBack |
3892 | 861 |
#label: 'Back' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
862 |
#itemValue: #doBack |
3892 | 863 |
#translateLabel: true |
864 |
#isButton: true |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
865 |
#submenuChannel: #menuDirHistoryBack |
3904 | 866 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #leftArrow20x20Icon) |
3892 | 867 |
) |
868 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
869 |
#label: '' |
3892 | 870 |
) |
871 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
872 |
#activeHelpKey: #directoryForward |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
873 |
#enabled: #enableForward |
3892 | 874 |
#label: 'Forward' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
875 |
#itemValue: #doForward |
3892 | 876 |
#translateLabel: true |
877 |
#isButton: true |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
878 |
#submenuChannel: #menuDirHistoryForward |
3904 | 879 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #rightArrow20x20Icon) |
3892 | 880 |
) |
881 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
882 |
#label: '' |
3892 | 883 |
) |
884 |
#(#MenuItem |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
885 |
#activeHelpKey: #fileHome |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
886 |
#enabled: #enableHome |
3892 | 887 |
#label: 'Home' |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
888 |
#itemValue: #doGotoHomeDirectory |
3892 | 889 |
#translateLabel: true |
890 |
#isButton: true |
|
891 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #goHomeIcon) |
|
892 |
) |
|
3923 | 893 |
#(#MenuItem |
894 |
#label: '-' |
|
895 |
) |
|
896 |
#(#MenuItem |
|
897 |
#label: 'New Directory' |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
898 |
#itemValue: #newDirectory |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
899 |
#translateLabel: true |
3923 | 900 |
#isButton: true |
3956 | 901 |
#isVisible: #newDirectoryVisibilityHolder |
3923 | 902 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #newDirectory20x20Icon) |
903 |
) |
|
3892 | 904 |
) |
905 |
nil |
|
906 |
nil |
|
907 |
) |
|
908 |
! ! |
|
909 |
||
910 |
!FileDialog methodsFor:'accessing'! |
|
911 |
||
3996 | 912 |
currentSelectedFiles |
913 |
||
914 |
| selectedFiles| |
|
915 |
||
916 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
917 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
918 |
! |
|
919 |
||
3892 | 920 |
directory |
921 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
922 |
||
923 |
^ directory |
|
924 |
! |
|
925 |
||
926 |
directory:something |
|
927 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
928 |
||
929 |
directory := something. |
|
930 |
! |
|
931 |
||
932 |
initialText |
|
933 |
"return the value of the instance variable 'initialText' (automatically generated)" |
|
934 |
||
935 |
^ initialText |
|
936 |
! |
|
937 |
||
938 |
initialText:something |
|
939 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
940 |
||
941 |
initialText := something. |
|
942 |
! |
|
943 |
||
944 |
pattern |
|
945 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
946 |
||
947 |
^ pattern |
|
948 |
! |
|
949 |
||
950 |
pattern:something |
|
951 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
952 |
||
953 |
pattern := something. |
|
954 |
! |
|
955 |
||
956 |
result |
|
957 |
"return the value of the instance variable 'result' (automatically generated)" |
|
958 |
||
959 |
^ result |
|
960 |
! |
|
961 |
||
962 |
result:something |
|
963 |
"set the value of the instance variable 'result' (automatically generated)" |
|
964 |
||
965 |
result := something. |
|
966 |
! |
|
967 |
||
3904 | 968 |
selectedDirectories |
969 |
||
970 |
| selectedFiles| |
|
971 |
||
972 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
973 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
974 |
! |
|
975 |
||
3892 | 976 |
startFilename |
977 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
978 |
||
979 |
startFilename isNil ifTrue:[ |
|
980 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
981 |
]. |
|
982 |
^ startFilename |
|
983 |
! |
|
984 |
||
985 |
startFilename:something |
|
986 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
987 |
||
988 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
989 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
990 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
991 |
!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
|
992 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
993 |
asLoadDialog |
4804 | 994 |
^ self isLoadDialog |
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
997 |
asLoadDialog:aBoolean |
4804 | 998 |
self beLoadDialog:aBoolean |
999 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1000 |
|
4804 | 1001 |
beLoadDialog:aBoolean |
1002 |
||
1003 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1004 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1005 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1006 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1007 |
"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
|
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 |
! |
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:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1013 |
"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
|
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 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1017 |
|
4804 | 1018 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1019 |
|
4804 | 1020 |
^ isLoadDialog ? true |
1021 |
! |
|
1022 |
||
1023 |
multipleSelect |
|
1024 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1025 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1026 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1027 |
multipleSelect:aBoolean |
4804 | 1028 |
multipleSelect := aBoolean. |
1029 |
treeBrowser notNil ifTrue:[ |
|
1030 |
treeBrowser multipleSelect:aBoolean. |
|
1031 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1032 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1033 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1034 |
!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
|
1035 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1036 |
addButton:aButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1037 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1038 |
(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
|
1039 |
] ifFalse:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1040 |
(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
|
1041 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1042 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1043 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1044 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1045 |
^ (self componentAt:#okButton) |
3892 | 1046 |
! |
1047 |
||
3904 | 1048 |
treeBrowser |
1049 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1050 |
||
1051 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1052 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1053 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1054 |
!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
|
1055 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1056 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1057 |
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
|
1058 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1059 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1060 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1061 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1062 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1063 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1064 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1065 |
! |
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 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1068 |
self buttonPanelVisibleHolder value:true |
3904 | 1069 |
! |
1070 |
||
3892 | 1071 |
viewFiles |
1072 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1073 |
||
1074 |
^ viewFiles |
|
1075 |
! |
|
1076 |
||
1077 |
viewFiles:something |
|
1078 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1079 |
||
1080 |
viewFiles := something. |
|
1081 |
! ! |
|
1082 |
||
1083 |
!FileDialog methodsFor:'aspects'! |
|
1084 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1085 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1086 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1087 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1088 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1089 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1090 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1091 |
|
5193 | 1092 |
appendLabelHolder |
1093 |
appendLabelHolder isNil ifTrue:[ |
|
1094 |
appendLabelHolder := 'Append' asValue. |
|
1095 |
]. |
|
1096 |
^ appendLabelHolder |
|
1097 |
! |
|
1098 |
||
4804 | 1099 |
aspectOrNil:aKey forSubApplication:aSubApp |
1100 |
"this hook provides an aspect for a subApp" |
|
1101 |
||
1102 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1103 |
directory notNil ifTrue:[ |
|
1104 |
^ (OrderedCollection with:directory) asValue |
|
1105 |
] |
|
1106 |
]. |
|
1107 |
^ nil |
|
1108 |
! |
|
1109 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1110 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1111 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1112 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1113 |
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
|
1114 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1115 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1116 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1117 |
|
3892 | 1118 |
cancelLabelHolder |
1119 |
"automatically generated by UIPainter ..." |
|
1120 |
||
1121 |
"*** the code below creates a default model when invoked." |
|
1122 |
"*** (which may not be the one you wanted)" |
|
1123 |
"*** Please change as required and accept it in the browser." |
|
1124 |
"*** (and replace this comment by something more useful ;-)" |
|
1125 |
||
1126 |
cancelLabelHolder isNil ifTrue:[ |
|
1127 |
cancelLabelHolder := 'Cancel' asValue. |
|
1128 |
]. |
|
1129 |
^ cancelLabelHolder. |
|
1130 |
! |
|
1131 |
||
1132 |
enableBack |
|
4804 | 1133 |
^ treeBrowser enableBack. |
3892 | 1134 |
! |
1135 |
||
1136 |
enableDirectoryUp |
|
4804 | 1137 |
^ treeBrowser enableDirectoryUp. |
3892 | 1138 |
! |
1139 |
||
1140 |
enableForward |
|
4804 | 1141 |
^ treeBrowser enableForward. |
3892 | 1142 |
! |
1143 |
||
1144 |
enableHome |
|
4804 | 1145 |
^ treeBrowser enableHome. |
3892 | 1146 |
! |
1147 |
||
1148 |
filenameHolder |
|
1149 |
"Return a value holder with the filename. |
|
1150 |
Shown in the filename input-field. |
|
1151 |
Being the selection in the tree. |
|
1152 |
" |
|
1153 |
|holder| |
|
1154 |
holder := builder bindingAt:#filenameHolder. |
|
1155 |
||
1156 |
holder ifNil:[ |
|
1157 |
holder := ValueHolder new. |
|
1158 |
holder addDependent:self. |
|
1159 |
builder aspectAt:#filenameHolder |
|
1160 |
put:holder. |
|
1161 |
]. |
|
1162 |
||
1163 |
^ holder. |
|
1164 |
! |
|
1165 |
||
3904 | 1166 |
filenameLabelHolder |
1167 |
"Return a value holder for the input string. |
|
1168 |
" |
|
1169 |
filenameLabelHolder isNil ifTrue:[ |
|
1170 |
filenameLabelHolder := 'Filename:' asValue. |
|
1171 |
]. |
|
1172 |
^ filenameLabelHolder |
|
1173 |
! |
|
1174 |
||
3892 | 1175 |
filterHolder |
4011 | 1176 |
"Return a value holder for filter |
3892 | 1177 |
" |
1178 |
||
1179 |
filterHolder isNil ifTrue:[ |
|
1180 |
filterHolder := treeBrowser filterModel. |
|
1181 |
self pattern notNil ifTrue:[ |
|
1182 |
filterHolder value:pattern. |
|
1183 |
] |
|
1184 |
]. |
|
1185 |
^ filterHolder |
|
1186 |
! |
|
1187 |
||
1188 |
okLabelHolder |
|
1189 |
"automatically generated by UIPainter ..." |
|
1190 |
||
1191 |
"*** the code below creates a default model when invoked." |
|
1192 |
"*** (which may not be the one you wanted)" |
|
1193 |
"*** Please change as required and accept it in the browser." |
|
1194 |
"*** (and replace this comment by something more useful ;-)" |
|
1195 |
||
1196 |
okLabelHolder isNil ifTrue:[ |
|
1197 |
okLabelHolder := 'OK' asValue. |
|
1198 |
]. |
|
1199 |
^ okLabelHolder. |
|
1200 |
! ! |
|
1201 |
||
1202 |
!FileDialog methodsFor:'change & update'! |
|
1203 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1204 |
buttonPanelVisibilityChanged |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1205 |
|filePart buttonPanel| |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1206 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1207 |
filePart := builder componentAt:#FilePart. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1208 |
buttonPanel := builder componentAt:#ButtonPanel. |
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 |
buttonPanelVisibleHolder value ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1211 |
filePart layout bottomOffset:-40 |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1212 |
] ifFalse:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1213 |
filePart layout bottomOffset:0 |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1214 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1215 |
filePart containerChangedSize "/ force resize |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1216 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1217 |
|
3892 | 1218 |
update:something with:aParameter from:changedObject |
4804 | 1219 |
|files newFile newLabel fn| |
3892 | 1220 |
|
1221 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1222 |
files := changedObject value. |
3892 | 1223 |
|
1224 |
(files isEmpty) ifTrue:[ |
|
4804 | 1225 |
newFile := nil. |
3892 | 1226 |
] ifFalse:[ |
1227 |
files size == 1 ifTrue:[ |
|
4804 | 1228 |
newFile := files first. |
3892 | 1229 |
] ifFalse:[ |
4804 | 1230 |
newFile := ''. |
3892 | 1231 |
]. |
1232 |
]. |
|
4804 | 1233 |
self filenameHolder value:newFile withoutNotifying:self. |
3892 | 1234 |
]. |
4804 | 1235 |
|
3904 | 1236 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1237 |
changedObject value ifTrue:[ |
|
4804 | 1238 |
newLabel := 'Filename:'. |
3904 | 1239 |
] ifFalse:[ |
4804 | 1240 |
newLabel := 'Directory:'. |
1241 |
]. |
|
1242 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1243 |
]. |
3892 | 1244 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1245 |
fn := changedObject value asFilename. |
1246 |
(fn exists) ifFalse:[^ self]. |
|
1247 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
|
3892 | 1248 |
]. |
1249 |
^ super update:something with:aParameter from:changedObject |
|
1250 |
! ! |
|
1251 |
||
1252 |
!FileDialog methodsFor:'event handling'! |
|
1253 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1254 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1255 |
"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
|
1256 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1257 |
^ appendWasPressed |
3892 | 1258 |
! ! |
1259 |
||
1260 |
!FileDialog methodsFor:'initialization & release'! |
|
1261 |
||
1262 |
postBuildFileNameField:aWidget |
|
1263 |
||
1264 |
filenameField := aWidget. |
|
1265 |
! |
|
1266 |
||
1267 |
postBuildFilterField:aWidget |
|
1268 |
||
1269 |
filterField := aWidget. |
|
1270 |
! |
|
1271 |
||
1272 |
postBuildTreeBrowser:aSubCanvasView |
|
1273 |
||
1274 |
treeBrowser := aSubCanvasView client. |
|
1275 |
! |
|
1276 |
||
4005
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1277 |
postBuildWith:aBuilder |
4804 | 1278 |
treeBrowser multipleSelect:multipleSelect. |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1279 |
appendWasPressed := false. |
4005
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1280 |
^ super postBuildWith:aBuilder |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1281 |
! |
42f09ac0e0aa
Fix for multipleSelection settings (race condition pops debugger at telekom!)
Stefan Vogel <sv@exept.de>
parents:
3996
diff
changeset
|
1282 |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1283 |
postOpen |
3892 | 1284 |
|
1285 |
"/ 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
|
1286 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1287 |
self window topView isModal ifFalse:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1288 |
self hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1289 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1290 |
|
3892 | 1291 |
treeBrowser currentFileNameHolder addDependent:self. |
3953 | 1292 |
treeBrowser doubleClickAction:(self doubleClickAction). |
3904 | 1293 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
3982 | 1294 |
treeBrowser rootHolder value:((self directory) ? (Filename currentDirectory asAbsoluteFilename)). |
4804 | 1295 |
|
1296 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
|
4796 | 1297 |
treeBrowser viewFilesInDirectoryTree changed. |
1298 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:(self startFilename)). |
|
4804 | 1299 |
|
1300 |
self isLoadDialog ifTrue:[ |
|
4796 | 1301 |
treeBrowser newVisibilityHolder value:false. |
1302 |
treeBrowser allowFileOperations value:false. |
|
1303 |
self newDirectoryVisibilityHolder value:false. |
|
1304 |
]. |
|
1305 |
self filenameHolder value:(self startFilename). |
|
1306 |
self window label:(resources string:((self initialText) ? 'File Dialog')). |
|
1307 |
! |
|
1308 |
||
1309 |
postOpenAsSubcanvasWith:aBuilder |
|
1310 |
self postOpen. |
|
1311 |
^ super postOpenAsSubcanvasWith:aBuilder |
|
1312 |
! |
|
1313 |
||
1314 |
postOpenWith:aBuilder |
|
1315 |
||
1316 |
self postOpen. |
|
1317 |
^ super postOpenWith:aBuilder. |
|
1318 |
! ! |
|
1319 |
||
1320 |
!FileDialog methodsFor:'private'! |
|
1321 |
||
1322 |
returnWasPressedInFilterField |
|
1323 |
|ev| |
|
1324 |
||
1325 |
ev := self windowGroup lastEvent. |
|
1326 |
(ev notNil |
|
1327 |
and:[ev isKeyEvent |
|
1328 |
and:[ev key == #Return |
|
1329 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1330 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1331 |
^ true |
|
1332 |
]. |
|
1333 |
^ false |
|
1334 |
! |
|
1335 |
||
1336 |
returnWasPressedInFilterOrFilenameField |
|
1337 |
|ev| |
|
1338 |
||
1339 |
ev := self windowGroup lastEvent. |
|
1340 |
(ev notNil |
|
1341 |
and:[ev isKeyEvent |
|
1342 |
and:[ev key == #Return |
|
1343 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1344 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1345 |
^ true |
|
1346 |
]. |
|
1347 |
^ false |
|
1348 |
! ! |
|
1349 |
||
1350 |
!FileDialog methodsFor:'user actions'! |
|
1351 |
||
1352 |
appendPressed |
|
1353 |
appendWasPressed := true. |
|
1354 |
self commonAcceptAction. |
|
1355 |
! |
|
1356 |
||
1357 |
commonAcceptAction |
|
1358 |
filenameField accept. |
|
1359 |
self result:(self filenameHolder value asString). |
|
1360 |
||
1361 |
^ super doAccept |
|
1362 |
! |
|
1363 |
||
1364 |
doAccept |
|
1365 |
"force accept - ignore in filterField" |
|
1366 |
||
1367 |
self returnWasPressedInFilterField ifTrue:[ |
|
1368 |
^ self |
|
1369 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1370 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1371 |
"/ 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
|
1372 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1373 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1374 |
]. |
4796 | 1375 |
appendWasPressed := false. |
1376 |
self commonAcceptAction. |
|
1377 |
! |
|
1378 |
||
1379 |
doBack |
|
1380 |
||
1381 |
treeBrowser doBack. |
|
1382 |
! |
|
1383 |
||
1384 |
doCancel |
|
1385 |
||
1386 |
self result:nil. |
|
1387 |
^ super doCancel. |
|
1388 |
! |
|
1389 |
||
1390 |
doForward |
|
1391 |
||
1392 |
treeBrowser doForward. |
|
1393 |
! |
|
1394 |
||
1395 |
doGoDirectoryUp |
|
1396 |
||
1397 |
treeBrowser doGoDirectoryUp. |
|
1398 |
! |
|
1399 |
||
1400 |
doGotoHomeDirectory |
|
1401 |
||
1402 |
treeBrowser doGotoHomeDirectory. |
|
1403 |
! |
|
1404 |
||
1405 |
menuDirHistory:backOrForward |
|
1406 |
||
1407 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1408 |
! |
|
1409 |
||
1410 |
menuDirHistoryBack |
|
1411 |
||
1412 |
^ treeBrowser menuDirHistory:#back. |
|
1413 |
! |
|
1414 |
||
1415 |
menuDirHistoryForward |
|
1416 |
||
1417 |
^ treeBrowser menuDirHistory:#forward. |
|
1418 |
! |
|
1419 |
||
1420 |
newDirectory |
|
1421 |
||
1422 |
^ treeBrowser newDirectory |
|
1423 |
! |
|
1424 |
||
1425 |
okPressed |
|
1426 |
self doAccept |
|
1427 |
! ! |
|
1428 |
||
1429 |
!FileDialog class methodsFor:'documentation'! |
|
1430 |
||
1431 |
version |
|
5375 | 1432 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.51 2003-11-24 19:59:49 stefan Exp $' |
4796 | 1433 |
! ! |