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