author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 May 2018 09:34:26 +0100 | |
branch | jv |
changeset 5814 | 70d07365a2d4 |
parent 5336 | c1933e2d616e |
child 5569 | 73812d992757 |
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 |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
94 |
"set the dialogs title" |
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. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
97 |
! |
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 |
directoriesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
100 |
"if true, directories are selectable only. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
101 |
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
|
102 |
anything is selectable." |
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 |
directoriesOnly ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
106 |
filesOnly := false. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
107 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
108 |
fileNameEntryField notNil ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
109 |
fileNameEntryField directoriesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
110 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
111 |
! |
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 |
filesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
114 |
"if true, files are selectable only. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
115 |
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
|
116 |
anything is selectable." |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
117 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
118 |
filesOnly := aBoolean. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
119 |
filesOnly ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
120 |
directoriesOnly := false. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
121 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
122 |
fileNameEntryField notNil ifTrue:[ |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
123 |
fileNameEntryField filesOnly:aBoolean |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
124 |
]. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
125 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
126 |
|
3251 | 127 |
historyList |
3474 | 128 |
history isNil ifTrue:[ |
4708
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
129 |
history := ValueHolder with:nil |
3474 | 130 |
]. |
131 |
^ history |
|
3251 | 132 |
! |
133 |
||
4798
88362e198319
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4797
diff
changeset
|
134 |
historyList:aCollection |
3593 | 135 |
"set the history - useful when two or more such fields shall share a common history" |
136 |
||
4798
88362e198319
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4797
diff
changeset
|
137 |
self historyList value: aCollection |
3593 | 138 |
! |
139 |
||
3594 | 140 |
initialDirectoryHolder |
141 |
"can be used to force the file-dialog into some initial directory" |
|
142 |
||
143 |
^ initialDirectoryHolder |
|
144 |
! |
|
145 |
||
3251 | 146 |
model |
147 |
^ fileNameEntryField model |
|
148 |
! |
|
149 |
||
150 |
model:aFilenameHolder |
|
151 |
fileNameEntryField model:aFilenameHolder. |
|
3950 | 152 |
! |
153 |
||
154 |
selectAllInitially |
|
155 |
fileNameEntryField selectAllInitially |
|
156 |
||
157 |
"Created: / 20-10-2010 / 17:50:23 / cg" |
|
3251 | 158 |
! ! |
159 |
||
3546 | 160 |
!FilenameWidgetWithHistory methodsFor:'accessing-channels'! |
161 |
||
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
162 |
acceptChannel:aValueHolder |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
163 |
fileNameEntryField acceptChannel:aValueHolder. |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
164 |
! |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
165 |
|
5336 | 166 |
backgroundChannel |
167 |
^ fileNameEntryField backgroundChannel |
|
168 |
||
169 |
"Created: / 17-11-2016 / 21:34:10 / cg" |
|
170 |
! |
|
171 |
||
5335 | 172 |
backgroundChannel:aValueHolder |
173 |
fileNameEntryField backgroundChannel:aValueHolder. |
|
174 |
||
175 |
"Created: / 17-11-2016 / 21:32:04 / cg" |
|
176 |
! |
|
177 |
||
3546 | 178 |
enableChannel:aValueHolder |
179 |
fileNameEntryField enableChannel:aValueHolder. |
|
180 |
browseButton enableChannel:aValueHolder. |
|
4084 | 181 |
! |
182 |
||
5336 | 183 |
foregroundChannel |
184 |
^ fileNameEntryField foregroundChannel |
|
185 |
||
186 |
"Created: / 17-11-2016 / 21:34:17 / cg" |
|
187 |
! |
|
188 |
||
5335 | 189 |
foregroundChannel:aValueHolder |
190 |
fileNameEntryField foregroundChannel:aValueHolder. |
|
191 |
||
192 |
"Created: / 17-11-2016 / 21:32:11 / cg" |
|
193 |
! |
|
194 |
||
4084 | 195 |
modifiedChannel:aValueHolder |
196 |
fileNameEntryField modifiedChannel:aValueHolder. |
|
197 |
||
198 |
"Created: / 05-10-2011 / 14:59:48 / cg" |
|
3546 | 199 |
! ! |
200 |
||
201 |
!FilenameWidgetWithHistory methodsFor:'accessing-editField attributes'! |
|
3472 | 202 |
|
203 |
acceptIfUnchanged:aBoolean |
|
204 |
fileNameEntryField acceptIfUnchanged:aBoolean |
|
205 |
! |
|
206 |
||
207 |
acceptOnLeave:aBoolean |
|
208 |
fileNameEntryField acceptOnLeave:aBoolean |
|
209 |
! |
|
210 |
||
211 |
acceptOnLostFocus:aBoolean |
|
212 |
fileNameEntryField acceptOnLostFocus:aBoolean |
|
213 |
! |
|
214 |
||
215 |
acceptOnPointerLeave:aBoolean |
|
216 |
fileNameEntryField acceptOnPointerLeave:aBoolean |
|
217 |
! |
|
218 |
||
219 |
acceptOnReturn:aBoolean |
|
220 |
fileNameEntryField acceptOnReturn:aBoolean |
|
221 |
! |
|
222 |
||
223 |
acceptOnTab:aBoolean |
|
224 |
fileNameEntryField acceptOnTab:aBoolean |
|
225 |
! |
|
226 |
||
227 |
contents:aString |
|
228 |
fileNameEntryField contents:aString |
|
229 |
! |
|
230 |
||
231 |
immediateAccept:aBoolean |
|
232 |
fileNameEntryField immediateAccept:aBoolean |
|
233 |
! |
|
234 |
||
235 |
maxChars:aBoolean |
|
236 |
fileNameEntryField maxChars:aBoolean |
|
237 |
! |
|
238 |
||
239 |
readOnly:aBoolean |
|
240 |
fileNameEntryField readOnly:aBoolean |
|
241 |
! ! |
|
242 |
||
3251 | 243 |
!FilenameWidgetWithHistory methodsFor:'initialization'! |
244 |
||
245 |
initialize |
|
246 |
super initialize. |
|
247 |
||
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
248 |
directoriesOnly := filesOnly := false. |
4708
adabb83e93bf
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
249 |
initialDirectoryHolder := ValueHolder with:nil. |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
250 |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
251 |
self initializeFilenameField. |
3251 | 252 |
fileNameEntryField layout:(LayoutFrame |
253 |
leftFraction:0 offset:0 |
|
254 |
rightFraction:1 offset:-22 |
|
255 |
topFraction:0 offset:0 |
|
256 |
bottomFraction:1 offset:0). |
|
257 |
||
3959 | 258 |
self initializeBrowseButton. |
3251 | 259 |
browseButton layout:(LayoutFrame |
260 |
leftFraction:1 offset:-22 |
|
261 |
rightFraction:1 offset:-2 |
|
262 |
topFraction:0 offset:0 |
|
263 |
bottomFraction:1 offset:0). |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
264 |
|
3959 | 265 |
"Modified: / 02-11-2010 / 19:50:33 / cg" |
266 |
! |
|
267 |
||
268 |
initializeBrowseButton |
|
269 |
browseButton := Button in:self. |
|
270 |
browseButton label:'...'. |
|
271 |
browseButton action:[ self browseForFileOrDirectory ]. |
|
272 |
||
273 |
"Created: / 02-11-2010 / 19:50:21 / cg" |
|
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
274 |
! |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
275 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
276 |
initializeFilenameField |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
277 |
fileNameEntryField := FilenameComboBoxView in:self. |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
278 |
fileNameEntryField listHolder:(self historyList). |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
279 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
280 |
"Created: / 19-10-2010 / 16:20:09 / cg" |
3251 | 281 |
! ! |
282 |
||
283 |
!FilenameWidgetWithHistory methodsFor:'queries'! |
|
284 |
||
285 |
preferredExtent |
|
3568
2f293d1e2eef
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3546
diff
changeset
|
286 |
"/ If I have an explicit preferredExtent.. |
2f293d1e2eef
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3546
diff
changeset
|
287 |
explicitExtent notNil ifTrue:[ |
2f293d1e2eef
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3546
diff
changeset
|
288 |
^ explicitExtent |
2f293d1e2eef
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3546
diff
changeset
|
289 |
]. |
2f293d1e2eef
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3546
diff
changeset
|
290 |
"/ If I have a cached preferredExtent value.. |
3251 | 291 |
preferredExtent notNil ifTrue:[ |
292 |
^ preferredExtent |
|
293 |
]. |
|
294 |
||
3427
9927e4970fce
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3318
diff
changeset
|
295 |
preferredExtent := (fileNameEntryField preferredWidth + browseButton preferredWidth) |
3251 | 296 |
@ |
3427
9927e4970fce
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3318
diff
changeset
|
297 |
(fileNameEntryField preferredHeight "max: browseButton preferredExtent y"). |
3251 | 298 |
^ preferredExtent |
299 |
! ! |
|
300 |
||
301 |
!FilenameWidgetWithHistory methodsFor:'user actions'! |
|
302 |
||
303 |
browseForDestinationDirectory |
|
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
304 |
<resource: #obsolete> |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
305 |
self obsoleteMethodWarning. |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
306 |
self browseForFileOrDirectory |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
307 |
! |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
308 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
309 |
browseForFileOrDirectory |
3594 | 310 |
|path | |
3251 | 311 |
|
4721
e3cb03ac761a
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
312 |
Dialog modifyingBoxWith:[:box | |
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
313 |
|holder| |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
314 |
|
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
315 |
holder := box perform:#browsemenuItemVisibleHolder ifNotUnderstood:[nil]. |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
316 |
holder notNil ifTrue:[ |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
317 |
holder value:true |
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
318 |
] |
3251 | 319 |
] do:[ |
3594 | 320 |
|title defaultPath defaultDir| |
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
321 |
|
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
322 |
title := dialogTitle notNil |
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
323 |
ifTrue:[ dialogTitle ] |
3959 | 324 |
ifFalse:[ |
325 |
resources string:( |
|
326 |
directoriesOnly |
|
327 |
ifTrue:[ 'Select Directory' ] |
|
328 |
ifFalse:[ |
|
329 |
filesOnly |
|
330 |
ifTrue:[ 'Select File' ] |
|
331 |
ifFalse:[ 'Select Path' ]])]. |
|
3590
c3c778e11564
fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents:
3568
diff
changeset
|
332 |
|
3950 | 333 |
defaultPath := (self model notNil) |
334 |
ifTrue:[ self model value ] |
|
335 |
ifFalse:[ fileNameEntryField contents ]. |
|
3959 | 336 |
|
4019
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
337 |
defaultPath notEmptyOrNil ifTrue:[ |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
338 |
defaultPath asFilename isAbsolute ifFalse:[ |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
339 |
baseDirectory notNil ifTrue:[ |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
340 |
defaultPath := baseDirectory asFilename construct:defaultPath. |
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
341 |
]. |
3959 | 342 |
]. |
3594 | 343 |
defaultDir := defaultPath asFilename directory. |
344 |
] ifFalse:[ |
|
345 |
defaultDir := initialDirectoryHolder value. |
|
346 |
]. |
|
347 |
path := Dialog |
|
3954
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
348 |
requestFileName:title |
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
349 |
default:defaultPath |
e28b5c4fe0c9
comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3953
diff
changeset
|
350 |
fromDirectory:defaultDir. |
3251 | 351 |
]. |
3594 | 352 |
path isEmptyOrNil ifTrue:[ ^ self ]. |
3953
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
353 |
path := path asFilename. |
3251 | 354 |
|
3959 | 355 |
baseDirectory notNil ifTrue:[ |
356 |
(path pathName startsWith:baseDirectory asFilename pathName) ifTrue:[ |
|
357 |
path := (path pathName copyFrom:(baseDirectory asFilename pathName size + 2)) asFilename. |
|
358 |
]. |
|
359 |
]. |
|
360 |
||
3953
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
361 |
initialDirectoryHolder value:path directory. |
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
362 |
path := path pathName. |
370687d1030b
changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents:
3950
diff
changeset
|
363 |
|
3594 | 364 |
"/ lastDirectoryHolder value:path directory. |
3950 | 365 |
self model notNil ifTrue:[ |
366 |
self model value:path. |
|
367 |
]. |
|
368 |
fileNameEntryField contents:path. |
|
3251 | 369 |
|
4019
33b8c1b762cb
changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
370 |
"Modified: / 08-02-2011 / 09:24:51 / cg" |
3251 | 371 |
! ! |
372 |
||
373 |
!FilenameWidgetWithHistory class methodsFor:'documentation'! |
|
374 |
||
375 |
version |
|
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
376 |
^ '$Header$' |
3940
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
377 |
! |
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
378 |
|
705b77e37f67
added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents:
3700
diff
changeset
|
379 |
version_CVS |
4797
b145bd0e466d
class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents:
4721
diff
changeset
|
380 |
^ '$Header$' |
3251 | 381 |
! ! |
4330
69a2cba2229e
aboutToOpenBoxNotificationSignal semantic change (for Jan)
Claus Gittinger <cg@exept.de>
parents:
4084
diff
changeset
|
382 |