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