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