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