author | fm |
Wed, 13 Dec 2006 16:35:56 +0100 | |
changeset 7571 | 3e686c0ffb5c |
parent 7567 | 9896e794a220 |
child 7581 | 8720d2277df6 |
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 |
" |
|
3892 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
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 |
21 |
selectedDeviceDrive listOfDeviceDrives' |
|
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 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
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 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
657 |
!FileDialog class methodsFor:'active help'! |
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 |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
660 |
<resource: #help> |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
661 |
|
5966 | 662 |
|spec| |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
663 |
|
6098 | 664 |
spec := AbstractFileBrowser flyByHelpSpec addPairsFrom:#( |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
665 |
|
5966 | 666 |
#fileBrowse |
667 |
'Browse' |
|
668 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
669 |
). |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
670 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
671 |
"/ hist := self directoryHistory. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
672 |
"/ hist notNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
673 |
"/ hist canForward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
674 |
"/ 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
|
675 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
676 |
"/ hist canBackward ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
677 |
"/ 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
|
678 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
679 |
"/ ]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
680 |
^ spec. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
681 |
|
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
682 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
683 |
self flyByHelpSpec |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
684 |
" |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
685 |
! ! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
686 |
|
3892 | 687 |
!FileDialog class methodsFor:'interface specs'! |
688 |
||
689 |
windowSpec |
|
690 |
"This resource specification was automatically generated |
|
691 |
by the UIPainter of ST/X." |
|
692 |
||
693 |
"Do not manually edit this!! If it is corrupted, |
|
694 |
the UIPainter may not be able to read the specification." |
|
695 |
||
696 |
" |
|
697 |
UIPainter new openOnClass:FileDialog andSelector:#windowSpec |
|
698 |
FileDialog new openInterface:#windowSpec |
|
699 |
FileDialog open |
|
700 |
" |
|
701 |
||
702 |
<resource: #canvas> |
|
703 |
||
704 |
^ |
|
5229 | 705 |
#(FullSpec |
706 |
name: windowSpec |
|
707 |
window: |
|
708 |
(WindowSpec |
|
709 |
label: 'FileDialog' |
|
710 |
name: 'FileDialog' |
|
711 |
min: (Point 10 10) |
|
712 |
max: (Point 1024 768) |
|
5873 | 713 |
bounds: (Rectangle 0 0 407 400) |
3892 | 714 |
) |
5229 | 715 |
component: |
716 |
(SpecCollection |
|
717 |
collection: ( |
|
718 |
(ViewSpec |
|
719 |
name: 'FilePart' |
|
720 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -32 1.0) |
|
721 |
component: |
|
722 |
(SpecCollection |
|
723 |
collection: ( |
|
724 |
(MenuPanelSpec |
|
725 |
name: 'ToolBar1' |
|
6087 | 726 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
5229 | 727 |
tabable: true |
728 |
menu: toolBarMenu |
|
729 |
textDefault: true |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
730 |
) |
5229 | 731 |
(SubCanvasSpec |
732 |
name: 'DirectoryTreeBrowser' |
|
6087 | 733 |
layout: (LayoutFrame 0 0.0 57 0 0 1.0 -30 1) |
5229 | 734 |
tabable: true |
735 |
hasHorizontalScrollBar: false |
|
736 |
hasVerticalScrollBar: false |
|
737 |
majorKey: DirectoryTreeBrowser |
|
738 |
createNewApplication: true |
|
739 |
createNewBuilder: true |
|
740 |
postBuildCallback: postBuildTreeBrowser: |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
741 |
) |
5229 | 742 |
(VariableHorizontalPanelSpec |
743 |
name: 'VariableHorizontalPanel1' |
|
6087 | 744 |
layout: (LayoutFrame 0 0 32 0 0 1 57 0) |
5229 | 745 |
level: 1 |
746 |
showHandle: false |
|
747 |
component: |
|
748 |
(SpecCollection |
|
749 |
collection: ( |
|
750 |
(ViewSpec |
|
751 |
name: 'Box1' |
|
6065 | 752 |
component: |
753 |
(SpecCollection |
|
754 |
collection: ( |
|
755 |
(ComboListSpec |
|
756 |
name: 'ComboList1' |
|
757 |
layout: (LayoutFrame 1 0 1 0.0 121 0 -1 1) |
|
758 |
visibilityChannel: driveSelectorVisible |
|
759 |
model: selectedDeviceDrive |
|
760 |
comboList: listOfDeviceDrives |
|
761 |
useIndex: false |
|
762 |
hidePullDownMenuButton: false |
|
763 |
) |
|
764 |
) |
|
765 |
||
766 |
) |
|
4804 | 767 |
) |
5229 | 768 |
(ViewSpec |
769 |
name: 'Box2' |
|
770 |
component: |
|
771 |
(SpecCollection |
|
772 |
collection: ( |
|
773 |
(LabelSpec |
|
774 |
label: 'Filter:' |
|
775 |
name: 'FilterLabel' |
|
776 |
layout: (LayoutFrame 8 0 2 0 59 0 -2 1) |
|
777 |
translateLabel: true |
|
778 |
adjust: right |
|
4804 | 779 |
) |
5229 | 780 |
(InputFieldSpec |
781 |
name: 'FilterEntryField' |
|
782 |
layout: (LayoutFrame 60 0 -22 1 -2 1 -2 1) |
|
783 |
model: filterHolder |
|
784 |
immediateAccept: true |
|
785 |
acceptOnReturn: true |
|
786 |
acceptOnTab: true |
|
787 |
acceptOnLostFocus: true |
|
788 |
acceptOnPointerLeave: false |
|
789 |
postBuildCallback: postBuildFilterField: |
|
4804 | 790 |
) |
791 |
) |
|
792 |
||
793 |
) |
|
794 |
) |
|
795 |
) |
|
796 |
||
797 |
) |
|
6065 | 798 |
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
|
799 |
) |
5230 | 800 |
(LabelSpec |
801 |
label: 'Filename:' |
|
802 |
name: 'FilenameLabel' |
|
803 |
layout: (LayoutFrame 3 0 -21 1 73 0 -1 1) |
|
804 |
translateLabel: true |
|
805 |
labelChannel: filenameLabelHolder |
|
806 |
adjust: left |
|
807 |
) |
|
808 |
(FilenameInputFieldSpec |
|
809 |
name: 'FilenameEntryField' |
|
810 |
layout: (LayoutFrame 70 0 -21 1 -4 1 -1 1) |
|
811 |
tabable: true |
|
812 |
model: filenameHolder |
|
813 |
immediateAccept: false |
|
814 |
acceptOnPointerLeave: false |
|
5853 | 815 |
hasKeyboardFocusInitially: true |
5230 | 816 |
postBuildCallback: postBuildFileNameField: |
817 |
) |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
818 |
) |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
819 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
820 |
) |
3892 | 821 |
) |
5229 | 822 |
(HorizontalPanelViewSpec |
823 |
name: 'ButtonPanel' |
|
824 |
layout: (LayoutFrame 0 0.0 -32 1 0 1 0 1) |
|
825 |
visibilityChannel: buttonPanelVisibleHolder |
|
826 |
horizontalLayout: fitSpace |
|
827 |
verticalLayout: center |
|
828 |
horizontalSpace: 3 |
|
829 |
verticalSpace: 3 |
|
830 |
reverseOrderIfOKAtLeft: true |
|
831 |
component: |
|
832 |
(SpecCollection |
|
833 |
collection: ( |
|
834 |
(ActionButtonSpec |
|
835 |
label: 'Cancel' |
|
836 |
name: 'cancelButton' |
|
837 |
translateLabel: true |
|
838 |
labelChannel: cancelLabelHolder |
|
839 |
tabable: true |
|
840 |
model: doCancel |
|
5873 | 841 |
extent: (Point 131 22) |
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
842 |
) |
5229 | 843 |
(ActionButtonSpec |
844 |
label: 'Append' |
|
845 |
name: 'appendButton' |
|
846 |
visibilityChannel: appendButtonVisibleHolder |
|
847 |
translateLabel: true |
|
848 |
labelChannel: appendLabelHolder |
|
849 |
tabable: true |
|
850 |
model: appendPressed |
|
5873 | 851 |
extent: (Point 132 22) |
3892 | 852 |
) |
5229 | 853 |
(ActionButtonSpec |
854 |
label: 'OK' |
|
855 |
name: 'okButton' |
|
856 |
translateLabel: true |
|
857 |
labelChannel: okLabelHolder |
|
858 |
tabable: true |
|
859 |
model: okPressed |
|
860 |
isDefault: true |
|
5873 | 861 |
extent: (Point 132 22) |
3892 | 862 |
) |
863 |
) |
|
864 |
||
865 |
) |
|
866 |
) |
|
867 |
) |
|
868 |
||
869 |
) |
|
870 |
) |
|
871 |
! ! |
|
872 |
||
873 |
!FileDialog class methodsFor:'menu specs'! |
|
874 |
||
875 |
toolBarMenu |
|
876 |
"This resource specification was automatically generated |
|
877 |
by the MenuEditor of ST/X." |
|
878 |
||
879 |
"Do not manually edit this!! If it is corrupted, |
|
880 |
the MenuEditor may not be able to read the specification." |
|
881 |
||
882 |
" |
|
883 |
MenuEditor new openOnClass:FileDialog andSelector:#toolBarMenu |
|
884 |
(Menu new fromLiteralArrayEncoding:(FileDialog toolBarMenu)) startUp |
|
885 |
" |
|
886 |
||
887 |
<resource: #menu> |
|
888 |
||
889 |
^ |
|
5873 | 890 |
#(Menu |
891 |
( |
|
892 |
(MenuItem |
|
893 |
activeHelpKey: directoryBack |
|
894 |
enabled: enableBack |
|
895 |
label: 'Back' |
|
896 |
itemValue: doBack |
|
897 |
translateLabel: true |
|
898 |
isButton: true |
|
899 |
submenuChannel: menuDirHistoryBack |
|
6087 | 900 |
labelImage: (ResourceRetriever AbstractFileBrowser historyBackIcon) |
5873 | 901 |
keepLinkedMenu: true |
3892 | 902 |
) |
5873 | 903 |
(MenuItem |
904 |
label: '' |
|
3892 | 905 |
) |
5873 | 906 |
(MenuItem |
907 |
activeHelpKey: directoryForward |
|
908 |
enabled: enableForward |
|
909 |
label: 'Forward' |
|
910 |
itemValue: doForward |
|
911 |
translateLabel: true |
|
912 |
isButton: true |
|
913 |
submenuChannel: menuDirHistoryForward |
|
6087 | 914 |
labelImage: (ResourceRetriever AbstractFileBrowser historyForwardIcon) |
5873 | 915 |
keepLinkedMenu: true |
3892 | 916 |
) |
5873 | 917 |
(MenuItem |
6462 | 918 |
label: '-' |
919 |
) |
|
920 |
(MenuItem |
|
921 |
activeHelpKey: directoryUp |
|
922 |
enabled: enableDirectoryUp |
|
923 |
label: 'DirectoryUp' |
|
924 |
itemValue: doGoDirectoryUp |
|
925 |
translateLabel: true |
|
926 |
isButton: true |
|
927 |
labelImage: (ResourceRetriever AbstractFileBrowser directoryUpIcon) |
|
3892 | 928 |
) |
5873 | 929 |
(MenuItem |
930 |
activeHelpKey: fileHome |
|
931 |
enabled: enableHome |
|
932 |
label: 'Home' |
|
933 |
itemValue: doGotoHomeDirectory |
|
934 |
translateLabel: true |
|
935 |
isButton: true |
|
6096 | 936 |
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon) |
3892 | 937 |
) |
5873 | 938 |
(MenuItem |
6098 | 939 |
activeHelpKey: fileGotoBookmark |
940 |
label: 'Bookmarks' |
|
941 |
translateLabel: true |
|
942 |
isButton: true |
|
943 |
submenuChannel: gotoBookmarksMenuSpec |
|
944 |
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon) |
|
945 |
) |
|
946 |
(MenuItem |
|
5873 | 947 |
label: '-' |
5966 | 948 |
isVisible: browseVisibleHolder |
949 |
) |
|
950 |
(MenuItem |
|
951 |
activeHelpKey: fileBrowse |
|
952 |
label: 'Browse' |
|
953 |
itemValue: doBrowseDirectory |
|
954 |
translateLabel: true |
|
955 |
isButton: true |
|
956 |
isVisible: browseVisibleHolder |
|
957 |
labelImage: (ResourceRetriever ToolbarIconLibrary fileBrowser24x24Icon) |
|
958 |
) |
|
959 |
(MenuItem |
|
960 |
label: '-' |
|
5873 | 961 |
isVisible: newDirectoryVisibilityHolder |
3923 | 962 |
) |
5873 | 963 |
(MenuItem |
6122 | 964 |
label: 'New Directory...' |
5873 | 965 |
itemValue: newDirectory |
966 |
translateLabel: true |
|
967 |
isButton: true |
|
968 |
isVisible: newDirectoryVisibilityHolder |
|
6088 | 969 |
labelImage: (ResourceRetriever AbstractFileBrowser newDirectoryIcon) |
3923 | 970 |
) |
3892 | 971 |
) |
972 |
nil |
|
973 |
nil |
|
974 |
) |
|
975 |
! ! |
|
976 |
||
977 |
!FileDialog methodsFor:'accessing'! |
|
978 |
||
3996 | 979 |
currentSelectedFiles |
980 |
||
981 |
| selectedFiles| |
|
982 |
||
983 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
984 |
^ selectedFiles select:[:aFile| aFile isDirectory not]. |
|
985 |
! |
|
986 |
||
3892 | 987 |
directory |
988 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
989 |
||
990 |
^ directory |
|
991 |
! |
|
992 |
||
993 |
directory:something |
|
994 |
"set the value of the instance variable 'directory' (automatically generated)" |
|
995 |
||
996 |
directory := something. |
|
997 |
! |
|
998 |
||
999 |
initialText |
|
1000 |
||
5598 | 1001 |
initialText isNil ifTrue:[ |
1002 |
^ resources string:'File Dialog'. |
|
1003 |
]. |
|
1004 |
^ resources string:initialText |
|
3892 | 1005 |
! |
1006 |
||
1007 |
initialText:something |
|
1008 |
"set the value of the instance variable 'initialText' (automatically generated)" |
|
1009 |
||
1010 |
initialText := something. |
|
1011 |
! |
|
1012 |
||
1013 |
pattern |
|
1014 |
"return the value of the instance variable 'pattern' (automatically generated)" |
|
1015 |
||
1016 |
^ pattern |
|
1017 |
! |
|
1018 |
||
1019 |
pattern:something |
|
1020 |
"set the value of the instance variable 'pattern' (automatically generated)" |
|
1021 |
||
1022 |
pattern := something. |
|
1023 |
! |
|
1024 |
||
1025 |
result |
|
1026 |
"return the value of the instance variable 'result' (automatically generated)" |
|
1027 |
||
1028 |
^ result |
|
1029 |
! |
|
1030 |
||
1031 |
result:something |
|
1032 |
"set the value of the instance variable 'result' (automatically generated)" |
|
1033 |
||
1034 |
result := something. |
|
1035 |
! |
|
1036 |
||
3904 | 1037 |
selectedDirectories |
1038 |
||
1039 |
| selectedFiles| |
|
1040 |
||
1041 |
selectedFiles := treeBrowser currentFileNameHolder value. |
|
1042 |
^ selectedFiles select:[:aFile| aFile isDirectory]. |
|
1043 |
! |
|
1044 |
||
3892 | 1045 |
startFilename |
1046 |
"return the value of the instance variable 'startFilename' (automatically generated)" |
|
1047 |
||
1048 |
startFilename isNil ifTrue:[ |
|
1049 |
startFilename := Filename currentDirectory asAbsoluteFilename. |
|
1050 |
]. |
|
1051 |
^ startFilename |
|
1052 |
! |
|
1053 |
||
1054 |
startFilename:something |
|
1055 |
"set the value of the instance variable 'startFilename' (automatically generated)" |
|
1056 |
||
1057 |
startFilename := something. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1058 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1059 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1060 |
!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
|
1061 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1062 |
asLoadDialog |
4804 | 1063 |
^ self isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1064 |
! |
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 |
asLoadDialog:aBoolean |
4804 | 1067 |
self beLoadDialog:aBoolean |
1068 |
! |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1069 |
|
4804 | 1070 |
beLoadDialog:aBoolean |
1071 |
||
1072 |
isLoadDialog := aBoolean |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1073 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1074 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1075 |
doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1076 |
"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
|
1077 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1078 |
^ doubleClickAction |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1079 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1080 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1081 |
doubleClickAction:something |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1082 |
"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
|
1083 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1084 |
doubleClickAction := something. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1085 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1086 |
|
4804 | 1087 |
isLoadDialog |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1088 |
|
4804 | 1089 |
^ isLoadDialog ? true |
1090 |
! |
|
1091 |
||
1092 |
multipleSelect |
|
1093 |
^ multipleSelect ? false |
|
4728
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1096 |
multipleSelect:aBoolean |
4804 | 1097 |
multipleSelect := aBoolean. |
1098 |
treeBrowser notNil ifTrue:[ |
|
1099 |
treeBrowser multipleSelect:aBoolean. |
|
1100 |
]. |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1101 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1102 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1103 |
!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
|
1104 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1105 |
addButton:aButton |
6068 | 1106 |
|buttonPanel okButton| |
1107 |
||
1108 |
buttonPanel := self componentAt:#ButtonPanel. |
|
1109 |
okButton := self okButton. |
|
1110 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1111 |
DialogBox defaultOKButtonAtLeft ifTrue:[ |
6068 | 1112 |
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
|
1113 |
] ifFalse:[ |
6068 | 1114 |
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
|
1115 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1116 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1117 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1118 |
okButton |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1119 |
^ (self componentAt:#okButton) |
3892 | 1120 |
! |
1121 |
||
3904 | 1122 |
treeBrowser |
1123 |
"return the value of the instance variable 'treeBrowser' (automatically generated)" |
|
1124 |
||
1125 |
^ treeBrowser |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1126 |
! ! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1127 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1128 |
!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
|
1129 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1130 |
hideButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1131 |
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
|
1132 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1133 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1134 |
newDirectoryVisibilityHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1135 |
newDirectoryVisibilityHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1136 |
newDirectoryVisibilityHolder := true asValue. |
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 |
^ newDirectoryVisibilityHolder |
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 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1141 |
showButtonPanel |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1142 |
self buttonPanelVisibleHolder value:true |
3904 | 1143 |
! |
1144 |
||
3892 | 1145 |
viewFiles |
1146 |
"return the value of the instance variable 'viewFiles' (automatically generated)" |
|
1147 |
||
1148 |
^ viewFiles |
|
1149 |
! |
|
1150 |
||
1151 |
viewFiles:something |
|
1152 |
"set the value of the instance variable 'viewFiles' (automatically generated)" |
|
1153 |
||
1154 |
viewFiles := something. |
|
1155 |
! ! |
|
1156 |
||
1157 |
!FileDialog methodsFor:'aspects'! |
|
1158 |
||
4603
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1159 |
appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1160 |
appendButtonVisibleHolder isNil ifTrue:[ |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1161 |
appendButtonVisibleHolder := false asValue. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1162 |
]. |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1163 |
^ appendButtonVisibleHolder |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1164 |
! |
49cca8deebde
support an additional "append" button
Claus Gittinger <cg@exept.de>
parents:
4562
diff
changeset
|
1165 |
|
5193 | 1166 |
appendLabelHolder |
1167 |
appendLabelHolder isNil ifTrue:[ |
|
1168 |
appendLabelHolder := 'Append' asValue. |
|
1169 |
]. |
|
1170 |
^ appendLabelHolder |
|
1171 |
! |
|
1172 |
||
4804 | 1173 |
aspectOrNil:aKey forSubApplication:aSubApp |
1174 |
"this hook provides an aspect for a subApp" |
|
1175 |
||
1176 |
aKey == #currentFileNameHolder ifTrue:[ |
|
1177 |
directory notNil ifTrue:[ |
|
1178 |
^ (OrderedCollection with:directory) asValue |
|
1179 |
] |
|
1180 |
]. |
|
1181 |
^ nil |
|
1182 |
! |
|
1183 |
||
5969 | 1184 |
browseVisibleHolder |
1185 |
browseVisibleHolder isNil ifTrue:[ |
|
1186 |
browseVisibleHolder := false asValue. |
|
1187 |
]. |
|
1188 |
^ browseVisibleHolder. |
|
1189 |
! |
|
1190 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1191 |
buttonPanelVisibleHolder |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1192 |
buttonPanelVisibleHolder isNil ifTrue:[ |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1193 |
buttonPanelVisibleHolder := true asValue. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1194 |
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
|
1195 |
]. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1196 |
^ buttonPanelVisibleHolder. |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1197 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1198 |
|
3892 | 1199 |
cancelLabelHolder |
1200 |
||
1201 |
cancelLabelHolder isNil ifTrue:[ |
|
1202 |
cancelLabelHolder := 'Cancel' asValue. |
|
1203 |
]. |
|
1204 |
^ cancelLabelHolder. |
|
1205 |
! |
|
1206 |
||
1207 |
enableBack |
|
4804 | 1208 |
^ treeBrowser enableBack. |
3892 | 1209 |
! |
1210 |
||
1211 |
enableDirectoryUp |
|
4804 | 1212 |
^ treeBrowser enableDirectoryUp. |
3892 | 1213 |
! |
1214 |
||
1215 |
enableForward |
|
4804 | 1216 |
^ treeBrowser enableForward. |
3892 | 1217 |
! |
1218 |
||
1219 |
enableHome |
|
4804 | 1220 |
^ treeBrowser enableHome. |
3892 | 1221 |
! |
1222 |
||
1223 |
filenameHolder |
|
1224 |
"Return a value holder with the filename. |
|
1225 |
Shown in the filename input-field. |
|
1226 |
Being the selection in the tree. |
|
1227 |
" |
|
1228 |
|holder| |
|
1229 |
holder := builder bindingAt:#filenameHolder. |
|
1230 |
||
1231 |
holder ifNil:[ |
|
1232 |
holder := ValueHolder new. |
|
1233 |
holder addDependent:self. |
|
1234 |
builder aspectAt:#filenameHolder |
|
1235 |
put:holder. |
|
1236 |
]. |
|
1237 |
||
1238 |
^ holder. |
|
1239 |
! |
|
1240 |
||
3904 | 1241 |
filenameLabelHolder |
1242 |
"Return a value holder for the input string. |
|
1243 |
" |
|
1244 |
filenameLabelHolder isNil ifTrue:[ |
|
1245 |
filenameLabelHolder := 'Filename:' asValue. |
|
1246 |
]. |
|
1247 |
^ filenameLabelHolder |
|
1248 |
! |
|
1249 |
||
3892 | 1250 |
filterHolder |
4011 | 1251 |
"Return a value holder for filter |
3892 | 1252 |
" |
1253 |
||
1254 |
filterHolder isNil ifTrue:[ |
|
1255 |
filterHolder := treeBrowser filterModel. |
|
1256 |
self pattern notNil ifTrue:[ |
|
1257 |
filterHolder value:pattern. |
|
1258 |
] |
|
1259 |
]. |
|
1260 |
^ filterHolder |
|
1261 |
! |
|
1262 |
||
6098 | 1263 |
gotoBookmarksMenuSpec |
1264 |
<resource: #programMenu> |
|
1265 |
||
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1266 |
^ treeBrowser gotoBookmarksMenuSpec |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1267 |
"/ |menu bookmarks| |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1268 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1269 |
"/ menu := treeBrowser class emptyMenuSpec decodeAsLiteralArray. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1270 |
"/ menu findGuiResourcesIn:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1271 |
"/ menu receiver:self. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1272 |
"/ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1273 |
"/ "/ add the bookmark items ... |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1274 |
"/ bookmarks := treeBrowser class directoryBookmarks. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1275 |
"/ bookmarks notEmptyOrNil ifTrue:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1276 |
"/ bookmarks do:[:dirName | |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1277 |
"/ menu addItem:((MenuItem label:dirName asString value:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1278 |
"/ (treeBrowser currentSelectedDirectories includes:dirName) ifFalse:[ |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1279 |
"/ treeBrowser setCurrentFileName:dirName. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1280 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1281 |
"/ ])). |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1282 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1283 |
"/ ]. |
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1284 |
"/ ^ menu |
6098 | 1285 |
|
7567
9896e794a220
share the bookmarks-menu with the fileBrowser.
Claus Gittinger <cg@exept.de>
parents:
6953
diff
changeset
|
1286 |
"Modified: / 06-12-2006 / 12:05:06 / cg" |
6098 | 1287 |
! |
1288 |
||
6065 | 1289 |
listOfDeviceDrives |
1290 |
||
1291 |
listOfDeviceDrives isNil ifTrue:[ |
|
1292 |
listOfDeviceDrives := Filename volumes. |
|
1293 |
]. |
|
1294 |
^ listOfDeviceDrives |
|
1295 |
! |
|
1296 |
||
3892 | 1297 |
okLabelHolder |
1298 |
"automatically generated by UIPainter ..." |
|
1299 |
||
1300 |
"*** the code below creates a default model when invoked." |
|
1301 |
"*** (which may not be the one you wanted)" |
|
1302 |
"*** Please change as required and accept it in the browser." |
|
1303 |
"*** (and replace this comment by something more useful ;-)" |
|
1304 |
||
1305 |
okLabelHolder isNil ifTrue:[ |
|
1306 |
okLabelHolder := 'OK' asValue. |
|
1307 |
]. |
|
1308 |
^ okLabelHolder. |
|
6065 | 1309 |
! |
1310 |
||
1311 |
selectedDeviceDrive |
|
1312 |
||
1313 |
selectedDeviceDrive isNil ifTrue:[ |
|
1314 |
selectedDeviceDrive := self listOfDeviceDrives first asValue. |
|
1315 |
selectedDeviceDrive addDependent:self. |
|
1316 |
]. |
|
1317 |
^ selectedDeviceDrive |
|
3892 | 1318 |
! ! |
1319 |
||
1320 |
!FileDialog methodsFor:'change & update'! |
|
1321 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1322 |
buttonPanelVisibilityChanged |
5598 | 1323 |
|filePart| |
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1324 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1325 |
filePart := builder componentAt:#FilePart. |
5598 | 1326 |
filePart notNil ifTrue:[ |
1327 |
buttonPanelVisibleHolder value ifTrue:[ |
|
1328 |
filePart layout bottomOffset:-40 |
|
1329 |
] ifFalse:[ |
|
1330 |
filePart layout bottomOffset:0 |
|
1331 |
]. |
|
1332 |
filePart containerChangedSize "/ force resize |
|
1333 |
] |
|
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1334 |
! |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1335 |
|
6065 | 1336 |
selectedDeviceDriveChanged |
1337 |
||
1338 |
| newDrive curSel newFile| |
|
1339 |
||
1340 |
newDrive := self selectedDeviceDrive value. |
|
1341 |
curSel := treeBrowser currentFileNameHolder value. |
|
1342 |
curSel notEmpty ifTrue:[ |
|
1343 |
curSel first volume = newDrive ifTrue:[ ^self]. |
|
1344 |
]. |
|
1345 |
newDrive notNil ifTrue:[ |
|
1346 |
newFile := newDrive asFilename. |
|
1347 |
||
1348 |
newFile isReadable ifTrue:[ |
|
1349 |
treeBrowser gotoFile:newFile. |
|
1350 |
^self. |
|
1351 |
]. |
|
1352 |
]. |
|
1353 |
curSel notEmpty ifTrue:[ |
|
1354 |
self selectedDeviceDrive value:(curSel first volume). |
|
1355 |
] ifFalse:[ |
|
1356 |
self selectedDeviceDrive value:'C:'. |
|
1357 |
]. |
|
1358 |
! |
|
1359 |
||
3892 | 1360 |
update:something with:aParameter from:changedObject |
5867 | 1361 |
|files newFile newLabel fn entryFieldFilename| |
3892 | 1362 |
|
1363 |
changedObject == treeBrowser currentFileNameHolder ifTrue:[ |
|
4804 | 1364 |
files := changedObject value. |
3892 | 1365 |
|
1366 |
(files isEmpty) ifTrue:[ |
|
4804 | 1367 |
newFile := nil. |
3892 | 1368 |
] ifFalse:[ |
1369 |
files size == 1 ifTrue:[ |
|
4804 | 1370 |
newFile := files first. |
3892 | 1371 |
] ifFalse:[ |
4804 | 1372 |
newFile := ''. |
3892 | 1373 |
]. |
1374 |
]. |
|
5924 | 1375 |
(self filenameHolder value notNil |
1376 |
and:[newFile notNil |
|
1377 |
and:[newFile asFilename isDirectory]]) ifTrue:[ |
|
5867 | 1378 |
entryFieldFilename := self filenameHolder value asFilename. |
1379 |
self startFilename asFilename baseName = entryFieldFilename baseName ifTrue:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6122
diff
changeset
|
1380 |
entryFieldFilename isDirectory ifFalse:[ |
5867 | 1381 |
newFile := newFile asFilename construct:entryFieldFilename baseName. |
1382 |
]. |
|
1383 |
]. |
|
1384 |
]. |
|
4804 | 1385 |
self filenameHolder value:newFile withoutNotifying:self. |
6065 | 1386 |
OperatingSystem supportsVolumes ifTrue:[ |
1387 |
| volume | |
|
1388 |
volume := (files size >= 1) |
|
1389 |
ifTrue:[files first volume] |
|
1390 |
ifFalse:nil. |
|
1391 |
self selectedDeviceDrive value:volume. |
|
1392 |
]. |
|
3892 | 1393 |
]. |
4804 | 1394 |
|
6065 | 1395 |
changedObject == self selectedDeviceDrive ifTrue:[ |
1396 |
self selectedDeviceDriveChanged. |
|
1397 |
^ self. |
|
1398 |
]. |
|
3904 | 1399 |
changedObject == treeBrowser viewFilesInDirectoryTree ifTrue:[ |
1400 |
changedObject value ifTrue:[ |
|
4804 | 1401 |
newLabel := 'Filename:'. |
3904 | 1402 |
] ifFalse:[ |
4804 | 1403 |
newLabel := 'Directory:'. |
1404 |
]. |
|
1405 |
self filenameLabelHolder value:(resources string:newLabel) |
|
3904 | 1406 |
]. |
3892 | 1407 |
changedObject == self filenameHolder ifTrue:[ |
4804 | 1408 |
fn := changedObject value asFilename. |
1409 |
(fn exists) ifFalse:[^ self]. |
|
1410 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:fn) withoutNotifying:self. |
|
5949 | 1411 |
fn isDirectory ifTrue:[ |
1412 |
treeBrowser expandEnforceSelectedItems. |
|
1413 |
]. |
|
3892 | 1414 |
]. |
1415 |
^ super update:something with:aParameter from:changedObject |
|
1416 |
! ! |
|
1417 |
||
1418 |
!FileDialog methodsFor:'event handling'! |
|
1419 |
||
4728
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1420 |
appendWasPressed |
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1421 |
"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
|
1422 |
|
545cd2c65dfa
hooks to allow use as component in a non-modal subcanvas
Claus Gittinger <cg@exept.de>
parents:
4666
diff
changeset
|
1423 |
^ appendWasPressed |
3892 | 1424 |
! ! |
1425 |
||
1426 |
!FileDialog methodsFor:'initialization & release'! |
|
1427 |
||
5932 | 1428 |
closeDownViews |
1429 |
self remarkExtent. |
|
1430 |
super closeDownViews. |
|
1431 |
! |
|
1432 |
||
1433 |
closeWindow |
|
1434 |
self remarkExtent. |
|
1435 |
super closeWindow. |
|
1436 |
! |
|
1437 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1438 |
commonPostOpen |
6409 | 1439 |
|selection lastExtent| |
3892 | 1440 |
|
1441 |
"/ 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
|
1442 |
|
5617
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1443 |
"No ok and cancel buttons, when dialog is part of a larger dialog" |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1444 |
self window topView isModal ifFalse:[ |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1445 |
self hideButtonPanel |
2b10cdfc8b38
oops - do not hide button panel too early
Claus Gittinger <cg@exept.de>
parents:
5598
diff
changeset
|
1446 |
]. |
5934 | 1447 |
lastExtent := self class lastExtent. |
1448 |
lastExtent notNil ifTrue:[ |
|
1449 |
self window topView extent:lastExtent. |
|
1450 |
]. |
|
3892 | 1451 |
treeBrowser currentFileNameHolder addDependent:self. |
5598 | 1452 |
treeBrowser doubleClickAction:self doubleClickAction. |
3904 | 1453 |
treeBrowser viewFilesInDirectoryTree addDependent:self. |
5863
e31e066a41d9
root is one up (showing containing directory)
Claus Gittinger <cg@exept.de>
parents:
5858
diff
changeset
|
1454 |
|
6409 | 1455 |
treeBrowser rootHolder value:(self initialRootDirectory). |
4804 | 1456 |
treeBrowser viewFilesInDirectoryTree setValue:(self viewFiles ? true). |
4796 | 1457 |
treeBrowser viewFilesInDirectoryTree changed. |
5598 | 1458 |
treeBrowser currentFileNameHolder value:(OrderedCollection with:self startFilename). |
4804 | 1459 |
|
1460 |
self isLoadDialog ifTrue:[ |
|
4796 | 1461 |
treeBrowser newVisibilityHolder value:false. |
1462 |
treeBrowser allowFileOperations value:false. |
|
1463 |
self newDirectoryVisibilityHolder value:false. |
|
1464 |
]. |
|
5598 | 1465 |
self filenameHolder value:self startFilename. |
5927 | 1466 |
treeBrowser expandEnforceSelectedItems. |
5929 | 1467 |
|
1468 |
selection := treeBrowser treeSelectionHolder value. |
|
1469 |
selection notEmptyOrNil ifTrue:[ |
|
5930 | 1470 |
selection := selection asCollection first. |
5929 | 1471 |
selection enforcedExpand. |
1472 |
treeBrowser browser makeItemVisible:selection withMinimumLines:5. |
|
1473 |
]. |
|
5598 | 1474 |
self window label:self initialText. |
4796 | 1475 |
! |
1476 |
||
6409 | 1477 |
initialRootDirectory |
1478 |
"returns the directory the browser is open on |
|
1479 |
" |
|
1480 |
|root| |
|
1481 |
||
1482 |
(root := self directory) notNil ifTrue:[ |
|
1483 |
root := root asFilename. |
|
1484 |
||
1485 |
root isDirectory ifFalse:[ |
|
1486 |
root := root directory. |
|
1487 |
||
1488 |
root isDirectory ifFalse:[ |
|
1489 |
root := nil. |
|
1490 |
] |
|
1491 |
] |
|
1492 |
]. |
|
1493 |
root isNil ifTrue:[ |
|
1494 |
root := Filename currentDirectory. |
|
1495 |
]. |
|
1496 |
^ root asAbsoluteFilename |
|
1497 |
! |
|
1498 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1499 |
postBuildFileNameField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1500 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1501 |
filenameField := aWidget. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1502 |
! |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1503 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1504 |
postBuildFilterField:aWidget |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1505 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1506 |
filterField := aWidget. |
4796 | 1507 |
! |
1508 |
||
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1509 |
postBuildTreeBrowser:aSubCanvasView |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1510 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1511 |
treeBrowser := aSubCanvasView client. |
6409 | 1512 |
treeBrowser rootHolder value:(self initialRootDirectory value). |
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1513 |
! |
4796 | 1514 |
|
5903
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1515 |
postBuildWith:aBuilder |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1516 |
treeBrowser multipleSelect:multipleSelect. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1517 |
appendWasPressed := false. |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1518 |
|
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1519 |
(aBuilder componentAt:'cancelButton') cursor:(Cursor thumbsDown). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1520 |
(aBuilder componentAt:'appendButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1521 |
(aBuilder componentAt:'okButton') cursor:(Cursor thumbsUp). |
0c2fdcd6babf
make use of commonPostOpen in AppModel
Claus Gittinger <cg@exept.de>
parents:
5873
diff
changeset
|
1522 |
|
6632 | 1523 |
super postBuildWith:aBuilder |
5932 | 1524 |
! |
1525 |
||
1526 |
remarkExtent |
|
1527 |
self class lastExtent:self window topView extent. |
|
4796 | 1528 |
! ! |
1529 |
||
1530 |
!FileDialog methodsFor:'private'! |
|
1531 |
||
1532 |
returnWasPressedInFilterField |
|
1533 |
|ev| |
|
1534 |
||
1535 |
ev := self windowGroup lastEvent. |
|
1536 |
(ev notNil |
|
1537 |
and:[ev isKeyEvent |
|
1538 |
and:[ev key == #Return |
|
1539 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1540 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1541 |
^ true |
|
1542 |
]. |
|
1543 |
^ false |
|
1544 |
! |
|
1545 |
||
1546 |
returnWasPressedInFilterOrFilenameField |
|
1547 |
|ev| |
|
1548 |
||
1549 |
ev := self windowGroup lastEvent. |
|
1550 |
(ev notNil |
|
1551 |
and:[ev isKeyEvent |
|
1552 |
and:[ev key == #Return |
|
1553 |
and:[( ev targetView isSameOrComponentOf:filterField) |
|
1554 |
or:[false "ev targetView isSameOrComponentOf:filenameField"]]]]) ifTrue:[ |
|
1555 |
^ true |
|
1556 |
]. |
|
1557 |
^ false |
|
1558 |
! ! |
|
1559 |
||
6065 | 1560 |
!FileDialog methodsFor:'queries'! |
1561 |
||
1562 |
driveSelectorVisible |
|
1563 |
^ OperatingSystem isMSDOSlike |
|
1564 |
! ! |
|
1565 |
||
4796 | 1566 |
!FileDialog methodsFor:'user actions'! |
1567 |
||
1568 |
appendPressed |
|
1569 |
appendWasPressed := true. |
|
1570 |
self commonAcceptAction. |
|
1571 |
! |
|
1572 |
||
1573 |
commonAcceptAction |
|
1574 |
filenameField accept. |
|
1575 |
self result:(self filenameHolder value asString). |
|
1576 |
||
1577 |
^ super doAccept |
|
1578 |
! |
|
1579 |
||
1580 |
doAccept |
|
1581 |
"force accept - ignore in filterField" |
|
1582 |
||
1583 |
self returnWasPressedInFilterField ifTrue:[ |
|
1584 |
^ self |
|
1585 |
]. |
|
4996
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1586 |
treeBrowser hasOpenEditor ifTrue:[ |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1587 |
"/ 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
|
1588 |
treeBrowser browser closeEditor. |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1589 |
^ self |
5927cc0508e8
close the editor in treebrowser on rename if ENTER is pressed
penk
parents:
4824
diff
changeset
|
1590 |
]. |
4796 | 1591 |
appendWasPressed := false. |
1592 |
self commonAcceptAction. |
|
1593 |
! |
|
1594 |
||
1595 |
doBack |
|
1596 |
||
1597 |
treeBrowser doBack. |
|
1598 |
! |
|
1599 |
||
5966 | 1600 |
doBrowseDirectory |
1601 |
UserPreferences fileBrowserClass openOn:(treeBrowser currentDirectory ? treeBrowser rootHolder value). |
|
1602 |
||
1603 |
||
1604 |
! |
|
1605 |
||
4796 | 1606 |
doCancel |
1607 |
||
1608 |
self result:nil. |
|
1609 |
^ super doCancel. |
|
1610 |
! |
|
1611 |
||
1612 |
doForward |
|
1613 |
||
1614 |
treeBrowser doForward. |
|
1615 |
! |
|
1616 |
||
1617 |
doGoDirectoryUp |
|
1618 |
||
1619 |
treeBrowser doGoDirectoryUp. |
|
1620 |
! |
|
1621 |
||
1622 |
doGotoHomeDirectory |
|
1623 |
||
1624 |
treeBrowser doGotoHomeDirectory. |
|
1625 |
! |
|
1626 |
||
1627 |
menuDirHistory:backOrForward |
|
1628 |
||
1629 |
^ treeBrowser menuDirHistory:backOrForward. |
|
1630 |
! |
|
1631 |
||
1632 |
menuDirHistoryBack |
|
1633 |
||
1634 |
^ treeBrowser menuDirHistory:#back. |
|
1635 |
! |
|
1636 |
||
1637 |
menuDirHistoryForward |
|
1638 |
||
1639 |
^ treeBrowser menuDirHistory:#forward. |
|
1640 |
! |
|
1641 |
||
1642 |
newDirectory |
|
1643 |
||
1644 |
^ treeBrowser newDirectory |
|
1645 |
! |
|
1646 |
||
1647 |
okPressed |
|
1648 |
self doAccept |
|
1649 |
! ! |
|
1650 |
||
1651 |
!FileDialog class methodsFor:'documentation'! |
|
1652 |
||
1653 |
version |
|
7571 | 1654 |
^ '$Header: /cvs/stx/stx/libtool/FileDialog.st,v 1.92 2006-12-13 15:35:56 fm Exp $' |
4796 | 1655 |
! ! |