author | Claus Gittinger <cg@exept.de> |
Fri, 25 Nov 2011 15:25:42 +0100 | |
changeset 517 | 6201502d98fb |
parent 504 | 9cd65fe6164f |
child 518 | 25286b5b0829 |
permissions | -rw-r--r-- |
320 | 1 |
"{ Package: 'stx:goodies/monticello' }" |
2 |
||
3 |
AbstractSettingsApplication subclass:#MCSettingsApp |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Monticello-St/X UI' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!MCSettingsApp class methodsFor:'* As yet uncategorized *'! |
|
12 |
||
13 |
managerTypeName |
|
14 |
||
15 |
^ 'Monticello' |
|
16 |
||
17 |
"Created: / 21-07-2011 / 11:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
18 |
! ! |
|
19 |
||
20 |
!MCSettingsApp class methodsFor:'help specs'! |
|
21 |
||
22 |
flyByHelpSpec |
|
23 |
||
24 |
<resource: #help> |
|
25 |
||
26 |
^self helpSpec |
|
27 |
||
28 |
"Created: / 26-05-2008 / 14:25:31 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29 |
! |
|
30 |
||
31 |
helpSpec |
|
32 |
"This resource specification was automatically generated |
|
33 |
by the UIHelpTool of ST/X." |
|
34 |
||
35 |
"Do not manually edit this!! If it is corrupted, |
|
36 |
the UIHelpTool may not be able to read the specification." |
|
37 |
||
38 |
" |
|
39 |
UIHelpTool openOnClass:SVN::SettingsApp |
|
40 |
" |
|
41 |
||
42 |
<resource: #help> |
|
43 |
||
44 |
^ super helpSpec addPairsFrom:#( |
|
45 |
||
46 |
#Package |
|
47 |
'' |
|
48 |
||
49 |
) |
|
50 |
||
51 |
"Modified: / 26-05-2008 / 14:24:15 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
52 |
! ! |
|
53 |
||
54 |
!MCSettingsApp class methodsFor:'image specs'! |
|
55 |
||
56 |
defaultIcon |
|
57 |
||
58 |
"^SVN::IconLibrary svn_wizban2 magnifiedTo: 24@24" |
|
59 |
^nil |
|
60 |
||
61 |
"Created: / 26-05-2008 / 14:55:55 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
62 |
"Modified: / 16-09-2010 / 14:02:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 |
! |
|
64 |
||
65 |
svnIcon |
|
66 |
"^ IconLibrary svn_wizban" |
|
67 |
^nil |
|
68 |
||
69 |
"Created: / 24-05-2008 / 01:44:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
70 |
"Modified: / 16-09-2010 / 14:02:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 |
! ! |
|
72 |
||
73 |
!MCSettingsApp class methodsFor:'interface opening'! |
|
74 |
||
75 |
open |
|
76 |
||
77 |
| settingsApp | |
|
78 |
||
79 |
settingsApp := SettingsDialog new. |
|
80 |
settingsApp addApplClass:self fullName |
|
81 |
withName:'Subversion'. |
|
82 |
settingsApp showRoot: false. |
|
83 |
settingsApp selectedItem value: |
|
84 |
(settingsApp applicationList root children anyOne). |
|
85 |
settingsApp open. |
|
86 |
||
87 |
"Created: / 26-05-2008 / 12:17:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
88 |
"Modified: / 27-02-2010 / 17:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 |
! ! |
|
90 |
||
91 |
!MCSettingsApp class methodsFor:'interface specs'! |
|
92 |
||
93 |
windowSpec |
|
94 |
"This resource specification was automatically generated |
|
95 |
by the UIPainter of ST/X." |
|
96 |
||
97 |
"Do not manually edit this!! If it is corrupted, |
|
98 |
the UIPainter may not be able to read the specification." |
|
99 |
||
100 |
" |
|
101 |
UIPainter new openOnClass:MCSettingsApp andSelector:#windowSpec |
|
102 |
MCSettingsApp new openInterface:#windowSpec |
|
103 |
MCSettingsApp open |
|
104 |
" |
|
105 |
||
106 |
<resource: #canvas> |
|
107 |
||
108 |
^ |
|
109 |
#(FullSpec |
|
110 |
name: windowSpec |
|
111 |
window: |
|
112 |
(WindowSpec |
|
113 |
label: 'Monticello Settings' |
|
114 |
name: 'Monticello Settings' |
|
115 |
min: (Point 10 10) |
|
116 |
bounds: (Rectangle 0 0 695 627) |
|
117 |
) |
|
118 |
component: |
|
119 |
(SpecCollection |
|
120 |
collection: ( |
|
121 |
(LabelSpec |
|
122 |
label: ' Monticello Settings' |
|
123 |
name: 'Title' |
|
124 |
layout: (LayoutFrame 0 0 0 0 0 1 66 0) |
|
125 |
style: (FontDescription helvetica medium roman 18 #'iso10646-1') |
|
126 |
backgroundColor: (Color 100.0 100.0 100.0) |
|
127 |
translateLabel: true |
|
128 |
adjust: left |
|
129 |
) |
|
130 |
(LabelSpec |
|
131 |
label: 'Icon' |
|
132 |
name: 'Icon' |
|
133 |
layout: (LayoutFrame -75 1 0 0 0 1 66 0) |
|
134 |
initiallyInvisible: true |
|
135 |
hasCharacterOrientedLabel: false |
|
136 |
backgroundColor: (Color 100.0 100.0 100.0) |
|
137 |
translateLabel: true |
|
138 |
) |
|
139 |
(VerticalPanelViewSpec |
|
140 |
name: 'Controls' |
|
141 |
layout: (LayoutFrame 0 0 70 0 0 1 0 1) |
|
142 |
horizontalLayout: fit |
|
143 |
verticalLayout: topFit |
|
144 |
horizontalSpace: 3 |
|
145 |
verticalSpace: 3 |
|
146 |
component: |
|
147 |
(SpecCollection |
|
148 |
collection: ( |
|
149 |
(HorizontalPanelViewSpec |
|
150 |
name: 'EnabledAndResetPanel' |
|
151 |
horizontalLayout: rightSpaceFit |
|
152 |
verticalLayout: fit |
|
153 |
horizontalSpace: 0 |
|
154 |
verticalSpace: 3 |
|
155 |
component: |
|
156 |
(SpecCollection |
|
157 |
collection: ( |
|
158 |
(CheckBoxSpec |
|
159 |
label: 'Enable Monticello Manager' |
|
160 |
name: 'Enabled' |
|
161 |
model: mcEnabled |
|
162 |
translateLabel: true |
|
163 |
useDefaultExtent: true |
|
164 |
) |
|
165 |
(ActionButtonSpec |
|
166 |
label: 'Flush caches' |
|
167 |
name: 'ResetCachedRepositoriesButton' |
|
168 |
translateLabel: true |
|
169 |
model: flushCaches |
|
170 |
enableChannel: mcEnabled |
|
171 |
useDefaultExtent: true |
|
172 |
) |
|
173 |
) |
|
174 |
||
175 |
) |
|
176 |
useDefaultExtent: true |
|
177 |
) |
|
178 |
(FramedBoxSpec |
|
179 |
label: 'Repositories' |
|
180 |
name: 'Repositories' |
|
181 |
labelPosition: topLeft |
|
182 |
translateLabel: true |
|
183 |
component: |
|
184 |
(SpecCollection |
|
185 |
collection: ( |
|
186 |
(VerticalPanelViewSpec |
|
187 |
name: 'RepositoryConfigurations' |
|
188 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
189 |
horizontalLayout: fit |
|
190 |
verticalLayout: bottomFit |
|
191 |
horizontalSpace: 3 |
|
192 |
verticalSpace: 3 |
|
193 |
component: |
|
194 |
(SpecCollection |
|
195 |
collection: ( |
|
196 |
(ViewSpec |
|
197 |
name: 'RepositoryConfigurationListBox' |
|
198 |
model: mcRepositories |
|
199 |
component: |
|
200 |
(SpecCollection |
|
201 |
collection: ( |
|
202 |
(SelectionInListModelViewSpec |
|
203 |
name: 'RepositoryList' |
|
204 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
205 |
enableChannel: mcEnabled |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
206 |
model: selectedRepositoryHolder |
320 | 207 |
hasHorizontalScrollBar: true |
208 |
hasVerticalScrollBar: true |
|
209 |
listModel: mcRepositories |
|
210 |
useIndex: false |
|
211 |
highlightMode: line |
|
212 |
) |
|
213 |
) |
|
214 |
||
215 |
) |
|
461 | 216 |
extent: (Point 661 464) |
320 | 217 |
) |
218 |
(HorizontalPanelViewSpec |
|
219 |
name: 'AddRemovePanel' |
|
220 |
horizontalLayout: fit |
|
221 |
verticalLayout: center |
|
222 |
horizontalSpace: 3 |
|
223 |
verticalSpace: 3 |
|
224 |
component: |
|
225 |
(SpecCollection |
|
226 |
collection: ( |
|
227 |
(ActionButtonSpec |
|
461 | 228 |
label: 'Add Repository...' |
320 | 229 |
name: 'AddConfigurationAction' |
230 |
translateLabel: true |
|
231 |
model: addRepositoryAction |
|
232 |
enableChannel: mcEnabled |
|
461 | 233 |
extent: (Point 329 25) |
320 | 234 |
) |
235 |
(ActionButtonSpec |
|
461 | 236 |
label: 'Remove Repository...' |
320 | 237 |
name: 'RemoveConfigurationAction' |
238 |
translateLabel: true |
|
239 |
model: removeRepositoryAction |
|
240 |
enableChannel: mcEnabled |
|
461 | 241 |
extent: (Point 329 25) |
320 | 242 |
) |
243 |
) |
|
244 |
||
245 |
) |
|
461 | 246 |
extent: (Point 661 30) |
320 | 247 |
) |
248 |
) |
|
249 |
||
250 |
) |
|
251 |
) |
|
252 |
) |
|
253 |
||
254 |
) |
|
461 | 255 |
extent: (Point 695 530) |
320 | 256 |
) |
257 |
) |
|
258 |
||
259 |
) |
|
260 |
) |
|
261 |
) |
|
262 |
||
263 |
) |
|
264 |
) |
|
265 |
! ! |
|
266 |
||
267 |
!MCSettingsApp methodsFor:'accessing'! |
|
268 |
||
269 |
repositoryConfiguration |
|
270 |
||
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
271 |
^self selectedRepositoryHolder value |
320 | 272 |
|
273 |
"Created: / 26-05-2008 / 12:04:54 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
274 |
"Modified: / 27-09-2011 / 11:55:22 / cg" |
320 | 275 |
! |
276 |
||
277 |
repositoryConfiguration: anObject |
|
278 |
||
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
279 |
self selectedRepositoryHolder value: anObject |
320 | 280 |
|
281 |
"Created: / 26-05-2008 / 12:12:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
282 |
"Modified: / 27-09-2011 / 11:55:24 / cg" |
320 | 283 |
! |
284 |
||
285 |
repositoryConfigurationList |
|
286 |
||
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
287 |
^self mcRepositories value |
320 | 288 |
|
289 |
"Created: / 26-05-2008 / 12:05:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
290 |
"Modified: / 27-09-2011 / 11:50:53 / cg" |
320 | 291 |
! |
292 |
||
293 |
repositoryManager |
|
294 |
||
295 |
^RepositoryManager current |
|
296 |
||
297 |
"Created: / 26-05-2008 / 10:46:30 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
298 |
! |
|
299 |
||
300 |
workingCopyBase |
|
301 |
||
302 |
^self workingCopyBaseAspect value |
|
303 |
||
304 |
"Created: / 26-05-2008 / 13:15:22 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
305 |
! ! |
|
306 |
||
307 |
!MCSettingsApp methodsFor:'actions'! |
|
308 |
||
309 |
addRepositoryAction |
|
310 |
||
311 |
| dialog class codeHolder repo | |
|
312 |
class := Dialog |
|
313 |
choose:'Select repository type' |
|
314 |
fromList:#('HTTP repository' 'Local repository') |
|
315 |
values:(Array with: MCHttpRepository with: MCDirectoryRepository) |
|
316 |
lines:5 cancel:[^self]. |
|
317 |
||
318 |
codeHolder := ValueHolder new. |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
319 |
dialog := Dialog forRequestText:'Please Fill in Data' lines:10 columns:60 initialAnswer: class creationTemplate model:codeHolder. |
320 | 320 |
dialog open. |
321 |
dialog accepted ifFalse:[^self]. |
|
322 |
repo := Compiler evaluate: codeHolder value. |
|
323 |
self mcRepositories value add: repo. |
|
324 |
self mcRepositories changed. |
|
325 |
||
326 |
"Created: / 26-05-2008 / 12:04:30 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
327 |
"Modified: / 16-08-2009 / 17:24:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
328 |
"Modified: / 16-09-2010 / 14:33:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
329 |
"Modified: / 27-09-2011 / 11:49:42 / cg" |
320 | 330 |
! |
331 |
||
332 |
flushCaches |
|
333 |
<resource: #uiCallback> |
|
334 |
||
335 |
"automatically generated by UIPainter..." |
|
336 |
||
337 |
"*** the code below performs no action" |
|
338 |
"*** (except for some feedback on the Transcript)" |
|
339 |
"*** Please change as required and accept in the browser." |
|
340 |
"*** (and replace this comment by something more useful ;-)" |
|
341 |
||
342 |
"action to be defined here..." |
|
343 |
||
344 |
Transcript showCR:self class name, ': action for flushCaches ...'. |
|
345 |
! |
|
346 |
||
347 |
removeRepositoryAction |
|
348 |
self repositoryConfiguration ifNotNil: |
|
349 |
[ self repositoryConfigurationList remove: self repositoryConfiguration ]. |
|
350 |
||
351 |
"Created: / 26-05-2008 / 12:04:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
352 |
! ! |
|
353 |
||
354 |
!MCSettingsApp methodsFor:'aspects'! |
|
355 |
||
356 |
mcEnabled |
|
357 |
||
358 |
^self settingsAspectFor: #mcEnabled |
|
359 |
||
360 |
"Created: / 16-09-2010 / 14:14:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
361 |
! |
|
362 |
||
363 |
mcRepositories |
|
364 |
||
365 |
^self settingsAspectFor: #mcRepositories |
|
366 |
||
367 |
"Created: / 16-09-2010 / 14:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
504
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
368 |
! |
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
369 |
|
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
370 |
selectedRepositoryHolder |
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
371 |
|
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
372 |
^self settingsAspectFor: #selectedRepositoryHolder |
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
373 |
|
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
374 |
"Created: / 16-09-2010 / 14:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9cd65fe6164f
added: #selectedRepositoryHolder
Claus Gittinger <cg@exept.de>
parents:
461
diff
changeset
|
375 |
"Created: / 27-09-2011 / 11:55:01 / cg" |
320 | 376 |
! ! |
377 |
||
378 |
!MCSettingsApp methodsFor:'helpers'! |
|
379 |
||
380 |
settingsAspectFor: settingName |
|
381 |
||
382 |
|holder| |
|
383 |
||
384 |
self createBuilder. |
|
385 |
||
386 |
(holder := builder bindingAt:settingName) ifNil: |
|
387 |
[holder := (currentUserPrefs perform: settingName asSymbol) |
|
388 |
asValue. |
|
389 |
holder onChangeSend:#updateModifiedChannel to:self. |
|
390 |
builder aspectAt:settingName put:holder |
|
391 |
]. |
|
392 |
^ holder. |
|
393 |
||
394 |
"Created: / 25-05-2009 / 18:43:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
395 |
! ! |
|
396 |
||
397 |
!MCSettingsApp methodsFor:'protocol'! |
|
398 |
||
399 |
basicReadSettings |
|
400 |
||
401 |
self |
|
402 |
readAspects: #(mcEnabled mcRepositories) |
|
403 |
from:currentUserPrefs. |
|
404 |
||
405 |
"Modified: / 16-09-2010 / 14:14:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
406 |
! |
|
407 |
||
408 |
basicSaveSettings |
|
409 |
||
410 |
self |
|
411 |
writeAspects: #(mcEnabled mcRepositories) |
|
412 |
to:currentUserPrefs. |
|
413 |
||
414 |
"Created: / 19-04-2008 / 09:42:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
415 |
"Modified: / 25-05-2009 / 19:06:45 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
416 |
"Modified: / 16-09-2010 / 14:35:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
417 |
! |
|
418 |
||
419 |
helpFilename |
|
420 |
"subclasses must return the relative name of a helpFile |
|
421 |
in the doc/online/<language>/help directory. |
|
422 |
Or nil, if no help is available." |
|
423 |
||
424 |
^nil |
|
425 |
||
426 |
"Created: / 19-04-2008 / 09:42:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
427 |
"Modified: / 26-05-2008 / 13:12:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
428 |
! ! |
|
429 |
||
430 |
!MCSettingsApp methodsFor:'queries'! |
|
431 |
||
432 |
hasUnsavedChanges |
|
517 | 433 |
^ self |
320 | 434 |
hasChangedAspectIn: #(mcEnabled mcRepositories) |
517 | 435 |
asComparedTo:currentUserPrefs |
320 | 436 |
|
437 |
"Created: / 28-05-2008 / 07:33:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
438 |
"Modified: / 19-08-2009 / 12:07:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
439 |
"Modified: / 16-09-2010 / 14:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 | 440 |
"Modified (format): / 25-11-2011 / 15:24:38 / cg" |
320 | 441 |
! ! |
442 |
||
443 |
!MCSettingsApp class methodsFor:'documentation'! |
|
444 |
||
445 |
version |
|
517 | 446 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.4 2011-11-25 14:25:42 cg Exp $' |
320 | 447 |
! |
448 |
||
449 |
version_CVS |
|
517 | 450 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSettingsApp.st,v 1.4 2011-11-25 14:25:42 cg Exp $' |
320 | 451 |
! |
452 |
||
453 |
version_SVN |
|
454 |
^ '§Id: MCSettingsApp.st 33 2011-07-21 11:26:12Z vranyj1 §' |
|
455 |
! ! |