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