author | Claus Gittinger <cg@exept.de> |
Tue, 02 Apr 2019 18:02:15 +0200 | |
changeset 6040 | a3296ee359af |
parent 5954 | 3c254cdfdfbc |
child 6239 | b3225527a33d |
permissions | -rw-r--r-- |
5954 | 1 |
"{ Encoding: utf8 }" |
2 |
||
3318 | 3 |
" |
4 |
COPYRIGHT (c) 2007 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
3251 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
4708
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
16 |
"{ NameSpace: Smalltalk }" |
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
17 |
|
3251 | 18 |
SimpleView subclass:#FilenameWidgetWithHistory |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
19 |
instanceVariableNames:'fileNameEntryField browseButton history directoriesOnly filesOnly |
5872 | 20 |
dialogTitle initialDirectoryHolder baseDirectory |
21 |
fileNameTranslationHook' |
|
3251 | 22 |
classVariableNames:'' |
23 |
poolDictionaries:'' |
|
24 |
category:'Views-Interactors' |
|
25 |
! |
|
26 |
||
27 |
!FilenameWidgetWithHistory class methodsFor:'documentation'! |
|
28 |
||
3318 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 2007 by eXept Software AG |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
3471 | 43 |
documentation |
44 |
" |
|
45 |
A Filename InputField with history-list and a browse-button, which opens a file dialog. |
|
46 |
||
47 |
[author:] |
|
48 |
Claus Gittinger |
|
49 |
||
50 |
[see also:] |
|
51 |
ComboBoxView |
|
52 |
FilenameEditField |
|
53 |
FilenameComboBoxView |
|
54 |
" |
|
55 |
! |
|
56 |
||
3251 | 57 |
examples |
58 |
" |
|
59 |
[exBegin] |
|
60 |
|top b| |
|
61 |
||
62 |
top := StandardSystemView new. |
|
63 |
top extent:(300 @ 200). |
|
64 |
||
65 |
b := FilenameWidgetWithHistory in:top. |
|
66 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0). |
|
67 |
b bottomInset:(b preferredExtent y negated). |
|
68 |
||
69 |
top open. |
|
70 |
[exEnd] |
|
71 |
" |
|
72 |
! ! |
|
73 |
||
74 |
!FilenameWidgetWithHistory methodsFor:'accessing'! |
|
75 |
||
3950 | 76 |
acceptOnExpand:aBoolean |
77 |
fileNameEntryField acceptOnExpand:aBoolean |
|
78 |
||
79 |
"Created: / 20-10-2010 / 17:49:54 / cg" |
|
80 |
! |
|
81 |
||
3959 | 82 |
baseDirectory |
83 |
^ baseDirectory |
|
84 |
! |
|
85 |
||
86 |
baseDirectory:something |
|
87 |
baseDirectory := something. |
|
88 |
! |
|
89 |
||
3950 | 90 |
contents |
91 |
^ fileNameEntryField contents |
|
92 |
||
93 |
"Created: / 20-10-2010 / 17:51:07 / cg" |
|
94 |
! |
|
95 |
||
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
96 |
dialogTitle:something |
5569 | 97 |
"set the dialog's title" |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
98 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
99 |
dialogTitle := something. |
5569 | 100 |
|
101 |
"Modified (comment): / 03-08-2017 / 14:39:00 / cg" |
|
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
102 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
103 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
104 |
directoriesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
105 |
"if true, directories are selectable only. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
106 |
If both filesOnly and directoriesOnly are false, which is the default, |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
107 |
anything is selectable." |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
108 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
109 |
directoriesOnly := aBoolean. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
110 |
directoriesOnly ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
111 |
filesOnly := false. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
112 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
113 |
fileNameEntryField notNil ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
114 |
fileNameEntryField directoriesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
115 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
116 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
117 |
|
5872 | 118 |
fileNameTranslationHook |
119 |
^ fileNameTranslationHook |
|
120 |
! |
|
121 |
||
122 |
fileNameTranslationHook:aBlock |
|
123 |
"an optional hook which gets the filename from the editField |
|
124 |
and produces a full path for the file dialog (in the ...-button). |
|
125 |
Use this, if the filename contains $(xxx) variables to be expanded" |
|
126 |
||
127 |
fileNameTranslationHook := aBlock. |
|
128 |
! |
|
129 |
||
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
130 |
filesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
131 |
"if true, files are selectable only. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
132 |
If both filesOnly and directoriesOnly are false, which is the default, |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
133 |
anything is selectable." |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
134 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
135 |
filesOnly := aBoolean. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
136 |
filesOnly ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
137 |
directoriesOnly := false. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
138 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
139 |
fileNameEntryField notNil ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
140 |
fileNameEntryField filesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
141 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
142 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
143 |
|
3251 | 144 |
historyList |
3474 | 145 |
history isNil ifTrue:[ |
4708
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
146 |
history := ValueHolder with:nil |
3474 | 147 |
]. |
148 |
^ history |
|
3251 | 149 |
! |
150 |
||
4798
88362e198319
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4797
diff
changeset
|
151 |
historyList:aCollection |
3593 | 152 |
"set the history - useful when two or more such fields shall share a common history" |
153 |
||
4798
88362e198319
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4797
diff
changeset
|
154 |
self historyList value: aCollection |
3593 | 155 |
! |
156 |
||
3594 | 157 |
initialDirectoryHolder |
158 |
"can be used to force the file-dialog into some initial directory" |
|
159 |
||
160 |
^ initialDirectoryHolder |
|
161 |
! |
|
162 |
||
3251 | 163 |
model |
164 |
^ fileNameEntryField model |
|
165 |
! |
|
166 |
||
167 |
model:aFilenameHolder |
|
168 |
fileNameEntryField model:aFilenameHolder. |
|
3950 | 169 |
! |
170 |
||
171 |
selectAllInitially |
|
172 |
fileNameEntryField selectAllInitially |
|
173 |
||
174 |
"Created: / 20-10-2010 / 17:50:23 / cg" |
|
3251 | 175 |
! ! |
176 |
||
3546 | 177 |
!FilenameWidgetWithHistory methodsFor:'accessing-channels'! |
178 |
||
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
179 |
acceptChannel:aValueHolder |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
180 |
fileNameEntryField acceptChannel:aValueHolder. |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
181 |
! |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
182 |
|
5336 | 183 |
backgroundChannel |
184 |
^ fileNameEntryField backgroundChannel |
|
185 |
||
186 |
"Created: / 17-11-2016 / 21:34:10 / cg" |
|
187 |
! |
|
188 |
||
5335 | 189 |
backgroundChannel:aValueHolder |
190 |
fileNameEntryField backgroundChannel:aValueHolder. |
|
191 |
||
192 |
"Created: / 17-11-2016 / 21:32:04 / cg" |
|
193 |
! |
|
194 |
||
3546 | 195 |
enableChannel:aValueHolder |
196 |
fileNameEntryField enableChannel:aValueHolder. |
|
197 |
browseButton enableChannel:aValueHolder. |
|
4084 | 198 |
! |
199 |
||
5336 | 200 |
foregroundChannel |
201 |
^ fileNameEntryField foregroundChannel |
|
202 |
||
203 |
"Created: / 17-11-2016 / 21:34:17 / cg" |
|
204 |
! |
|
205 |
||
5335 | 206 |
foregroundChannel:aValueHolder |
207 |
fileNameEntryField foregroundChannel:aValueHolder. |
|
208 |
||
209 |
"Created: / 17-11-2016 / 21:32:11 / cg" |
|
210 |
! |
|
211 |
||
4084 | 212 |
modifiedChannel:aValueHolder |
213 |
fileNameEntryField modifiedChannel:aValueHolder. |
|
214 |
||
215 |
"Created: / 05-10-2011 / 14:59:48 / cg" |
|
3546 | 216 |
! ! |
217 |
||
218 |
!FilenameWidgetWithHistory methodsFor:'accessing-editField attributes'! |
|
3472 | 219 |
|
220 |
acceptIfUnchanged:aBoolean |
|
221 |
fileNameEntryField acceptIfUnchanged:aBoolean |
|
222 |
! |
|
223 |
||
224 |
acceptOnLeave:aBoolean |
|
225 |
fileNameEntryField acceptOnLeave:aBoolean |
|
226 |
! |
|
227 |
||
228 |
acceptOnLostFocus:aBoolean |
|
229 |
fileNameEntryField acceptOnLostFocus:aBoolean |
|
230 |
! |
|
231 |
||
232 |
acceptOnPointerLeave:aBoolean |
|
233 |
fileNameEntryField acceptOnPointerLeave:aBoolean |
|
234 |
! |
|
235 |
||
236 |
acceptOnReturn:aBoolean |
|
237 |
fileNameEntryField acceptOnReturn:aBoolean |
|
238 |
! |
|
239 |
||
240 |
acceptOnTab:aBoolean |
|
241 |
fileNameEntryField acceptOnTab:aBoolean |
|
242 |
! |
|
243 |
||
244 |
contents:aString |
|
245 |
fileNameEntryField contents:aString |
|
246 |
! |
|
247 |
||
248 |
immediateAccept:aBoolean |
|
249 |
fileNameEntryField immediateAccept:aBoolean |
|
250 |
! |
|
251 |
||
252 |
maxChars:aBoolean |
|
253 |
fileNameEntryField maxChars:aBoolean |
|
254 |
! |
|
255 |
||
256 |
readOnly:aBoolean |
|
257 |
fileNameEntryField readOnly:aBoolean |
|
258 |
! ! |
|
259 |
||
3251 | 260 |
!FilenameWidgetWithHistory methodsFor:'initialization'! |
261 |
||
262 |
initialize |
|
263 |
super initialize. |
|
264 |
||
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
265 |
directoriesOnly := filesOnly := false. |
4708
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
266 |
initialDirectoryHolder := ValueHolder with:nil. |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
267 |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
268 |
self initializeFilenameField. |
3251 | 269 |
fileNameEntryField layout:(LayoutFrame |
270 |
leftFraction:0 offset:0 |
|
271 |
rightFraction:1 offset:-22 |
|
272 |
topFraction:0 offset:0 |
|
273 |
bottomFraction:1 offset:0). |
|
274 |
||
3959 | 275 |
self initializeBrowseButton. |
3251 | 276 |
browseButton layout:(LayoutFrame |
277 |
leftFraction:1 offset:-22 |
|
278 |
rightFraction:1 offset:-2 |
|
279 |
topFraction:0 offset:0 |
|
280 |
bottomFraction:1 offset:0). |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
281 |
|
3959 | 282 |
"Modified: / 02-11-2010 / 19:50:33 / cg" |
283 |
! |
|
284 |
||
285 |
initializeBrowseButton |
|
286 |
browseButton := Button in:self. |
|
287 |
browseButton label:'...'. |
|
288 |
browseButton action:[ self browseForFileOrDirectory ]. |
|
289 |
||
290 |
"Created: / 02-11-2010 / 19:50:21 / cg" |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
291 |
! |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
292 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
293 |
initializeFilenameField |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
294 |
fileNameEntryField := FilenameComboBoxView in:self. |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
295 |
fileNameEntryField listHolder:(self historyList). |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
296 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
297 |
"Created: / 19-10-2010 / 16:20:09 / cg" |
3251 | 298 |
! ! |
299 |
||
300 |
!FilenameWidgetWithHistory methodsFor:'queries'! |
|
301 |
||
5954 | 302 |
computePreferredExtent |
303 |
^ (fileNameEntryField preferredWidth + browseButton preferredWidth) |
|
304 |
@ |
|
305 |
(fileNameEntryField preferredHeight "max: browseButton preferredExtent y"). |
|
3251 | 306 |
|
5954 | 307 |
"Created: / 09-11-2018 / 19:52:52 / Claus Gittinger" |
3251 | 308 |
! ! |
309 |
||
310 |
!FilenameWidgetWithHistory methodsFor:'user actions'! |
|
311 |
||
312 |
browseForDestinationDirectory |
|
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
313 |
<resource: #obsolete> |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
314 |
self obsoleteMethodWarning. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
315 |
self browseForFileOrDirectory |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
316 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
317 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
318 |
browseForFileOrDirectory |
3594 | 319 |
|path | |
3251 | 320 |
|
4721
e3cb03ac761a
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
321 |
Dialog modifyingBoxWith:[:box | |
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
322 |
|holder| |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
323 |
|
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
324 |
holder := box perform:#browsemenuItemVisibleHolder ifNotUnderstood:[nil]. |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
325 |
holder notNil ifTrue:[ |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
326 |
holder value:true |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
327 |
] |
3251 | 328 |
] do:[ |
3594 | 329 |
|title defaultPath defaultDir| |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
330 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
331 |
title := dialogTitle notNil |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
332 |
ifTrue:[ dialogTitle ] |
3959 | 333 |
ifFalse:[ |
334 |
resources string:( |
|
335 |
directoriesOnly |
|
336 |
ifTrue:[ 'Select Directory' ] |
|
337 |
ifFalse:[ |
|
338 |
filesOnly |
|
339 |
ifTrue:[ 'Select File' ] |
|
340 |
ifFalse:[ 'Select Path' ]])]. |
|
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
341 |
|
3950 | 342 |
defaultPath := (self model notNil) |
343 |
ifTrue:[ self model value ] |
|
344 |
ifFalse:[ fileNameEntryField contents ]. |
|
3959 | 345 |
|
4019
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
346 |
defaultPath notEmptyOrNil ifTrue:[ |
5872 | 347 |
fileNameTranslationHook notNil ifTrue:[ |
348 |
defaultPath := fileNameTranslationHook value:defaultPath |
|
349 |
]. |
|
4019
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
350 |
defaultPath asFilename isAbsolute ifFalse:[ |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
351 |
baseDirectory notNil ifTrue:[ |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
352 |
defaultPath := baseDirectory asFilename construct:defaultPath. |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
353 |
]. |
3959 | 354 |
]. |
3594 | 355 |
defaultDir := defaultPath asFilename directory. |
356 |
] ifFalse:[ |
|
357 |
defaultDir := initialDirectoryHolder value. |
|
358 |
]. |
|
359 |
path := Dialog |
|
3954
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
360 |
requestFileName:title |
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
361 |
default:defaultPath |
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
362 |
fromDirectory:defaultDir. |
3251 | 363 |
]. |
3594 | 364 |
path isEmptyOrNil ifTrue:[ ^ self ]. |
3953
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
365 |
path := path asFilename. |
3251 | 366 |
|
3959 | 367 |
baseDirectory notNil ifTrue:[ |
368 |
(path pathName startsWith:baseDirectory asFilename pathName) ifTrue:[ |
|
369 |
path := (path pathName copyFrom:(baseDirectory asFilename pathName size + 2)) asFilename. |
|
370 |
]. |
|
371 |
]. |
|
372 |
||
3953
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
373 |
initialDirectoryHolder value:path directory. |
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
374 |
path := path pathName. |
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
375 |
|
3594 | 376 |
"/ lastDirectoryHolder value:path directory. |
3950 | 377 |
self model notNil ifTrue:[ |
378 |
self model value:path. |
|
379 |
]. |
|
380 |
fileNameEntryField contents:path. |
|
3251 | 381 |
|
4019
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
382 |
"Modified: / 08-02-2011 / 09:24:51 / cg" |
3251 | 383 |
! ! |
384 |
||
385 |
!FilenameWidgetWithHistory class methodsFor:'documentation'! |
|
386 |
||
387 |
version |
|
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
388 |
^ '$Header$' |
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
389 |
! |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
390 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
391 |
version_CVS |
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
392 |
^ '$Header$' |
3251 | 393 |
! ! |
4330
69a2cba2229e
aboutToOpenBoxNotificationSignal semantic change (for Jan)
Claus Gittinger <cg@exept.de>
parents:
4084
diff
changeset
|
394 |