author | Claus Gittinger <cg@exept.de> |
Wed, 08 Jul 2009 13:49:16 +0200 | |
changeset 8661 | 086147f751d0 |
parent 8586 | 46504ccbcc93 |
child 8663 | 22e0a2969ab2 |
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 |
" |
|
8250 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
3892 | 14 |
SimpleDialog subclass:#FileDialog |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
15 |
instanceVariableNames:'aspects treeBrowser directory pattern filterHolder initialText |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
16 |
multipleSelect doubleClickAction cancelLabelHolder okLabelHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
17 |
startFilename result filterField filenameField viewFiles |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
18 |
filenameLabelHolder isLoadDialog newDirectoryVisibilityHolder |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
19 |
appendButtonVisibleHolder appendWasPressed |
6065 | 20 |
buttonPanelVisibleHolder appendLabelHolder browseVisibleHolder |
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
21 |
selectedDeviceDrive listOfDeviceDrives rootDirectoryHolder' |
5931 | 22 |
classVariableNames:'LastExtent' |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
23 |
poolDictionaries:'' |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
24 |
category:'Interface-Tools-File' |
3892 | 25 |
! |
26 |
||
27 |
!FileDialog class methodsFor:'documentation'! |
|
28 |
||
5140 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
3892 | 43 |
documentation |
44 |
" |
|
45 |
documentation to be added. |
|
46 |
||
47 |
[author:] |
|
48 |
Martin Walser (martin@vercingetorix) |
|
49 |
||
50 |
[instance variables:] |
|
51 |
||
52 |
[class variables:] |
|
53 |
||
54 |
[see also:] |
|
55 |
||
56 |
" |
|
57 |
! |
|
58 |
||
59 |
examples |
|
60 |
" |
|
61 |
[exBegin] |
|
62 |
FileDialog open |
|
63 |
[exEnd] |
|
64 |
||
65 |
[exBegin] |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
66 |
FileDialog |
4804 | 67 |
requestFileName:'enter a fileName:' |
68 |
default:'' |
|
69 |
version:nil |
|
70 |
ifFail:['none'] |
|
71 |
pattern:'*.conf' |
|
72 |
fromDirectory:'/etc' |
|
73 |
whenBoxCreatedEvaluate:nil. |
|
74 |
[exEnd] |
|
75 |
[exBegin] |
|
76 |
|fd| |
|
77 |
||
78 |
fd := FileDialog new. |
|
79 |
fd multipleSelect:true. |
|
80 |
fd open |
|
3892 | 81 |
[exEnd] |
82 |
" |
|
5062 | 83 |
! |
84 |
||
85 |
todo |
|
86 |
" |
|
87 |
- make the filedialog windows like f |
|
88 |
filename entry field shows only the filename not the whole directory |
|
89 |
the tree allways starts in currrent directory |
|
90 |
the parent tree is shown in a compobox where the perents are selectable |
|
91 |
- do not expand the ~ or relative pathnames to absolute pathnames |
|
92 |
" |
|
3892 | 93 |
! ! |
94 |
||
95 |
!FileDialog class methodsFor:'instance creation'! |
|
96 |
||
97 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
|
98 |
"same as requestFileName, but only show directories" |
|
99 |
||
4795 | 100 |
^ self |
101 |
requestDirectoryName:title |
|
102 |
default:aFileName |
|
103 |
ok:nil |
|
104 |
abort:nil |
|
105 |
version:nil |
|
106 |
pattern:nil |
|
107 |
fromDirectory:nil |
|
108 |
ifFail:failBlock |
|
109 |
whenBoxCreatedEvaluate:nil |
|
110 |
asLoadDialog:nil. |
|
3892 | 111 |
|
112 |
" |
|
3904 | 113 |
FileDialog |
3892 | 114 |
requestDirectoryName:'which directory ?' |
4627 | 115 |
default:Filename currentDirectory pathName |
3892 | 116 |
ifFail:'none' |
117 |
" |
|
118 |
! |
|
119 |
||
5336 | 120 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
121 |
"same as requestFileName, but only show directories" |
|
122 |
||
123 |
^ self |
|
124 |
requestDirectoryName:title |
|
125 |
default:aFileName |
|
126 |
ok:okText |
|
127 |
abort:abortText |
|
128 |
version:nil |
|
129 |
pattern:nil |
|
130 |
fromDirectory:nil |
|
131 |
ifFail:failBlock |
|
132 |
whenBoxCreatedEvaluate:nil |
|
133 |
asLoadDialog:nil. |
|
134 |
||
135 |
" |
|
136 |
FileDialog |
|
137 |
requestDirectoryName:'which directory ?' |
|
138 |
default:Filename currentDirectory pathName |
|
139 |
ok:'Yes' |
|
140 |
abort:'No' |
|
141 |
ifFail:'none' |
|
142 |
" |
|
143 |
! |
|
144 |
||
5823 | 145 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
146 |
"same as requestFileName, but only show directories" |
|
147 |
||
148 |
^ self |
|
149 |
requestDirectoryName:title |
|
150 |
default:aFileName |
|
151 |
ok:okText |
|
152 |
abort:abortText |
|
153 |
version:nil |
|
154 |
pattern:nil |
|
155 |
fromDirectory:nil |
|
156 |
ifFail:failBlock |
|
157 |
whenBoxCreatedEvaluate:[:box|box doubleClickAction:[:index|box doAccept]] |
|
158 |
asLoadDialog:nil. |
|
159 |
||
160 |
" |
|
161 |
FileDialog |
|
162 |
requestDirectoryName:'which directory ?' |
|
163 |
default:Filename currentDirectory pathName |
|
164 |
ok:'Yes' |
|
165 |
abort:'No' |
|
166 |
ifFail:'none' |
|
167 |
" |
|
168 |
! |
|
169 |
||
3956 | 170 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
3892 | 171 |
"same as requestFileName, but only show directories" |
172 |
||
3956 | 173 |
|enteredFileName instance enteredFileNameString| |
3892 | 174 |
|
4795 | 175 |
instance := self |
176 |
startApplicationFor:titleString |
|
177 |
default:aFileName |
|
178 |
ok:okText |
|
179 |
abort:abortText |
|
180 |
ifFail:failBlock |
|
181 |
pattern:pattern |
|
182 |
fromDirectory:aDirectoryPath |
|
183 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
184 |
asLoadDialog:aBoolean |
|
5329 | 185 |
viewFiles:false |
4795 | 186 |
multipleSelect:false. |
3892 | 187 |
|
188 |
enteredFileNameString := instance result. |
|
189 |
enteredFileNameString isNil ifTrue:[ |
|
190 |
^ failBlock value |
|
191 |
]. |
|
192 |
enteredFileName := enteredFileNameString asFilename. |
|
193 |
enteredFileNameString := enteredFileName asString. |
|
194 |
(enteredFileName notNil |
|
195 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
196 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
|
197 |
versionSymbol == #mustBeNew ifTrue:[ |
|
198 |
"/ file may not exist |
|
199 |
enteredFileName exists ifTrue:[^ '']. |
|
200 |
]. |
|
201 |
versionSymbol == #new ifTrue:[ |
|
202 |
"/ file may not exist |
|
203 |
enteredFileName exists ifTrue:[ |
|
6356 | 204 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 205 |
ifFalse:[^ '']. |
206 |
]. |
|
207 |
]. |
|
208 |
versionSymbol == #mustBeOld ifTrue:[ |
|
209 |
enteredFileName exists ifFalse:[^ '']. |
|
210 |
]. |
|
211 |
versionSymbol == #old ifTrue:[ |
|
212 |
"/ file may not exist |
|
213 |
enteredFileName exists ifFalse:[ |
|
6356 | 214 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 215 |
ifFalse:[^ '']. |
216 |
]. |
|
217 |
]. |
|
218 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileNameString). |
|
219 |
]. |
|
220 |
^ enteredFileNameString |
|
221 |
||
222 |
" |
|
223 |
FileDialog |
|
224 |
requestDirectoryName:'which directory ?' |
|
4627 | 225 |
default:Filename currentDirectory pathName |
3892 | 226 |
ifFail:nil |
227 |
" |
|
3956 | 228 |
" |
229 |
FileDialog |
|
230 |
requestDirectoryName:'which directory ?' |
|
4627 | 231 |
default:Filename currentDirectory pathName |
3956 | 232 |
ok:nil |
233 |
abort:nil |
|
234 |
version:nil |
|
235 |
pattern:nil |
|
236 |
fromDirectory:nil |
|
237 |
ifFail:nil |
|
238 |
whenBoxCreatedEvaluate:nil |
|
239 |
asLoadDialog:true |
|
240 |
" |
|
3892 | 241 |
! |
242 |
||
5336 | 243 |
requestDirectoryName:title default:aFileName ok:okText ifFail:failBlock |
244 |
"same as requestFileName, but only show directories" |
|
245 |
||
246 |
^ self |
|
247 |
requestDirectoryName:title |
|
248 |
default:aFileName |
|
249 |
ok:okText |
|
250 |
abort:nil |
|
251 |
version:nil |
|
252 |
pattern:nil |
|
253 |
fromDirectory:nil |
|
254 |
ifFail:failBlock |
|
255 |
whenBoxCreatedEvaluate:nil |
|
256 |
asLoadDialog:nil. |
|
257 |
||
258 |
" |
|
259 |
FileDialog |
|
260 |
requestDirectoryName:'which directory ?' |
|
261 |
default:Filename currentDirectory pathName |
|
262 |
ok:'Yes' |
|
263 |
ifFail:'none' |
|
264 |
" |
|
265 |
! |
|
266 |
||
3892 | 267 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
268 |
||
4795 | 269 |
^ self |
270 |
requestFileName:titleString |
|
271 |
default:defaultName |
|
272 |
ok:okText |
|
273 |
abort:abortText |
|
274 |
version:nil |
|
275 |
ifFail:nil |
|
276 |
pattern:pattern |
|
277 |
fromDirectory:aDirectoryPathOrNil |
|
278 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 279 |
! |
280 |
||
281 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
282 |
"launch a Dialog, which allows user to enter a filename. |
|
283 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
284 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
285 |
The box will show okText in its okButton, abortText in the abortButton. |
|
286 |
The matchPattern is set to pattern initially. |
|
287 |
Return the string, or nil if cancel was pressed |
|
288 |
The version argument allows validation of the files existance; |
|
289 |
it may be any of: |
|
290 |
#mustBeNew - fail (return empty string) if the file exists |
|
291 |
#new - confirm if the file exists |
|
292 |
#mustBeOld - fail if the file does not exist |
|
293 |
#old - confirm if the file does not exist |
|
294 |
#any (other) - no validation |
|
295 |
" |
|
296 |
||
4795 | 297 |
^ self |
298 |
requestFileName:titleString |
|
299 |
default:defaultName |
|
300 |
ok:okText |
|
301 |
abort:abortText |
|
302 |
version:versionSymbol |
|
303 |
ifFail:failBlock |
|
304 |
pattern:pattern |
|
305 |
fromDirectory:aDirectoryPath |
|
306 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
307 |
asLoadDialog:nil |
|
3956 | 308 |
! |
309 |
||
310 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
|
311 |
"launch a Dialog, which allows user to enter a filename. |
|
312 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
313 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
314 |
The box will show okText in its okButton, abortText in the abortButton. |
|
315 |
The matchPattern is set to pattern initially. |
|
316 |
Return the string, or nil if cancel was pressed |
|
317 |
The version argument allows validation of the files existance; |
|
318 |
it may be any of: |
|
319 |
#mustBeNew - fail (return empty string) if the file exists |
|
320 |
#new - confirm if the file exists |
|
321 |
#mustBeOld - fail if the file does not exist |
|
322 |
#old - confirm if the file does not exist |
|
323 |
#any (other) - no validation |
|
324 |
" |
|
325 |
||
3892 | 326 |
|
3904 | 327 |
| instance enteredFileName enteredFileNameString| |
3892 | 328 |
|
4795 | 329 |
instance := self |
330 |
startApplicationFor:titleString |
|
331 |
default:defaultName |
|
332 |
ok:okText |
|
333 |
abort:abortText |
|
334 |
ifFail:failBlock |
|
335 |
pattern:pattern |
|
336 |
fromDirectory:aDirectoryPath |
|
337 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
338 |
asLoadDialog:aBoolean |
|
5329 | 339 |
viewFiles:true |
4795 | 340 |
multipleSelect:false. |
3892 | 341 |
|
342 |
enteredFileNameString := instance result. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
343 |
(enteredFileNameString isEmptyOrNil) ifTrue:[ |
3892 | 344 |
^ failBlock value |
345 |
]. |
|
346 |
enteredFileName := enteredFileNameString asFilename. |
|
5867 | 347 |
enteredFileNameString := enteredFileName asString. |
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
348 |
|
3892 | 349 |
(enteredFileName notNil |
350 |
and:[enteredFileNameString notEmpty]) ifTrue:[ |
|
4666 | 351 |
FileSelectionBox lastFileSelectionDirectory:(enteredFileName directoryName). |
3892 | 352 |
versionSymbol isNil ifTrue:[ ^ enteredFileNameString]. |
353 |
versionSymbol == #mustBeNew ifTrue:[ |
|
354 |
"/ file may not exist |
|
355 |
enteredFileName exists ifTrue:[^ '']. |
|
356 |
]. |
|
357 |
versionSymbol == #new ifTrue:[ |
|
358 |
"/ file may not exist |
|
359 |
enteredFileName exists ifTrue:[ |
|
6356 | 360 |
(Dialog confirm:(self classResources stringWithCRs:'''%1'' exists.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 361 |
ifFalse:[^ '']. |
362 |
]. |
|
363 |
]. |
|
364 |
versionSymbol == #mustBeOld ifTrue:[ |
|
365 |
enteredFileName exists ifFalse:[^ '']. |
|
366 |
]. |
|
367 |
versionSymbol == #old ifTrue:[ |
|
368 |
"/ file may not exist |
|
369 |
enteredFileName exists ifFalse:[ |
|
6356 | 370 |
(self confirm:(self classResources stringWithCRs:'''%1'' does not exist yet.\\Continue anyway ?' with:enteredFileNameString)) |
3892 | 371 |
ifFalse:[^ '']. |
372 |
]. |
|
373 |
]. |
|
374 |
]. |
|
375 |
^ enteredFileNameString |
|
3956 | 376 |
" |
377 |
FileDialog |
|
378 |
requestFileName:'enter a fileName:' |
|
379 |
default:'' |
|
380 |
ok:nil |
|
381 |
abort:nil |
|
382 |
version:nil |
|
383 |
ifFail:['none'] |
|
5858
d5648b365b8d
returns construct with defaultName if directory selected on requestFilename
penk
parents:
5853
diff
changeset
|
384 |
pattern:'*' |
4627 | 385 |
fromDirectory:Filename currentDirectory pathName |
3956 | 386 |
whenBoxCreatedEvaluate:nil |
387 |
asLoadDialog:true |
|
388 |
" |
|
3892 | 389 |
! |
390 |
||
391 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
392 |
||
4795 | 393 |
^ self |
394 |
requestFileName:titleString |
|
395 |
default:defaultName |
|
396 |
ok:nil |
|
397 |
abort:nil |
|
398 |
version:versionSymbol |
|
399 |
ifFail:failBlock |
|
400 |
pattern:pattern |
|
401 |
fromDirectory:aDirectoryPathOrNil |
|
402 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3892 | 403 |
|
404 |
" |
|
405 |
FileDialog |
|
406 |
requestFileName:'enter a fileName:' |
|
407 |
default:'' |
|
408 |
version:nil |
|
409 |
ifFail:['none'] |
|
410 |
pattern:'*.conf' |
|
4627 | 411 |
fromDirectory:Filename currentDirectory pathName |
3892 | 412 |
whenBoxCreatedEvaluate:nil. |
413 |
Dialog |
|
414 |
requestFileName:'enter a fileName:' |
|
415 |
default:'' |
|
416 |
version:nil |
|
417 |
ifFail:['none'] |
|
418 |
pattern:'*.conf' |
|
4627 | 419 |
fromDirectory:Filename currentDirectory pathName |
3892 | 420 |
whenBoxCreatedEvaluate:nil |
421 |
" |
|
422 |
" |
|
423 |
FileDialog |
|
424 |
requestFileName:'enter a fileName:' |
|
425 |
default:'' |
|
426 |
version:#old |
|
427 |
ifFail:['none'] |
|
428 |
pattern:'*.conf' |
|
4627 | 429 |
fromDirectory:Filename currentDirectory pathName |
3892 | 430 |
whenBoxCreatedEvaluate:nil |
431 |
" |
|
432 |
" |
|
433 |
FileDialog |
|
434 |
requestFileName:'enter a fileName:' |
|
435 |
default:'' |
|
436 |
version:#mustBeNew |
|
437 |
ifFail:['none'] |
|
438 |
pattern:'*.conf' |
|
4627 | 439 |
fromDirectory:Filename currentDirectory pathName |
3892 | 440 |
whenBoxCreatedEvaluate:nil |
441 |
" |
|
3904 | 442 |
! |
443 |
||
444 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
445 |
"launch a Dialog, which allows user to enter a filename. |
|
446 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
447 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
448 |
The box will show okText in its okButton, abortText in the abortButton. |
|
449 |
The matchPattern is set to pattern initially. |
|
3905 | 450 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
3904 | 451 |
" |
452 |
||
453 |
||
4795 | 454 |
^ self |
455 |
requestFileNames:titleString |
|
456 |
default:defaultName |
|
457 |
ok:okText |
|
458 |
abort:abortText |
|
459 |
ifFail:failBlock |
|
460 |
pattern:pattern |
|
461 |
fromDirectory:aDirectoryPath |
|
462 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
463 |
asLoadDialog:nil. |
|
3956 | 464 |
|
465 |
||
466 |
" |
|
467 |
FileDialog |
|
468 |
requestFileNames:'enter a fileName:' |
|
469 |
default:'' |
|
470 |
ok:nil |
|
471 |
abort:nil |
|
472 |
ifFail:['none'] |
|
473 |
pattern:'*.conf' |
|
4627 | 474 |
fromDirectory:Filename currentDirectory pathName |
3956 | 475 |
whenBoxCreatedEvaluate:nil. |
476 |
" |
|
477 |
! |
|
478 |
||
479 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
|
480 |
"launch a Dialog, which allows user to enter a filename. |
|
481 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
482 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
483 |
The box will show okText in its okButton, abortText in the abortButton. |
|
484 |
The matchPattern is set to pattern initially. |
|
485 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
486 |
" |
|
487 |
||
488 |
||
3904 | 489 |
| instance enteredFileNames lastDirectory| |
490 |
||
4795 | 491 |
instance := self |
492 |
startApplicationFor:titleString |
|
493 |
default:defaultName |
|
494 |
ok:okText |
|
495 |
abort:abortText |
|
496 |
ifFail:failBlock |
|
497 |
pattern:pattern |
|
498 |
fromDirectory:aDirectoryPath |
|
499 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
500 |
asLoadDialog:asLoadDialog |
|
5329 | 501 |
viewFiles:true |
4795 | 502 |
multipleSelect:true. |
3904 | 503 |
|
3996 | 504 |
enteredFileNames := instance currentSelectedFiles. |
3904 | 505 |
(enteredFileNames isEmpty or:[instance result isNil]) ifTrue:[ |
506 |
^ failBlock value |
|
507 |
]. |
|
508 |
lastDirectory := enteredFileNames first. |
|
509 |
lastDirectory := lastDirectory isFilename ifTrue:[lastDirectory directory] ifFalse:[lastDirectory]. |
|
510 |
FileSelectionBox lastFileSelectionDirectory:(lastDirectory directoryName). |
|
511 |
^ enteredFileNames |
|
512 |
||
513 |
" |
|
514 |
FileDialog |
|
515 |
requestFileNames:'enter a fileName:' |
|
516 |
default:'' |
|
517 |
ok:nil |
|
518 |
abort:nil |
|
519 |
ifFail:['none'] |
|
520 |
pattern:'*.conf' |
|
4627 | 521 |
fromDirectory:Filename currentDirectory pathName |
3956 | 522 |
whenBoxCreatedEvaluate:nil |
523 |
asLoadDialog:true. |
|
3904 | 524 |
" |
525 |
! |
|
526 |
||
5790 | 527 |
startApplicationFor:titleString default:initialDefaultFileNameArg ok:okTextArg abort:abortTextArg ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog viewFiles:viewFiles multipleSelect:multipleSelect |
3904 | 528 |
"launch a Dialog, which allows user to enter a filename. |
529 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
530 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
531 |
The box will show okText in its okButton, abortText in the abortButton. |
|
532 |
The matchPattern is set to pattern initially. |
|
533 |
Return the string, or nil if cancel was pressed |
|
534 |
The version argument allows validation of the files existance; |
|
535 |
it may be any of: |
|
536 |
#mustBeNew - fail (return empty string) if the file exists |
|
537 |
#new - confirm if the file exists |
|
538 |
#mustBeOld - fail if the file does not exist |
|
539 |
#old - confirm if the file does not exist |
|
540 |
#any (other) - no validation |
|
541 |
" |
|
542 |
||
543 |
||
5790 | 544 |
|defaultDir instance defaultFile okText abortText initialDefaultFileName| |
545 |
||
546 |
initialDefaultFileName := initialDefaultFileNameArg. |
|
547 |
initialDefaultFileName notNil ifTrue:[ |
|
548 |
initialDefaultFileName := initialDefaultFileName asFilename |
|
549 |
]. |
|
5163 | 550 |
|
551 |
okText := okTextArg. |
|
552 |
okText isNil ifTrue:[ okText := self resources string:'OK' ]. |
|
553 |
abortText := abortTextArg. |
|
554 |
abortText isNil ifTrue:[ abortText := self resources string:'Cancel' ]. |
|
3904 | 555 |
|
556 |
defaultDir := aDirectoryPath. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
557 |
"/ defaultDir isNil ifTrue:[ |
5790 | 558 |
"/ (initialDefaultFileName size > 0 and:[initialDefaultFileName exists]) ifTrue:[ |
559 |
"/ defaultDir := initialDefaultFileName asAbsoluteFilename directory. |
|
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
560 |
"/ ] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
561 |
"/ defaultDir := FileSelectionBox lastFileSelectionDirectory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
562 |
"/ defaultDir isNil ifTrue:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
563 |
"/ defaultDir := Filename currentDirectory asAbsoluteFilename. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
564 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
565 |
"/ defaultDir asFilename exists ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
566 |
"/ defaultDir := nil |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
567 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
568 |
"/ ] |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
569 |
"/ ]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
570 |
(initialDefaultFileName notNil |
5790 | 571 |
and:[initialDefaultFileName isAbsolute |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
572 |
and:[true "initialDefaultFileName asFilename exists"]]) ifTrue:[ |
5790 | 573 |
defaultDir := initialDefaultFileName asAbsoluteFilename. |
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
574 |
true "viewFiles" ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
575 |
defaultFile := defaultDir asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
576 |
defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
577 |
]. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
578 |
] ifFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
579 |
defaultDir isNil ifTrue:[ |
5193 | 580 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
581 |
defaultDir isNil ifTrue:[ |
|
582 |
defaultDir := Filename currentDirectory asAbsoluteFilename. |
|
583 |
]. |
|
5188
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
584 |
defaultDir asFilename exists ifFalse:[ |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
585 |
defaultDir := nil |
283a77f6efe2
care for non-existing initial dir.
Claus Gittinger <cg@exept.de>
parents:
5173
diff
changeset
|
586 |
]. |
3956 | 587 |
] |
3904 | 588 |
]. |
4206 | 589 |
defaultDir := defaultDir asFilename asAbsoluteFilename. |
5220
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
590 |
"/ [defaultDir exists] whileFalse:[ |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
591 |
"/ defaultDir := defaultDir directory. |
1de409e5ea52
initial text overwrites given directoryPath
Claus Gittinger <cg@exept.de>
parents:
5193
diff
changeset
|
592 |
"/ ]. |
5066
57de46852214
Do not select '/tmp/tmp' if '/tmp' is given as default directory
Stefan Vogel <sv@exept.de>
parents:
5062
diff
changeset
|
593 |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
594 |
defaultFile isNil ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
595 |
viewFiles ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
596 |
defaultFile := defaultDir asAbsoluteFilename. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
597 |
] ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
598 |
(initialDefaultFileName notNil and:[initialDefaultFileName withoutSuffix baseName ~= '*']) ifTrue:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
599 |
defaultFile := defaultDir construct:initialDefaultFileName baseName. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
600 |
] ifFalse:[ |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
601 |
defaultFile := defaultDir. |
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
602 |
]. |
3956 | 603 |
]. |
3904 | 604 |
]. |
3956 | 605 |
|
3904 | 606 |
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
|
607 |
defaultDir notNil ifTrue:[instance directory:defaultDir]. |
3958 | 608 |
instance multipleSelect:multipleSelect ? false. |
3904 | 609 |
instance startFilename:defaultFile. |
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6462
diff
changeset
|
610 |
instance pattern:((pattern isEmptyOrNil) ifTrue:['*'] ifFalse:[pattern]). |
3904 | 611 |
instance initialText:titleString. |
612 |
instance okLabelHolder value:okText. |
|
613 |
instance cancelLabelHolder value:abortText. |
|
5571
333ee892a087
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
5375
diff
changeset
|
614 |
|
4804 | 615 |
instance beLoadDialog:asLoadDialog ? false. |
5329 | 616 |
instance viewFiles:viewFiles ? true. |
3953 | 617 |
self setDoubleClickActionFor:instance. |
3904 | 618 |
instance allButOpenInterface:#windowSpec. |
619 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:instance]. |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
620 |
|
8661
086147f751d0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8586
diff
changeset
|
621 |
"/ Dialog aboutToOpenBoxNotificationSignal raiseRequestWith:instance. |
7571 | 622 |
instance treeBrowser sortCaselessInTreeBrowser value: (Filename isCaseSensitive not). |
3904 | 623 |
instance openWindowModal. |
624 |
^ instance |
|
6953
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
625 |
|
651025031ea2
initial tree-selection when selecting a directory changed.
Claus Gittinger <cg@exept.de>
parents:
6728
diff
changeset
|
626 |
"Modified: / 23-08-2006 / 12:24:54 / cg" |
7571 | 627 |
"Modified: / 13-12-2006 / 16:25:42 / User" |
3892 | 628 |
! ! |
629 |
||
630 |
!FileDialog class methodsFor:'accessing'! |
|
631 |
||
6650 | 632 |
classResources |
633 |
^ AbstractFileBrowser classResources |
|
634 |
! |
|
635 |
||
5931 | 636 |
lastExtent |
637 |
^ LastExtent |
|
638 |
! |
|
639 |
||
640 |
lastExtent:anExtent |
|
641 |
LastExtent := anExtent |
|
642 |
! |
|
643 |
||
3953 | 644 |
setDoubleClickActionFor:instance |
645 |
||
646 |
instance doubleClickAction:[:anIndex| |
|
647 |
| item | |
|
648 |
item := instance treeBrowser fileList at:anIndex ifAbsent:nil. |
|
649 |
item notNil ifTrue:[ |
|
5329 | 650 |
(instance viewFiles and:[item isDirectory not]) ifTrue:[ |
3953 | 651 |
instance doAccept. |
652 |
] |
|
653 |
] |
|
654 |
]. |
|
3892 | 655 |
! ! |
656 |
||
8585 | 657 |
!FileDialog class methodsFor:'help specs'! |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
658 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
659 |
flyByHelpSpec |
8585 | 660 |
"This resource specification was automatically generated |
661 |
by the UIHelpTool of ST/X." |
|
662 |
||
663 |
"Do not manually edit this!! If it is corrupted, |
|
664 |
the UIHelpTool may not be able to read the specification." |
|
665 |
||
666 |
" |
|
667 |
UIHelpTool openOnClass:FileDialog |
|
668 |
" |
|
669 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
670 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
671 |
|
8585 | 672 |
^ FileBrowserV2 flyByHelpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
673 |
|
8585 | 674 |
#openFileBrowser |
675 |
'Open a FileBrowser on the selected Directory' |
|
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
676 |
|
8585 | 677 |
) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
678 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
679 |
|
3892 | 680 |
!FileDialog class methodsFor:'interface specs'! |
681 |
||
682 |
windowSpec |
|
683 |
"This resource specification was automatically generated |
|
684 |
by the UIPainter of ST/X." |
|
685 |
||
686 |
"Do not manually edit this!! If it is corrupted, |
|
687 |
the UIPainter may not be able to read the specification." |
|
688 |
||
689 |
" |
|
690 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
691 |
FileDialog new openInterface:#windowSpec |
|
692 |
FileDialog open |
|
693 |
" |
|
694 |
||
695 |
<resource: #canvas> |
|
696 |
||
697 |
^ |
|
5229 | 698 |
#(FullSpec |
699 |
name: windowSpec |
|
700 |
window: |
|
701 |
(WindowSpec |
|
702 |
label: 'FileDialog' |
|
703 |
name: 'FileDialog' |
|
704 |
min: (Point 10 10) |
|
705 |
max: (Point 1024 768) |
|
5873 | 706 |
bounds: (Rectangle 0 0 407 400) |
3892 | 707 |
) |
5229 | 708 |
component: |
709 |
(SpecCollection |
|
710 |
collection: ( |
|
711 |
(ViewSpec |
|
712 |
name: 'FilePart' |
|
713 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
714 |
component: |
|
715 |
(SpecCollection |
|
716 |
collection: ( |
|
717 |
(MenuPanelSpec |
|
718 |
name: 'ToolBar1' |
|
8250 | 719 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0) |
5229 | 720 |
tabable: true |
721 |
menu: toolBarMenu |
|
722 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
723 |
) |
5229 | 724 |
(VariableHorizontalPanelSpec |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
725 |
name: 'DeviceAndFilterPanel' |
8250 | 726 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0) |
5229 | 727 |
level: 1 |
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
728 |
showHandle: true |
5229 | 729 |
component: |
730 |
(SpecCollection |
|
731 |
collection: ( |
|
732 |
(ViewSpec |
|
733 |
name: 'Box1' |
|
6065 | 734 |
component: |
735 |
(SpecCollection |
|
736 |
collection: ( |
|
737 |
(ComboListSpec |
|
738 |
name: 'ComboList1' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
739 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1) |
6065 | 740 |
visibilityChannel: driveSelectorVisible |
741 |
model: selectedDeviceDrive |
|
742 |
comboList: listOfDeviceDrives |
|
743 |
useIndex: false |
|
744 |
hidePullDownMenuButton: false |
|
745 |
) |
|
746 |
) |
|
747 |
||
748 |
) |
|
4804 | 749 |
) |
5229 | 750 |
(ViewSpec |
751 |
name: 'Box2' |
|
752 |
component: |
|
753 |
(SpecCollection |
|
754 |
collection: ( |
|
755 |
(LabelSpec |
|
756 |
label: 'Filter:' |
|
757 |
name: 'FilterLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
758 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1) |
5229 | 759 |
translateLabel: true |
760 |
adjust: right |
|
4804 | 761 |
) |
5229 | 762 |
(InputFieldSpec |
763 |
name: 'FilterEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
764 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1) |
5229 | 765 |
model: filterHolder |
766 |
immediateAccept: true |
|
767 |
acceptOnReturn: true |
|
768 |
acceptOnTab: true |
|
769 |
acceptOnLostFocus: true |
|
770 |
acceptOnPointerLeave: false |
|
771 |
postBuildCallback: postBuildFilterField: |
|
4804 | 772 |
) |
773 |
) |
|
774 |
||
775 |
) |
|
776 |
) |
|
777 |
) |
|
778 |
||
779 |
) |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
780 |
handles: (Any 0.18427518427518 1.0) |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
781 |
) |
8250 | 782 |
(SubCanvasSpec |
783 |
name: 'DirectoryTreeBrowser' |
|
784 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -30 1) |
|
785 |
tabable: true |
|
786 |
hasHorizontalScrollBar: false |
|
787 |
hasVerticalScrollBar: false |
|
788 |
majorKey: DirectoryTreeBrowser |
|
789 |
subAspectHolders: |
|
790 |
(Array |
|
791 |
||
792 |
(SubChannelInfoSpec |
|
793 |
subAspect: filterModel |
|
794 |
aspect: filterHolder |
|
795 |
) |
|
796 |
(SubChannelInfoSpec |
|
797 |
subAspect: rootHolder |
|
798 |
aspect: rootDirectoryHolder |
|
799 |
) |
|
800 |
) |
|
801 |
createNewApplication: true |
|
802 |
createNewBuilder: true |
|
803 |
postBuildCallback: postBuildTreeBrowser: |
|
804 |
) |
|
5230 | 805 |
(LabelSpec |
806 |
label: 'Filename:' |
|
807 |
name: 'FilenameLabel' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
808 |
layout: (LayoutFrame 3 0 -25 1 73 0 -1 1) |
5230 | 809 |
translateLabel: true |
810 |
labelChannel: filenameLabelHolder |
|
811 |
adjust: left |
|
812 |
) |
|
813 |
(FilenameInputFieldSpec |
|
814 |
name: 'FilenameEntryField' |
|
7919
6da8791c2e93
geometry (make underline visible); variable panel handle
fm
parents:
7581
diff
changeset
|
815 |
layout: (LayoutFrame 70 0 -25 1 -4 1 -1 1) |
5230 | 816 |
tabable: true |
817 |
model: filenameHolder |
|
818 |
immediateAccept: false |
|
819 |
acceptOnPointerLeave: false |
|
5853 | 820 |
hasKeyboardFocusInitially: true |
5230 | 821 |
postBuildCallback: postBuildFileNameField: |
822 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
823 |
) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
824 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
825 |
) |
3892 | 826 |
) |
5229 | 827 |
(HorizontalPanelViewSpec |
828 |
name: 'ButtonPanel' |
|
829 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
830 |
visibilityChannel: buttonPanelVisibleHolder |
|
831 |
horizontalLayout: fitSpace |
|
832 |
verticalLayout: center |
|
833 |
horizontalSpace: 3 |
|
834 |
verticalSpace: 3 |
|
835 |
reverseOrderIfOKAtLeft: true |
|
836 |
component: |
|
837 |
(SpecCollection |
|
838 |
collection: ( |
|
839 |
(ActionButtonSpec |
|
840 |
label: 'Cancel' |
|
841 |
name: 'cancelButton' |
|
842 |
translateLabel: true |
|
843 |
labelChannel: cancelLabelHolder |
|
844 |
tabable: true |
|
845 |
model: doCancel |
|
5873 | 846 |
extent: (Point 131 22) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
847 |
) |
5229 | 848 |
(ActionButtonSpec |
849 |
label: 'Append' |
|
850 |
name: 'appendButton' |
|
851 |
visibilityChannel: appendButtonVisibleHolder |
|
852 |
translateLabel: true |
|
853 |
labelChannel: appendLabelHolder |
|
854 |
tabable: true |
|
855 |
model: appendPressed |
|
5873 | 856 |
extent: (Point 132 22) |
3892 | 857 |
) |
5229 | 858 |
(ActionButtonSpec |
859 |
label: 'OK' |
|
860 |
name: 'okButton' |
|
861 |
translateLabel: true |
|
862 |
labelChannel: okLabelHolder |
|
863 |
tabable: true |
|
864 |
model: okPressed |
|
865 |
isDefault: true |
|
5873 | 866 |
extent: (Point 132 22) |
3892 | 867 |
) |
868 |
) |
|
869 |
||
870 |
) |
|
871 |
) |
|
872 |
) |
|
873 |
||
874 |
) |
|
875 |
) |
|
876 |
! ! |
|
877 |
||
878 |
!FileDialog class methodsFor:'menu specs'! |
|
879 |
||
880 |
toolBarMenu |
|
881 |
"This resource specification was automatically generated |
|
882 |
by the MenuEditor of ST/X." |
|
883 |
||
884 |
"Do not manually edit this!! If it is corrupted, |
|
885 |
the MenuEditor may not be able to read the specification." |
|
886 |
||
887 |
" |
|
888 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
889 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
890 |
" |
|
891 |
||
892 |
<resource: #menu> |
|
893 |
||
894 |
^ |
|
5873 | 895 |
#(Menu |
896 |
( |
|
897 |
(MenuItem |
|
898 |
activeHelpKey: directoryBack |
|
899 |
enabled: enableBack |
|
900 |
label: 'Back' |
|
901 |
itemValue: doBack |
|
902 |
translateLabel: true |
|
903 |
isButton: true |
|
904 |
submenuChannel: menuDirHistoryBack |
|
6087 | 905 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 906 |
keepLinkedMenu: true |
3892 | 907 |
) |
5873 | 908 |
(MenuItem |
909 |
label: '' |
|
3892 | 910 |
) |
5873 | 911 |
(MenuItem |
912 |
activeHelpKey: directoryForward |
|
913 |
enabled: enableForward |
|
914 |
label: 'Forward' |
|
915 |
itemValue: doForward |
|
916 |
translateLabel: true |
|
917 |
isButton: true |
|
918 |
submenuChannel: menuDirHistoryForward |
|
6087 | 919 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 920 |
keepLinkedMenu: true |
3892 | 921 |
) |
5873 | 922 |
(MenuItem |
6462 | 923 |
label: '-' |
924 |
) |
|
925 |
(MenuItem |
|
926 |
activeHelpKey: directoryUp |
|
927 |
enabled: enableDirectoryUp |
|
928 |
label: 'DirectoryUp' |
|
929 |
itemValue: doGoDirectoryUp |
|
930 |
translateLabel: true |
|
931 |
isButton: true |
|
932 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 933 |
) |
5873 | 934 |
(MenuItem |
935 |
activeHelpKey: fileHome |
|
936 |
enabled: enableHome |
|
937 |
label: 'Home' |
|
938 |
itemValue: doGotoHomeDirectory |
|
939 |
translateLabel: true |
|
940 |
isButton: true |
|
6096 | 941 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 942 |
) |
5873 | 943 |
(MenuItem |
8092 | 944 |
activeHelpKey: fileDesktop |
8586 | 945 |
enabled: enableGotoDesktop |
8092 | 946 |
label: 'Desktop' |
947 |
itemValue: doGotoDesktopDirectory |
|
948 |
translateLabel: true |
|
949 |
isButton: true |
|
950 |
labelImage: (ResourceRetriever ToolbarIconLibrary desktopIcon) |
|
951 |
) |
|
952 |
(MenuItem |
|
6098 | 953 |
activeHelpKey: fileGotoBookmark |
954 |
label: 'Bookmarks' |
|
955 |
translateLabel: true |
|
956 |
isButton: true |
|
957 |
submenuChannel: gotoBookmarksMenuSpec |
|
958 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
|
959 |
) |
|
960 |
(MenuItem |
|
5873 | 961 |
label: '-' |
962 |
isVisible: newDirectoryVisibilityHolder |
|
3923 | 963 |
) |
5873 | 964 |
(MenuItem |
6122 | 965 |
label: 'New Directory...' |
5873 | 966 |
itemValue: newDirectory |
967 |
translateLabel: true |
|
968 |
isButton: true |
|
969 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 970 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 971 |
) |
8585 | 972 |
(MenuItem |
973 |
label: '-' |
|
974 |
isVisible: browseVisibleHolder |
|
975 |
) |
|
976 |
(MenuItem |
|
977 |
activeHelpKey: openFileBrowser |
|
978 |
label: 'Browse' |
|
979 |
itemValue: doBrowseDirectory |
|
980 |
translateLabel: true |
|
981 |
isButton: true |
|
982 |
isVisible: browseVisibleHolder |
|
983 |
labelImage: (ResourceRetriever ToolbarIconLibrary startFileBrowserIcon) |
|
984 |
) |
|
3892 | 985 |
) |
986 |
nil |
|
987 |
nil |
|
988 |
) |
|
989 |
! ! |
|
990 |
||
8182 | 991 |
!FileDialog class methodsFor:'plugIn spec'! |
992 |
||
993 |
aspectSelectors |
|
994 |
"This resource specification was automatically generated |
|
995 |
by the UIPainter of ST/X." |
|
996 |
||
997 |
"Do not manually edit this. If it is corrupted, |
|
998 |
the UIPainter may not be able to read the specification." |
|
999 |
||
1000 |
"Return a description of exported aspects; |
|
1001 |
these can be connected to aspects of an embedding application |
|
1002 |
(if this app is embedded in a subCanvas)." |
|
1003 |
||
1004 |
^ #( |
|
1005 |
#filenameHolder |
|
1006 |
#filterHolder |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1007 |
#rootDirectoryHolder |
8182 | 1008 |
). |
1009 |
||
1010 |
! ! |
|
1011 |
||
3892 | 1012 |
!FileDialog methodsFor:'accessing'! |
1013 |
||
3996 | 1014 |
currentSelectedFiles |
1015 |
||
1016 |
| selectedFiles| |
|
1017 |
||
1018 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1019 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
1020 |
! |
|
1021 |
||
3892 | 1022 |
directory |
1023 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
1024 |
||
1025 |
^ directory |
|
1026 |
! |
|
1027 |
||
1028 |
directory:something |
|
1029 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
1030 |
||
1031 |
directory := something. |
|
1032 |
! |
|
1033 |
||
1034 |
initialText |
|
1035 |
||
5598 | 1036 |
initialText isNil ifTrue:[ |
1037 |
^ resources string:'File Dialog'. |
|
1038 |
]. |
|
1039 |
^ resources string:initialText |
|
3892 | 1040 |
! |
1041 |
||
1042 |
initialText:something |
|
1043 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
1044 |
||
1045 |
initialText := something. |
|
1046 |
! |
|
1047 |
||
1048 |
pattern |
|
1049 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1050 |
||
1051 |
^ pattern |
|
1052 |
! |
|
1053 |
||
1054 |
pattern:something |
|
1055 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1056 |
||
1057 |
pattern := something. |
|
1058 |
! |
|
1059 |
||
1060 |
result |
|
1061 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1062 |
||
1063 |
^ result |
|
1064 |
! |
|
1065 |
||
1066 |
result:something |
|
1067 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1068 |
||
1069 |
result := something. |
|
1070 |
! |
|
1071 |
||
3904 | 1072 |
selectedDirectories |
1073 |
||
1074 |
| selectedFiles| |
|
1075 |
||
1076 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1077 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1078 |
! |
|
1079 |
||
3892 | 1080 |
startFilename |
1081 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
1082 |
||
1083 |
startFilename isNil ifTrue:[ |
|
1084 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1085 |
]. |
|
1086 |
^ startFilename |
|
1087 |
! |
|
1088 |
||
1089 |
startFilename:something |
|
1090 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
1091 |
||
1092 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1093 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1094 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1095 |
!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
|
1096 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1097 |
asLoadDialog |
4804 | 1098 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1099 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1100 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1101 |
asLoadDialog:aBoolean |
4804 | 1102 |
self beLoadDialog:aBoolean |
1103 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1104 |
|
4804 | 1105 |
beLoadDialog:aBoolean |
1106 |
||
1107 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1108 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1109 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1110 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1111 |
"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
|
1112 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1113 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1114 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1115 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1116 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1117 |
"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
|
1118 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1119 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1120 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1121 |
|
4804 | 1122 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1123 |
|
4804 | 1124 |
^ isLoadDialog ? true |
1125 |
! |
|
1126 |
||
1127 |
multipleSelect |
|
1128 |
^ multipleSelect ? false |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1129 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1130 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1131 |
multipleSelect:aBoolean |
4804 | 1132 |
multipleSelect := aBoolean. |
1133 |
treeBrowser notNil ifTrue:[ |
|
1134 |
treeBrowser multipleSelect:aBoolean. |
|
1135 |
]. |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1138 |
!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
|
1139 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1140 |
addButton:aButton |
6068 | 1141 |
|buttonPanel okButton| |
1142 |
||
1143 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1144 |
okButton := self okButton. |
|
1145 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1146 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1147 |
buttonPanel addSubView:aButton before:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1148 |
] ifFalse:[ |
6068 | 1149 |
buttonPanel addSubView:aButton after:okButton |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1150 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1151 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1152 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1153 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1154 |
^ (self componentAt:#okButton) |
3892 | 1155 |
! |
1156 |
||
3904 | 1157 |
treeBrowser |
1158 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1159 |
||
1160 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1161 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1162 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1163 |
!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
|
1164 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1165 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1166 |
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
|
1167 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1168 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1169 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1170 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1171 |
newDirectoryVisibilityHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1172 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1173 |
^ newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1174 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1175 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1176 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1177 |
self buttonPanelVisibleHolder value:true |
3904 | 1178 |
! |
1179 |
||
3892 | 1180 |
viewFiles |
1181 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1182 |
||
1183 |
^ viewFiles |
|
1184 |
! |
|
1185 |
||
1186 |
viewFiles:something |
|
1187 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1188 |
||
1189 |
viewFiles := something. |
|
1190 |
! ! |
|
1191 |
||
1192 |
!FileDialog methodsFor:'aspects'! |
|
1193 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1194 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1195 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1196 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1197 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1198 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1199 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1200 |
|
5193 | 1201 |
appendLabelHolder |
1202 |
appendLabelHolder isNil ifTrue:[ |
|
1203 |
appendLabelHolder := 'Append' asValue. |
|
1204 |
]. |
|
1205 |
^ appendLabelHolder |
|
1206 |
! |
|
1207 |
||
4804 | 1208 |
aspectOrNil:aKey forSubApplication:aSubApp |
1209 |
"this hook provides an aspect for a subApp" |
|
1210 |
||
1211 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1212 |
directory notNil ifTrue:[ |
|
1213 |
^ (OrderedCollection with:directory) asValue |
|
1214 |
] |
|
1215 |
]. |
|
1216 |
^ nil |
|
1217 |
! |
|
1218 |
||
5969 | 1219 |
browseVisibleHolder |
1220 |
browseVisibleHolder isNil ifTrue:[ |
|
8585 | 1221 |
browseVisibleHolder := true "false" asValue. |
5969 | 1222 |
]. |
1223 |
^ browseVisibleHolder. |
|
1224 |
! |
|
1225 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1226 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1227 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1228 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1229 |
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
|
1230 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1231 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1232 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1233 |
|
3892 | 1234 |
cancelLabelHolder |
1235 |
||
1236 |
cancelLabelHolder isNil ifTrue:[ |
|
1237 |
cancelLabelHolder := 'Cancel' asValue. |
|
1238 |
]. |
|
1239 |
^ cancelLabelHolder. |
|
1240 |
! |
|
1241 |
||
1242 |
enableBack |
|
4804 | 1243 |
^ treeBrowser enableBack. |
3892 | 1244 |
! |
1245 |
||
1246 |
enableDirectoryUp |
|
4804 | 1247 |
^ treeBrowser enableDirectoryUp. |
3892 | 1248 |
! |
1249 |
||
1250 |
enableForward |
|
4804 | 1251 |
^ treeBrowser enableForward. |
3892 | 1252 |
! |
1253 |
||
8169 | 1254 |
enableGotoDesktop |
1255 |
^ treeBrowser enableGotoDesktop. |
|
1256 |
! |
|
1257 |
||
3892 | 1258 |
enableHome |
4804 | 1259 |
^ treeBrowser enableHome. |
3892 | 1260 |
! |
1261 |
||
1262 |
filenameHolder |
|
1263 |
"Return a value holder with the filename. |
|
1264 |
Shown in the filename input-field. |
|
1265 |
Being the selection in the tree. |
|
1266 |
" |
|
1267 |
|holder| |
|
7581 | 1268 |
|
3892 | 1269 |
holder := builder bindingAt:#filenameHolder. |
1270 |
||
7581 | 1271 |
holder isNil ifTrue:[ |
3892 | 1272 |
holder := ValueHolder new. |
1273 |
holder addDependent:self. |
|
1274 |
builder aspectAt:#filenameHolder |
|
1275 |
put:holder. |
|
1276 |
]. |
|
1277 |
||
1278 |
^ holder. |
|
1279 |
! |
|
1280 |
||
8183 | 1281 |
filenameHolder:aHolder |
8182 | 1282 |
"needed when used as subcanvas" |
8183 | 1283 |
|
1284 |
|holder| |
|
8182 | 1285 |
|
8183 | 1286 |
holder := builder aspectAt:#filenameHolder. |
1287 |
holder notNil ifTrue:[ |
|
1288 |
holder removeDependent:self |
|
1289 |
]. |
|
8182 | 1290 |
builder aspectAt:#filenameHolder put:aHolder. |
8183 | 1291 |
aHolder addDependent:self |
8182 | 1292 |
! |
1293 |
||
3904 | 1294 |
filenameLabelHolder |
1295 |
"Return a value holder for the input string. |
|
1296 |
" |
|
1297 |
filenameLabelHolder isNil ifTrue:[ |
|
1298 |
filenameLabelHolder := 'Filename:' asValue. |
|
1299 |
]. |
|
1300 |
^ filenameLabelHolder |
|
1301 |
! |
|
1302 |
||
3892 | 1303 |
filterHolder |
8183 | 1304 |
"Return a value holder for filter" |
3892 | 1305 |
|
1306 |
filterHolder isNil ifTrue:[ |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1307 |
filterHolder := (self pattern ? '*') asValue. |
3892 | 1308 |
]. |
1309 |
^ filterHolder |
|
1310 |
! |
|
1311 |
||
8183 | 1312 |
filterHolder:aHolder |
1313 |
"needed when used as subcanvas" |
|
1314 |
||
1315 |
filterHolder := aHolder. |
|
1316 |
! |
|
1317 |
||
6098 | 1318 |
gotoBookmarksMenuSpec |
1319 |
<resource: #programMenu> |
|
1320 |
||
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1321 |
^ treeBrowser gotoBookmarksMenuSpec |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1322 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1323 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1324 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1325 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1326 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1327 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1328 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1329 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1330 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1331 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1332 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1333 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1334 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1335 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1336 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1337 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1338 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1339 |
"/ ^ menu |
6098 | 1340 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1341 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1342 |
! |
1343 |
||
6065 | 1344 |
listOfDeviceDrives |
1345 |
||
1346 |
listOfDeviceDrives isNil ifTrue:[ |
|
1347 |
listOfDeviceDrives := Filename volumes. |
|
1348 |
]. |
|
1349 |
^ listOfDeviceDrives |
|
1350 |
! |
|
1351 |
||
3892 | 1352 |
okLabelHolder |
1353 |
"automatically generated by UIPainter ..." |
|
1354 |
||
1355 |
"*** the code below creates a default model when invoked." |
|
1356 |
"*** (which may not be the one you wanted)" |
|
1357 |
"*** Please change as required and accept it in the browser." |
|
1358 |
"*** (and replace this comment by something more useful ;-)" |
|
1359 |
||
1360 |
okLabelHolder isNil ifTrue:[ |
|
1361 |
okLabelHolder := 'OK' asValue. |
|
1362 |
]. |
|
1363 |
^ okLabelHolder. |
|
6065 | 1364 |
! |
1365 |
||
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1366 |
rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1367 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1368 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1369 |
rootDirectoryHolder isNil ifTrue:[ |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1370 |
rootDirectoryHolder := self initialRootDirectory asValue. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1371 |
]. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1372 |
^ rootDirectoryHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1373 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1374 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1375 |
rootDirectoryHolder:aHolder |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1376 |
"Return a value holder for filter" |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1377 |
|
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1378 |
rootDirectoryHolder := aHolder. |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1379 |
! |
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1380 |
|
6065 | 1381 |
selectedDeviceDrive |
1382 |
||
1383 |
selectedDeviceDrive isNil ifTrue:[ |
|
1384 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1385 |
selectedDeviceDrive addDependent:self. |
|
1386 |
]. |
|
1387 |
^ selectedDeviceDrive |
|
3892 | 1388 |
! ! |
1389 |
||
1390 |
!FileDialog methodsFor:'change & update'! |
|
1391 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1392 |
buttonPanelVisibilityChanged |
5598 | 1393 |
|filePart| |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1394 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1395 |
filePart := builder componentAt:#FilePart. |
5598 | 1396 |
filePart notNil ifTrue:[ |
1397 |
buttonPanelVisibleHolder value ifTrue:[ |
|
1398 |
filePart layout bottomOffset:-40 |
|
1399 |
] ifFalse:[ |
|
1400 |
filePart layout bottomOffset:0 |
|
1401 |
]. |
|
1402 |
filePart containerChangedSize "/ force resize |
|
1403 |
] |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1404 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1405 |
|
6065 | 1406 |
selectedDeviceDriveChanged |
1407 |
||
1408 |
| newDrive curSel newFile| |
|
1409 |
||
1410 |
newDrive := self selectedDeviceDrive value. |
|
1411 |
curSel := treeBrowser currentFileNameHolder value. |
|
1412 |
curSel notEmpty ifTrue:[ |
|
1413 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1414 |
]. |
|
1415 |
newDrive notNil ifTrue:[ |
|
1416 |
newFile := newDrive asFilename. |
|
1417 |
||
1418 |
newFile isReadable ifTrue:[ |
|
1419 |
treeBrowser gotoFile:newFile. |
|
1420 |
^self. |
|
1421 |
]. |
|
1422 |
]. |
|
1423 |
curSel notEmpty ifTrue:[ |
|
1424 |
self selectedDeviceDrive value:(curSel first volume). |
|
1425 |
] ifFalse:[ |
|
1426 |
self selectedDeviceDrive value:'C:'. |
|
1427 |
]. |
|
1428 |
! |
|
1429 |
||
3892 | 1430 |
update:something with:aParameter from:changedObject |
5867 | 1431 |
|files newFile newLabel fn entryFieldFilename| |
3892 | 1432 |
|
1433 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1434 |
files := changedObject value. |
3892 | 1435 |
|
1436 |
(files isEmpty) ifTrue:[ |
|
4804 | 1437 |
newFile := nil. |
3892 | 1438 |
] ifFalse:[ |
1439 |
files size == 1 ifTrue:[ |
|
4804 | 1440 |
newFile := files first. |
3892 | 1441 |
] ifFalse:[ |
4804 | 1442 |
newFile := ''. |
3892 | 1443 |
]. |
1444 |
]. |
|
5924 | 1445 |
(self filenameHolder value notNil |
1446 |
and:[newFile notNil |
|
1447 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
5867 | 1448 |
entryFieldFilename := self filenameHolder value asFilename. |
1449 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6122
diff
changeset
|
1450 |
entryFieldFilename isDirectory ifFalse:[ |
5867 | 1451 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
1452 |
]. |
|
1453 |
]. |
|
1454 |
]. |
|
4804 | 1455 |
self filenameHolder value:newFile withoutNotifying:self. |
6065 | 1456 |
OperatingSystem supportsVolumes ifTrue:[ |
1457 |
| volume | |
|
1458 |
volume := (files size >= 1) |
|
1459 |
ifTrue:[files first volume] |
|
1460 |
ifFalse:nil. |
|
1461 |
self selectedDeviceDrive value:volume. |
|
1462 |
]. |
|
3892 | 1463 |
]. |
4804 | 1464 |
|
6065 | 1465 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1466 |
self selectedDeviceDriveChanged. |
|
1467 |
^ self. |
|
1468 |
]. |
|
3904 | 1469 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1470 |
changedObject value ifTrue:[ |
|
4804 | 1471 |
newLabel := 'Filename:'. |
3904 | 1472 |
] ifFalse:[ |
4804 | 1473 |
newLabel := 'Directory:'. |
1474 |
]. |
|
1475 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1476 |
]. |
3892 | 1477 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1478 |
fn := changedObject value asFilename. |
1479 |
(fn exists) ifFalse:[^ self]. |
|
1480 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
|
5949 | 1481 |
fn isDirectory ifTrue:[ |
1482 |
treeBrowser expandEnforceSelectedItems. |
|
1483 |
]. |
|
3892 | 1484 |
]. |
1485 |
^ super update:something with:aParameter from:changedObject |
|
1486 |
! ! |
|
1487 |
||
1488 |
!FileDialog methodsFor:'event handling'! |
|
1489 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1490 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1491 |
"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
|
1492 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1493 |
^ appendWasPressed |
3892 | 1494 |
! ! |
1495 |
||
1496 |
!FileDialog methodsFor:'initialization & release'! |
|
1497 |
||
5932 | 1498 |
closeDownViews |
1499 |
self remarkExtent. |
|
1500 |
super closeDownViews. |
|
1501 |
! |
|
1502 |
||
1503 |
closeWindow |
|
1504 |
self remarkExtent. |
|
1505 |
super closeWindow. |
|
1506 |
! |
|
1507 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1508 |
commonPostOpen |
8182 | 1509 |
|selection| |
3892 | 1510 |
|
1511 |
"/ 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
|
1512 |
|
3892 | 1513 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1514 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1515 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1516 |
|
6409 | 1517 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1518 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1519 |
treeBrowser viewFilesInDirectoryTree changed. |
4804 | 1520 |
|
1521 |
self isLoadDialog ifTrue:[ |
|
4796 | 1522 |
treeBrowser newVisibilityHolder value:false. |
1523 |
treeBrowser allowFileOperations value:false. |
|
1524 |
self newDirectoryVisibilityHolder value:false. |
|
1525 |
]. |
|
5927 | 1526 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1527 |
|
1528 |
selection := treeBrowser treeSelectionHolder value. |
|
1529 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1530 |
selection := selection asCollection first. |
5929 | 1531 |
selection enforcedExpand. |
1532 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1533 |
]. |
|
4796 | 1534 |
! |
1535 |
||
6409 | 1536 |
initialRootDirectory |
1537 |
"returns the directory the browser is open on |
|
1538 |
" |
|
1539 |
|root| |
|
1540 |
||
1541 |
(root := self directory) notNil ifTrue:[ |
|
1542 |
root := root asFilename. |
|
1543 |
||
1544 |
root isDirectory ifFalse:[ |
|
1545 |
root := root directory. |
|
1546 |
||
1547 |
root isDirectory ifFalse:[ |
|
1548 |
root := nil. |
|
1549 |
] |
|
1550 |
] |
|
1551 |
]. |
|
1552 |
root isNil ifTrue:[ |
|
1553 |
root := Filename currentDirectory. |
|
1554 |
]. |
|
1555 |
^ root asAbsoluteFilename |
|
1556 |
! |
|
1557 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1558 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1559 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1560 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1561 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1562 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1563 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1564 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1565 |
filterField := aWidget. |
4796 | 1566 |
! |
1567 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1568 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1569 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1570 |
treeBrowser := aSubCanvasView client. |
6409 | 1571 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1572 |
! |
4796 | 1573 |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1574 |
postBuildWith:aBuilder |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1575 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1576 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1577 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1578 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1579 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1580 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1581 |
|
6632 | 1582 |
super postBuildWith:aBuilder |
5932 | 1583 |
! |
1584 |
||
8182 | 1585 |
postOpenAsSubcanvasWith:aBuilder |
1586 |
super postOpenAsSubcanvasWith:aBuilder. |
|
1587 |
||
1588 |
"No ok and cancel buttons, when dialog is part of a larger dialog" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1589 |
self hideButtonPanel. |
8183 | 1590 |
|
1591 |
"filenameHolder contains the initial file name" |
|
8191
1779a8c3730d
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8183
diff
changeset
|
1592 |
self startFilename:self filenameHolder value. |
8183 | 1593 |
treeBrowser currentFileNameHolder value:(Array with:self filenameHolder value). |
8182 | 1594 |
! |
1595 |
||
1596 |
postOpenWith:aBuilder |
|
1597 |
|lastExtent| |
|
1598 |
||
1599 |
super postOpenWith:aBuilder. |
|
8183 | 1600 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename). |
8182 | 1601 |
|
1602 |
lastExtent := self class lastExtent. |
|
1603 |
lastExtent notNil ifTrue:[ |
|
1604 |
self window topView extent:lastExtent. |
|
1605 |
]. |
|
1606 |
self window label:self initialText. |
|
1607 |
! |
|
1608 |
||
5932 | 1609 |
remarkExtent |
1610 |
self class lastExtent:self window topView extent. |
|
4796 | 1611 |
! ! |
1612 |
||
1613 |
!FileDialog methodsFor:'private'! |
|
1614 |
||
1615 |
returnWasPressedInFilterField |
|
1616 |
|ev| |
|
1617 |
||
1618 |
ev := self windowGroup lastEvent. |
|
1619 |
(ev notNil |
|
1620 |
and:[ev isKeyEvent |
|
1621 |
and:[ev key == #Return |
|
1622 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1623 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1624 |
^ true |
|
1625 |
]. |
|
1626 |
^ false |
|
1627 |
! |
|
1628 |
||
1629 |
returnWasPressedInFilterOrFilenameField |
|
1630 |
|ev| |
|
1631 |
||
1632 |
ev := self windowGroup lastEvent. |
|
1633 |
(ev notNil |
|
1634 |
and:[ev isKeyEvent |
|
1635 |
and:[ev key == #Return |
|
1636 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1637 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1638 |
^ true |
|
1639 |
]. |
|
1640 |
^ false |
|
1641 |
! ! |
|
1642 |
||
6065 | 1643 |
!FileDialog methodsFor:'queries'! |
1644 |
||
1645 |
driveSelectorVisible |
|
1646 |
^ OperatingSystem isMSDOSlike |
|
1647 |
! ! |
|
1648 |
||
4796 | 1649 |
!FileDialog methodsFor:'user actions'! |
1650 |
||
1651 |
appendPressed |
|
1652 |
appendWasPressed := true. |
|
1653 |
self commonAcceptAction. |
|
1654 |
! |
|
1655 |
||
1656 |
commonAcceptAction |
|
1657 |
filenameField accept. |
|
1658 |
self result:(self filenameHolder value asString). |
|
1659 |
||
1660 |
^ super doAccept |
|
1661 |
! |
|
1662 |
||
1663 |
doAccept |
|
1664 |
"force accept - ignore in filterField" |
|
1665 |
||
1666 |
self returnWasPressedInFilterField ifTrue:[ |
|
1667 |
^ self |
|
1668 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1669 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1670 |
"/ 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
|
1671 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1672 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1673 |
]. |
4796 | 1674 |
appendWasPressed := false. |
1675 |
self commonAcceptAction. |
|
1676 |
! |
|
1677 |
||
1678 |
doBack |
|
1679 |
||
1680 |
treeBrowser doBack. |
|
1681 |
! |
|
1682 |
||
5966 | 1683 |
doBrowseDirectory |
1684 |
UserPreferences fileBrowserClass openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
|
1685 |
||
1686 |
||
1687 |
! |
|
1688 |
||
4796 | 1689 |
doCancel |
1690 |
||
1691 |
self result:nil. |
|
1692 |
^ super doCancel. |
|
1693 |
! |
|
1694 |
||
1695 |
doForward |
|
1696 |
||
1697 |
treeBrowser doForward. |
|
1698 |
! |
|
1699 |
||
1700 |
doGoDirectoryUp |
|
1701 |
||
1702 |
treeBrowser doGoDirectoryUp. |
|
1703 |
! |
|
1704 |
||
8092 | 1705 |
doGotoDesktopDirectory |
1706 |
||
1707 |
treeBrowser doGotoDesktopDirectory. |
|
1708 |
! |
|
1709 |
||
4796 | 1710 |
doGotoHomeDirectory |
1711 |
||
1712 |
treeBrowser doGotoHomeDirectory. |
|
1713 |
! |
|
1714 |
||
1715 |
menuDirHistory:backOrForward |
|
1716 |
||
1717 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1718 |
! |
|
1719 |
||
1720 |
menuDirHistoryBack |
|
1721 |
||
1722 |
^ treeBrowser menuDirHistory:#back. |
|
1723 |
! |
|
1724 |
||
1725 |
menuDirHistoryForward |
|
1726 |
||
1727 |
^ treeBrowser menuDirHistory:#forward. |
|
1728 |
! |
|
1729 |
||
1730 |
newDirectory |
|
1731 |
||
1732 |
^ treeBrowser newDirectory |
|
1733 |
! |
|
1734 |
||
1735 |
okPressed |
|
1736 |
self doAccept |
|
1737 |
! ! |
|
1738 |
||
1739 |
!FileDialog class methodsFor:'documentation'! |
|
1740 |
||
1741 |
version |
|
8661
086147f751d0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8586
diff
changeset
|
1742 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.103 2009-07-08 11:49:16 cg Exp $' |
4796 | 1743 |
! ! |