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