author | Claus Gittinger <cg@exept.de> |
Mon, 11 Feb 2008 15:24:42 +0100 | |
changeset 7973 | 7fb67608aa3e |
parent 7967 | 2560906ca552 |
child 8258 | 77eecb901a6a |
permissions | -rw-r--r-- |
5141 | 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 |
" |
|
3712 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
Object subclass:#CodeGeneratorTool |
|
5758 | 15 |
instanceVariableNames:'compositeChangeCollector compositeChangeNesting' |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
16 |
classVariableNames:'GenerateCommentsForGetters GenerateCommentsForSetters' |
3712 | 17 |
poolDictionaries:'' |
18 |
category:'Interface-Browsers' |
|
19 |
! |
|
20 |
||
3719 | 21 |
!CodeGeneratorTool class methodsFor:'documentation'! |
22 |
||
5141 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
3719 | 37 |
documentation |
38 |
" |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
39 |
This utility class contains various code generation facilites; |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
40 |
these were extracted from the old and newBrowser. |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
41 |
There is probably more to come... |
3719 | 42 |
|
43 |
[author:] |
|
44 |
Claus Gittiner |
|
45 |
" |
|
46 |
! ! |
|
3712 | 47 |
|
48 |
!CodeGeneratorTool class methodsFor:'code generation'! |
|
49 |
||
50 |
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
51 |
"create accessors in aClass" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
52 |
|
5758 | 53 |
^ self new |
6313 | 54 |
createAccessMethodsFor:aCollectionOfVarNames |
55 |
in:aClass |
|
56 |
withChange:withChange |
|
57 |
asValueHolder:asValueHolder |
|
58 |
readersOnly:readersOnly |
|
59 |
writersOnly:writersOnly |
|
4444
6b077945517c
generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
60 |
! |
6b077945517c
generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
61 |
|
3712 | 62 |
createApplicationCodeFor:aClass |
63 |
"create an empty application framework" |
|
64 |
||
5758 | 65 |
^ self new createApplicationCodeFor:aClass |
3712 | 66 |
! |
67 |
||
3804 | 68 |
createClassResponsibleProtocolFor:aClass |
69 |
"create stubs for the required protocol" |
|
70 |
||
5758 | 71 |
^ self new createClassResponsibleProtocolFor:aClass |
3804 | 72 |
! |
73 |
||
5124 | 74 |
createClassTypeTestMethodsIn:aClass forClasses:subClasses |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
75 |
"create a #isXXX test methods (I'm tired of typing)" |
4351 | 76 |
|
5758 | 77 |
^ self new createClassTypeTestMethodsIn:aClass forClasses:subClasses |
4351 | 78 |
! |
79 |
||
3712 | 80 |
createDocumentationMethodsFor:aClass |
81 |
"create empty documentation methods" |
|
82 |
||
5758 | 83 |
^ self new createDocumentationMethodsFor:aClass |
3712 | 84 |
! |
85 |
||
6313 | 86 |
createEnumTypeCodeFor:aClass |
87 |
^ self new createEnumTypeCodeFor:aClass |
|
88 |
! |
|
89 |
||
6718 | 90 |
createInitializedInstanceCreationMethodsIn:aClass |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
91 |
"create a #new and #initialize methods (I'm tired of typing)" |
3712 | 92 |
|
6718 | 93 |
^ self new createInitializedInstanceCreationMethodsIn:aClass |
94 |
! |
|
95 |
||
96 |
createParametrizedInstanceCreationMethodsNamed:selector in:aClass |
|
97 |
"create a #selector instance creation method (I'm tired of typing)" |
|
98 |
||
99 |
^ self new createParametrizedInstanceCreationMethodsNamed:selector in:aClass |
|
3712 | 100 |
! |
101 |
||
102 |
createTestCaseSampleCodeFor:aClass |
|
4590 | 103 |
"create an (almost) empty testCase class" |
3712 | 104 |
|
5758 | 105 |
^ self new createTestCaseSampleCodeFor:aClass |
3712 | 106 |
! |
107 |
||
108 |
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
109 |
"create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)" |
3712 | 110 |
|
5758 | 111 |
^ self new createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass |
3712 | 112 |
! |
113 |
||
6050 | 114 |
createWebApplicationCodeFor:aClass |
115 |
"create an empty webApplication framework" |
|
116 |
||
117 |
^ self new createWebApplicationCodeFor:aClass |
|
118 |
! |
|
119 |
||
7973 | 120 |
createWebServiceCodeFor:aClass |
121 |
"create an empty webService framework" |
|
122 |
||
123 |
^ self new createWebServiceCodeFor:aClass |
|
124 |
! |
|
125 |
||
3712 | 126 |
initialMenuSpecMethodSourceForApplications |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
127 |
"return a menuSpec with typical stuff in it" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
128 |
|
3712 | 129 |
^ |
130 |
'mainMenu |
|
131 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
132 |
||
133 |
"Do not manually edit this!! If it is corrupted, |
|
134 |
the MenuEditor may not be able to read the specification." |
|
135 |
||
136 |
" |
|
137 |
MenuEditor new openOnClass:%1 andSelector:#mainMenu |
|
138 |
" |
|
139 |
||
140 |
<resource: #menu> |
|
141 |
||
142 |
^ #(#Menu |
|
143 |
#( |
|
144 |
#(#MenuItem |
|
145 |
#label: ''File'' |
|
146 |
#translateLabel: true |
|
147 |
#submenu: |
|
148 |
#(#Menu |
|
149 |
#( |
|
150 |
#(#MenuItem |
|
151 |
#label: ''New'' |
|
152 |
#translateLabel: true |
|
153 |
#value: #menuNew |
|
154 |
) |
|
155 |
#(#MenuItem |
|
156 |
#label: ''-'' |
|
157 |
) |
|
158 |
#(#MenuItem |
|
159 |
#label: ''Open...'' |
|
160 |
#translateLabel: true |
|
161 |
#value: #menuOpen |
|
162 |
) |
|
163 |
#(#MenuItem |
|
164 |
#label: ''-'' |
|
165 |
) |
|
166 |
#(#MenuItem |
|
167 |
#label: ''Save'' |
|
168 |
#translateLabel: true |
|
169 |
#value: #menuSave |
|
170 |
) |
|
171 |
#(#MenuItem |
|
172 |
#label: ''Save As...'' |
|
173 |
#translateLabel: true |
|
174 |
#value: #menuSaveAs |
|
175 |
) |
|
176 |
#(#MenuItem |
|
177 |
#label: ''-'' |
|
178 |
) |
|
179 |
#(#MenuItem |
|
180 |
#label: ''Exit'' |
|
181 |
#translateLabel: true |
|
182 |
#value: #closeRequest |
|
183 |
) |
|
184 |
) nil |
|
185 |
nil |
|
186 |
) |
|
187 |
) |
|
188 |
#(#MenuItem |
|
189 |
#label: ''Help'' |
|
190 |
#translateLabel: true |
|
191 |
#startGroup: #right |
|
192 |
#submenu: |
|
193 |
#(#Menu |
|
194 |
#( |
|
195 |
#(#MenuItem |
|
196 |
#label: ''Documentation'' |
|
197 |
#translateLabel: true |
|
198 |
#value: #openDocumentation |
|
199 |
) |
|
200 |
#(#MenuItem |
|
201 |
#label: ''-'' |
|
202 |
) |
|
203 |
#(#MenuItem |
|
6643 | 204 |
#label: ''About this Application...'' |
3712 | 205 |
#translateLabel: true |
206 |
#value: #openAboutThisApplication |
|
207 |
) |
|
208 |
) nil |
|
209 |
nil |
|
210 |
) |
|
211 |
) |
|
212 |
) nil |
|
213 |
nil |
|
214 |
) |
|
215 |
'. |
|
216 |
! |
|
217 |
||
7973 | 218 |
initialPageMenuSpec |
219 |
"return a menuSpec with typical stuff in it" |
|
220 |
||
221 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
222 |
||
223 |
"Do not manually edit this!! If it is corrupted, |
|
224 |
the MenuEditor may not be able to read the specification." |
|
225 |
||
226 |
" |
|
227 |
MenuEditor new openOnClass:%1 andSelector:#mainMenu |
|
228 |
" |
|
229 |
||
230 |
<resource: #menu> |
|
231 |
||
232 |
^ #(#Menu |
|
233 |
#( |
|
234 |
#(#MenuItem |
|
235 |
#label: 'AAA' |
|
236 |
#translateLabel: true |
|
237 |
#submenu: |
|
238 |
#(#Menu |
|
239 |
#( |
|
240 |
#(#MenuItem |
|
241 |
#label: 'New' |
|
242 |
#translateLabel: true |
|
243 |
#value: #menuNew |
|
244 |
) |
|
245 |
#(#MenuItem |
|
246 |
#label: '-' |
|
247 |
) |
|
248 |
#(#MenuItem |
|
249 |
#label: 'Open...' |
|
250 |
#translateLabel: true |
|
251 |
#value: #menuOpen |
|
252 |
) |
|
253 |
#(#MenuItem |
|
254 |
#label: '-' |
|
255 |
) |
|
256 |
#(#MenuItem |
|
257 |
#label: 'Save' |
|
258 |
#translateLabel: true |
|
259 |
#value: #menuSave |
|
260 |
) |
|
261 |
#(#MenuItem |
|
262 |
#label: 'Save As...' |
|
263 |
#translateLabel: true |
|
264 |
#value: #menuSaveAs |
|
265 |
) |
|
266 |
#(#MenuItem |
|
267 |
#label: '-' |
|
268 |
) |
|
269 |
#(#MenuItem |
|
270 |
#label: 'Exit' |
|
271 |
#translateLabel: true |
|
272 |
#value: #closeRequest |
|
273 |
) |
|
274 |
) nil |
|
275 |
nil |
|
276 |
) |
|
277 |
) |
|
278 |
#(#MenuItem |
|
279 |
#label: 'Help' |
|
280 |
#translateLabel: true |
|
281 |
#startGroup: #right |
|
282 |
#submenu: |
|
283 |
#(#Menu |
|
284 |
#( |
|
285 |
#(#MenuItem |
|
286 |
#label: 'Documentation' |
|
287 |
#translateLabel: true |
|
288 |
#value: #openDocumentation |
|
289 |
) |
|
290 |
#(#MenuItem |
|
291 |
#label: '-' |
|
292 |
) |
|
293 |
#(#MenuItem |
|
294 |
#label: 'About this Application...' |
|
295 |
#translateLabel: true |
|
296 |
#value: #openAboutThisApplication |
|
297 |
) |
|
298 |
) nil |
|
299 |
nil |
|
300 |
) |
|
301 |
) |
|
302 |
) nil |
|
303 |
nil |
|
304 |
) |
|
305 |
! |
|
306 |
||
307 |
initialPageMenuSpecMethodSourceForWebApplications |
|
308 |
"return a menuSpec with typical stuff in it" |
|
309 |
||
310 |
^ |
|
311 |
'mainMenu |
|
312 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
313 |
||
314 |
"Do not manually edit this!! If it is corrupted, |
|
315 |
the MenuEditor may not be able to read the specification." |
|
316 |
||
317 |
" |
|
318 |
MenuEditor new openOnClass:%1 andSelector:#mainMenu |
|
319 |
" |
|
320 |
||
321 |
<resource: #menu> |
|
322 |
||
323 |
^ ',(self initialPageMenuSpec decodeAsLiteralArray literalArrayEncoding storeString),' |
|
324 |
'. |
|
325 |
||
326 |
" |
|
327 |
self initialPageMenuSpecMethodSourceForWebApplications |
|
328 |
" |
|
329 |
! |
|
330 |
||
331 |
initialPageSpecMethodSourceForWebApplications |
|
332 |
"return an empty pageSpec" |
|
333 |
||
334 |
^ |
|
335 |
'pageSpec |
|
336 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
337 |
||
338 |
"Do not manually edit this!! If it is corrupted, |
|
339 |
the UIPainter may not be able to read the specification." |
|
340 |
||
341 |
" |
|
342 |
UIPainter new openOnClass:%1 andSelector:#windowSpec |
|
343 |
" |
|
344 |
||
345 |
<resource: #canvas> |
|
346 |
||
347 |
^ #(#FullSpec |
|
348 |
#window: |
|
349 |
#(#WindowSpec |
|
350 |
#name: ''%1'' |
|
351 |
#layout: #(#LayoutFrame 204 0 162 0 503 0 461 0) |
|
352 |
#label: ''%1'' |
|
353 |
#min: #(#Point 10 10) |
|
354 |
#max: #(#Point 1024 768) |
|
355 |
#bounds: #(#Rectangle 204 162 504 462) |
|
356 |
#menu: #pageMenu |
|
357 |
#usePreferredExtent: false |
|
358 |
) |
|
359 |
#component: |
|
360 |
#(#SpecCollection |
|
361 |
#collection: #() |
|
362 |
) |
|
363 |
) |
|
364 |
'. |
|
365 |
! |
|
366 |
||
3712 | 367 |
initialWindowSpecMethodSourceForApplications |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
368 |
"return an empty windowSpec with an initial menubar in it" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
369 |
|
3712 | 370 |
^ |
371 |
'windowSpec |
|
372 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
373 |
||
374 |
"Do not manually edit this!! If it is corrupted, |
|
375 |
the UIPainter may not be able to read the specification." |
|
376 |
||
377 |
" |
|
378 |
UIPainter new openOnClass:%1 andSelector:#windowSpec |
|
379 |
" |
|
380 |
||
381 |
<resource: #canvas> |
|
382 |
||
383 |
^ #(#FullSpec |
|
384 |
#window: |
|
385 |
#(#WindowSpec |
|
386 |
#name: ''%1'' |
|
387 |
#layout: #(#LayoutFrame 204 0 162 0 503 0 461 0) |
|
388 |
#label: ''%1'' |
|
389 |
#min: #(#Point 10 10) |
|
390 |
#max: #(#Point 1024 768) |
|
391 |
#bounds: #(#Rectangle 204 162 504 462) |
|
392 |
#menu: #mainMenu |
|
393 |
#usePreferredExtent: false |
|
394 |
) |
|
395 |
#component: |
|
396 |
#(#SpecCollection |
|
397 |
#collection: #() |
|
398 |
) |
|
399 |
) |
|
400 |
'. |
|
401 |
! |
|
402 |
||
403 |
initialWindowSpecMethodSourceForDialogs |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
404 |
"return an empty windowSpec for dialogs" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
405 |
|
3712 | 406 |
^ |
407 |
'windowSpec |
|
408 |
"This resource specification was automatically generated by the CodeGeneratorTool." |
|
409 |
||
410 |
"Do not manually edit this!! If it is corrupted, |
|
411 |
the UIPainter may not be able to read the specification." |
|
412 |
||
413 |
" |
|
414 |
UIPainter new openOnClass:%1 andSelector:#windowSpec |
|
415 |
" |
|
416 |
||
417 |
<resource: #canvas> |
|
418 |
||
419 |
^ |
|
420 |
||
421 |
#(#FullSpec |
|
422 |
#window: |
|
423 |
#(#WindowSpec |
|
424 |
#name: ''%1'' |
|
425 |
#layout: #(#LayoutFrame 221 0 118 0 520 0 417 0) |
|
426 |
#level: 0 |
|
427 |
#label: ''%1'' |
|
428 |
#min: #(#Point 10 10) |
|
429 |
#max: #(#Point 1024 768) |
|
430 |
#bounds: #(#Rectangle 221 118 521 418) |
|
431 |
#usePreferredExtent: false |
|
432 |
) |
|
433 |
#component: |
|
434 |
#(#SpecCollection |
|
435 |
#collection: |
|
436 |
#( |
|
437 |
#(#HorizontalPanelViewSpec |
|
438 |
#name: ''buttonPanel'' |
|
439 |
#layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 0 1.0) |
|
440 |
#component: |
|
441 |
#(#SpecCollection |
|
442 |
#collection: |
|
443 |
#( |
|
444 |
#(#ActionButtonSpec |
|
445 |
#name: ''cancelButton'' |
|
446 |
#label: ''Cancel'' |
|
447 |
#tabable: true |
|
448 |
#translateLabel: true |
|
449 |
#model: #cancel |
|
450 |
#extent: #(#Point 125 22) |
|
451 |
) |
|
452 |
#(#ActionButtonSpec |
|
453 |
#name: ''okButton'' |
|
454 |
#label: ''OK'' |
|
455 |
#tabable: true |
|
456 |
#translateLabel: true |
|
457 |
#isDefault: true |
|
458 |
#model: #accept |
|
459 |
#extent: #(#Point 125 22) |
|
460 |
) |
|
461 |
) |
|
462 |
) |
|
463 |
#reverseOrderIfOKAtLeft: true |
|
464 |
#horizontalLayout: #spreadSpaceMax |
|
465 |
#verticalLayout: #center |
|
466 |
#horizontalSpace: 3 |
|
467 |
#verticalSpace: 3 |
|
468 |
) |
|
469 |
) |
|
470 |
) |
|
471 |
) |
|
472 |
'. |
|
473 |
! ! |
|
474 |
||
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
475 |
!CodeGeneratorTool class methodsFor:'code generation-basic'! |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
476 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
477 |
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
478 |
"workhorse for creating access methods for instvars." |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
479 |
|
5758 | 480 |
^ self new |
481 |
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization |
|
482 |
! ! |
|
483 |
||
484 |
!CodeGeneratorTool class methodsFor:'code generation-individual methods'! |
|
485 |
||
486 |
createAcceptVisitorMethod:selector in:aClass |
|
487 |
"create an acceptVisitor: method |
|
488 |
(I'm tired of typing)" |
|
489 |
||
490 |
^ self new createAcceptVisitorMethod:selector in:aClass |
|
491 |
! |
|
492 |
||
493 |
createAcceptVisitorMethodIn:aClass |
|
494 |
"create an acceptVisitor: method |
|
495 |
(I'm tired of typing)" |
|
496 |
||
497 |
^ self new createAcceptVisitorMethodIn:aClass |
|
498 |
! |
|
499 |
||
500 |
createCopyrightMethodFor:aClass |
|
501 |
"add copyright method containing your/your companies |
|
502 |
copyright template but only if not already present. |
|
503 |
this is only added, if specified in the |
|
504 |
COPYRIGHT_TEMPLATE_FILE resources." |
|
505 |
||
506 |
^ self new createCopyrightMethodFor:aClass |
|
507 |
! |
|
508 |
||
509 |
createDocumentationMethodFor:aClass |
|
510 |
"add documentation method containing doc template |
|
511 |
but only if not already present." |
|
512 |
||
513 |
^ self new createDocumentationMethodFor:aClass |
|
514 |
! |
|
515 |
||
516 |
createExamplesMethodFor:aClass |
|
517 |
"add examples method containing examples template |
|
518 |
but only if not already present." |
|
519 |
||
520 |
^ self new createExamplesMethodFor:aClass |
|
521 |
! |
|
522 |
||
523 |
createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel |
|
524 |
^ self new createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel |
|
525 |
! |
|
526 |
||
527 |
createInitialHistoryMethodFor:aClass |
|
528 |
"add history method containing created-entry |
|
529 |
but only if not already present." |
|
530 |
||
531 |
^ self new createInitialHistoryMethodFor:aClass |
|
532 |
! |
|
533 |
||
534 |
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass |
|
535 |
"add an inst-creation method" |
|
536 |
||
537 |
^ self new createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass |
|
538 |
! |
|
539 |
||
540 |
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass |
|
541 |
"create a multi-setter method for instvars." |
|
542 |
||
543 |
^ self new createMultiSetterMethodFor:aCollectionOfVarNames in:aClass |
|
544 |
! |
|
545 |
||
546 |
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass |
|
547 |
"add a subclassResponsibility method; |
|
548 |
but only if not already present." |
|
549 |
||
550 |
^ self new createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass |
|
551 |
! |
|
552 |
||
553 |
createUpdateMethodIn:aClass |
|
554 |
"create an update:with:from:-method |
|
555 |
(I'm tired of typing)" |
|
556 |
||
557 |
^ self new createUpdateMethodIn:aClass |
|
558 |
! |
|
559 |
||
560 |
createVersionMethodFor:aClass |
|
561 |
"add version method containing RCS template |
|
562 |
but only if not already present and its not a private class." |
|
563 |
||
564 |
^ self new createVersionMethodFor:aClass |
|
565 |
! ! |
|
566 |
||
7973 | 567 |
!CodeGeneratorTool class methodsFor:'code generation-menus'! |
568 |
||
569 |
createActionMethodFor:aSelector in:aClass category:aCategory redefine:redefine |
|
570 |
|alreadyInSuperclass method code| |
|
571 |
||
572 |
(aClass includesSelector:aSelector) ifTrue:[ |
|
573 |
^ nil |
|
574 |
]. |
|
575 |
||
576 |
alreadyInSuperclass := aClass superclass canUnderstand:aSelector. |
|
577 |
(alreadyInSuperclass and:[redefine not]) ifTrue:[ |
|
578 |
^ nil |
|
579 |
]. |
|
580 |
||
581 |
method := self methodNameTemplateFor:aSelector. |
|
582 |
||
583 |
code := '%1 |
|
584 |
"automatically generated by UIEditor ..." |
|
585 |
||
586 |
"*** the code below performs no action" |
|
587 |
"*** (except for some feedback on the Transcript)" |
|
588 |
"*** Please change as required and accept in the browser." |
|
589 |
"*** (and replace this comment by something more useful ;-)" |
|
590 |
||
591 |
"action to be added ..." |
|
592 |
||
593 |
Transcript showCR:self class name, '': action for #%2 ...''. |
|
594 |
' bindWith:method with:aSelector. |
|
595 |
||
596 |
alreadyInSuperclass ifTrue:[ |
|
597 |
code := code, (('\ super %1\' bindWith:method) withCRs). |
|
598 |
]. |
|
599 |
self compile:code forClass:aClass inCategory:(aCategory ? 'actions'). |
|
600 |
^ code |
|
601 |
! |
|
602 |
||
603 |
createAspectMethodFor:aSelector in:aClass category:aCategory redefine:redefine |
|
604 |
|alreadyInSuperclass method code text| |
|
605 |
||
606 |
(aClass includesSelector:aSelector) ifTrue:[ |
|
607 |
^ nil |
|
608 |
]. |
|
609 |
||
610 |
alreadyInSuperclass := aClass superclass canUnderstand:aSelector. |
|
611 |
(alreadyInSuperclass and:[redefine not]) ifTrue:[ |
|
612 |
^ nil |
|
613 |
]. |
|
614 |
||
615 |
method := self methodNameTemplateFor:aSelector. |
|
616 |
||
617 |
code := '%1 |
|
618 |
"automatically generated by UIEditor ..." |
|
619 |
||
620 |
"*** the code below creates a default model when invoked" |
|
621 |
"*** (which may not be the one you wanted)" |
|
622 |
"*** Please change as required and accept in the browser." |
|
623 |
"*** (and replace this comment by something more useful ;-)" |
|
624 |
||
625 |
"aspect to be added ..." |
|
626 |
||
627 |
Transcript showCR:self class name, '': aspect for #%2 ...''. |
|
628 |
||
629 |
' bindWith:method with:aSelector. |
|
630 |
||
631 |
alreadyInSuperclass ifTrue:[ |
|
632 |
text := ' ^ super %1\' bindWith:method. |
|
633 |
] ifFalse:[ |
|
634 |
text := ' ^ builder valueAspectFor:#''%1'' initialValue:true\' bindWith:aSelector. |
|
635 |
]. |
|
636 |
code := code, (text withCRs). |
|
637 |
self compile:code forClass:aClass inCategory:(aCategory ? 'actions'). |
|
638 |
^ code |
|
639 |
! ! |
|
640 |
||
5758 | 641 |
!CodeGeneratorTool class methodsFor:'compilation'! |
642 |
||
643 |
compile:theCode forClass:aClass inCategory:cat |
|
644 |
"install some code for a class. |
|
645 |
If refactory browser stuff is avaliable the refactory tools are used to support undo" |
|
646 |
||
647 |
^ self new compile:theCode forClass:aClass inCategory:cat |
|
648 |
! ! |
|
649 |
||
650 |
!CodeGeneratorTool class methodsFor:'private'! |
|
651 |
||
652 |
canUseRefactoringSupport |
|
653 |
"check if refactory browser stuff is avaliable" |
|
654 |
||
655 |
^ RefactoryChangeManager notNil |
|
656 |
and:[RefactoryChangeManager isLoaded |
|
657 |
and:[UserPreferences current useRefactoringSupport]] |
|
7973 | 658 |
! |
659 |
||
660 |
methodNameTemplateFor:aSelector |
|
661 |
|numArgs method| |
|
662 |
||
663 |
numArgs := aSelector numArgs. |
|
664 |
numArgs == 1 ifTrue:[ |
|
665 |
method := aSelector, 'anArgument'. |
|
666 |
] ifFalse:[ |
|
667 |
numArgs == 0 ifTrue:[ |
|
668 |
method := aSelector |
|
669 |
] ifFalse:[ |
|
670 |
method := ''. |
|
671 |
aSelector keywords keysAndValuesDo:[:i :key| |
|
672 |
method := method, key, 'arg', i printString, ' '. |
|
673 |
]. |
|
674 |
] |
|
675 |
]. |
|
676 |
^ method |
|
5758 | 677 |
! ! |
678 |
||
5759 | 679 |
!CodeGeneratorTool methodsFor:'buld changes'! |
680 |
||
5763 | 681 |
addChange:aChange |
682 |
compositeChangeCollector addChange:aChange |
|
683 |
! |
|
684 |
||
5759 | 685 |
executeCollectedChangesNamed:name |
686 |
compositeChangeCollector notNil ifTrue:[ |
|
687 |
compositeChangeNesting := compositeChangeNesting - 1. |
|
688 |
compositeChangeNesting == 0 ifTrue:[ |
|
689 |
compositeChangeCollector name:name. |
|
690 |
compositeChangeCollector changesSize == 0 ifTrue:[ |
|
691 |
self information:'Nothing generated.'. |
|
692 |
] ifFalse:[ |
|
7037 | 693 |
RefactoryChangeManager performChange:compositeChangeCollector. |
5759 | 694 |
]. |
695 |
compositeChangeCollector := nil. |
|
696 |
] |
|
697 |
] |
|
698 |
! |
|
699 |
||
700 |
startCollectChanges |
|
701 |
(self canUseRefactoringSupport) ifTrue:[ |
|
702 |
compositeChangeCollector isNil ifTrue:[ |
|
703 |
compositeChangeCollector := CompositeRefactoryChange new. |
|
704 |
compositeChangeNesting := 0. |
|
705 |
]. |
|
706 |
compositeChangeNesting := compositeChangeNesting + 1. |
|
707 |
] |
|
708 |
! ! |
|
709 |
||
5758 | 710 |
!CodeGeneratorTool methodsFor:'code generation'! |
711 |
||
712 |
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly |
|
713 |
"create accessors in aClass" |
|
714 |
||
715 |
self |
|
716 |
createAccessMethodsFor:aCollectionOfVarNames |
|
717 |
in:aClass |
|
718 |
withChange:withChange |
|
719 |
asValueHolder:asValueHolder |
|
720 |
readersOnly:readersOnly |
|
721 |
writersOnly:writersOnly |
|
722 |
lazyInitialization:false |
|
723 |
! |
|
724 |
||
725 |
createApplicationCodeFor:aClass |
|
726 |
"create an empty application framework" |
|
727 |
||
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
728 |
|nonMetaClass metaClass className txt isDialog |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
729 |
categoryForMenuActionsMethods compileMenuAction compileTemplateAction| |
5758 | 730 |
|
731 |
self startCollectChanges. |
|
732 |
||
733 |
categoryForMenuActionsMethods := UserPreferences current categoryForMenuActionsMethods. |
|
734 |
||
735 |
nonMetaClass := aClass theNonMetaclass. |
|
736 |
metaClass := aClass theMetaclass. |
|
737 |
className := nonMetaClass name. |
|
738 |
||
739 |
isDialog := (nonMetaClass isSubclassOf:SimpleDialog). |
|
740 |
||
741 |
"/ add a windowSpec method for an empty applicationWindow, |
|
742 |
"/ with a menuPanel. |
|
743 |
||
744 |
(metaClass includesSelector:#windowSpec) ifFalse:[ |
|
745 |
isDialog ifTrue:[ |
|
746 |
txt := self class initialWindowSpecMethodSourceForDialogs. |
|
747 |
] ifFalse:[ |
|
748 |
txt := self class initialWindowSpecMethodSourceForApplications. |
|
749 |
]. |
|
750 |
self |
|
751 |
compile:(txt bindWith:className) |
|
752 |
forClass:metaClass |
|
753 |
inCategory:'interface specs'. |
|
754 |
]. |
|
755 |
||
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
756 |
compileTemplateAction := |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
757 |
[:selector :category | |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
758 |
(nonMetaClass includesSelector:selector) ifFalse:[ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
759 |
|codeTemplateSelector| |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
760 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
761 |
codeTemplateSelector := ('codeFor_',(selector upTo:$:)) asSymbol. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
762 |
txt := self perform:codeTemplateSelector. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
763 |
self |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
764 |
compile:txt |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
765 |
forClass:nonMetaClass |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
766 |
inCategory:(category = '*' ifTrue:categoryForMenuActionsMethods ifFalse:category). |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
767 |
] |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
768 |
]. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
769 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
770 |
#( |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
771 |
#'postBuildWith:' 'initialization & release' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
772 |
#'postOpenWith:' 'initialization & release' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
773 |
) pairWiseDo:compileTemplateAction. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
774 |
|
5758 | 775 |
isDialog ifFalse:[ |
776 |
"/ add a topMenu method |
|
777 |
||
778 |
(metaClass includesSelector:#mainMenu) ifFalse:[ |
|
779 |
txt := self class initialMenuSpecMethodSourceForApplications. |
|
780 |
self |
|
781 |
compile:(txt bindWith:className) |
|
782 |
forClass:metaClass |
|
783 |
inCategory:'menu specs'. |
|
784 |
]. |
|
785 |
||
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
786 |
#( |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
787 |
#'hasUnsavedChanges' 'private queries' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
788 |
#'closeRequest' 'initialization & release' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
789 |
#'closeDownViews' 'initialization & release' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
790 |
#'menuSaveAs' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
791 |
#'menuNew' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
792 |
#'menuOpen' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
793 |
#'menuSave' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
794 |
#'doSaveAs' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
795 |
#'openDocumentation' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
796 |
#'openAboutThisApplication' '*' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
797 |
) pairWiseDo:compileTemplateAction. |
5758 | 798 |
]. |
799 |
||
800 |
isDialog ifTrue:[ |
|
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
801 |
#( |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
802 |
#'closeAccept' 'user actions' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
803 |
) pairWiseDo:compileTemplateAction. |
5758 | 804 |
]. |
805 |
||
6050 | 806 |
self executeCollectedChangesNamed:('Add Application Code for ' , className). |
5758 | 807 |
|
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
808 |
"Modified: / 27-10-2006 / 10:21:58 / cg" |
5758 | 809 |
! |
810 |
||
811 |
createClassResponsibleProtocolFor:aClass |
|
812 |
"create stubs for the required protocol" |
|
813 |
||
6050 | 814 |
|nonMetaClass metaClass className| |
815 |
||
816 |
nonMetaClass := aClass theNonMetaclass. |
|
817 |
metaClass := aClass theMetaclass. |
|
818 |
className := nonMetaClass name. |
|
819 |
||
5758 | 820 |
self startCollectChanges. |
821 |
||
6050 | 822 |
self privCreateClassResponsibleProtocolFor:nonMetaClass. |
823 |
self privCreateClassResponsibleProtocolFor:metaClass. |
|
5758 | 824 |
|
6050 | 825 |
self executeCollectedChangesNamed:('Add Required Protocol to ' , className). |
5758 | 826 |
! |
827 |
||
828 |
createClassTypeTestMethodsIn:aClass forClasses:subClasses |
|
829 |
"create a #isXXX test methods (I'm tired of typing)" |
|
830 |
||
831 |
| code| |
|
832 |
||
833 |
self startCollectChanges. |
|
834 |
||
835 |
subClasses do:[:eachSubClass | |
|
836 |
|nm selector| |
|
837 |
||
838 |
nm := eachSubClass nameWithoutPrefix. |
|
839 |
selector := 'is' , nm. |
|
840 |
(aClass includesSelector:selector) ifFalse:[ |
|
841 |
code := (selector , '\ ^ false') withCRs. |
|
842 |
self |
|
843 |
compile:code |
|
844 |
forClass:aClass |
|
845 |
inCategory:'testing'. |
|
846 |
]. |
|
847 |
(eachSubClass includesSelector:selector) ifFalse:[ |
|
848 |
code := (selector , '\ ^ true') withCRs. |
|
849 |
self |
|
850 |
compile:code |
|
851 |
forClass:eachSubClass |
|
852 |
inCategory:'testing'. |
|
853 |
]. |
|
854 |
]. |
|
855 |
||
5759 | 856 |
self executeCollectedChangesNamed:'Add ClassType Tests' |
5758 | 857 |
! |
858 |
||
859 |
createDocumentationMethodsFor:aClass |
|
860 |
"create empty documentation methods" |
|
861 |
||
6050 | 862 |
|nonMetaClass metaClass className| |
5758 | 863 |
|
6050 | 864 |
nonMetaClass := aClass theNonMetaclass. |
865 |
metaClass := aClass theMetaclass. |
|
866 |
className := nonMetaClass name. |
|
5758 | 867 |
|
868 |
self startCollectChanges. |
|
869 |
||
6050 | 870 |
self createVersionMethodFor:metaClass. |
871 |
self createCopyrightMethodFor:metaClass. |
|
872 |
self createDocumentationMethodFor:metaClass. |
|
873 |
self createInitialHistoryMethodFor:metaClass. |
|
5758 | 874 |
|
6050 | 875 |
self executeCollectedChangesNamed:('Add Documentation to ' , className). |
5758 | 876 |
! |
877 |
||
6313 | 878 |
createEnumTypeCodeFor:aClass |
879 |
|nonMetaClass metaClass className enumValues code initCode runValue maxValue| |
|
880 |
||
881 |
self startCollectChanges. |
|
882 |
||
883 |
nonMetaClass := aClass theNonMetaclass. |
|
884 |
metaClass := aClass theMetaclass. |
|
885 |
className := nonMetaClass name. |
|
886 |
||
887 |
enumValues := nonMetaClass classVarNames. |
|
888 |
enumValues do:[:eachVariableName | |
|
889 |
self |
|
890 |
createAccessMethodsFor:(Array with:eachVariableName) |
|
891 |
in:metaClass |
|
892 |
withChange:false |
|
893 |
asValueHolder:false |
|
894 |
readersOnly:true |
|
895 |
writersOnly:false |
|
896 |
]. |
|
897 |
||
898 |
maxValue := enumValues inject:0 into:[:maxSoFar :eachVariableName | |oldVal val| |
|
899 |
oldVal := nonMetaClass classVarAt:eachVariableName. |
|
900 |
oldVal notNil ifTrue:[ val := oldVal numericValue ]. |
|
901 |
(val ? maxSoFar) max:maxSoFar]. |
|
902 |
||
903 |
initCode := WriteStream on: String new. |
|
904 |
initCode nextPutLine:'initialize'. |
|
905 |
runValue := maxValue + 1. |
|
906 |
enumValues keysAndValuesDo:[:idx :eachVariableName | |
|
907 |
|oldValue thisValue| |
|
908 |
||
909 |
oldValue := nonMetaClass classVarAt:eachVariableName. |
|
910 |
oldValue notNil ifTrue:[ |
|
911 |
thisValue := oldValue numericValue. |
|
912 |
] ifFalse:[ |
|
913 |
thisValue := runValue. |
|
914 |
runValue := runValue + 1. |
|
915 |
]. |
|
916 |
initCode |
|
917 |
nextPutAll:' '; |
|
918 |
nextPutAll:eachVariableName; |
|
919 |
nextPutAll:' := self basicNew'. |
|
920 |
(aClass canUnderstand:#'setNumericValue:') ifTrue:[ |
|
921 |
initCode nextPutAll:' setNumericValue: ',thisValue printString. |
|
922 |
]. |
|
923 |
(aClass canUnderstand:#'setCssClassString:') ifTrue:[ |
|
924 |
initCode nextPutAll:('; setCssClassString: ''' , nonMetaClass nameWithoutPrefix asLowercaseFirst , eachVariableName , ''''). |
|
925 |
]. |
|
926 |
(aClass canUnderstand:#'setName:') ifTrue:[ |
|
927 |
initCode nextPutAll:('; setName: ''' , eachVariableName asLowercaseFirst , ''''). |
|
928 |
]. |
|
929 |
initCode nextPutLine:'.'. |
|
930 |
]. |
|
931 |
initCode cr. |
|
932 |
initCode nextPutLine:' "'. |
|
933 |
initCode nextPutLine:' ',className, ' initialize'. |
|
934 |
initCode nextPutLine:' "'. |
|
935 |
||
936 |
self |
|
937 |
compile:(initCode contents) |
|
938 |
forClass:metaClass |
|
939 |
inCategory:'class initialization'. |
|
940 |
||
941 |
||
942 |
code := 'allStateNames\ ^ #( ' , |
|
6341 | 943 |
((enumValues collect:[:each | '#''',each asLowercaseFirst,'''']) asStringWith:' ') , ')', |
6313 | 944 |
'\\ "\' , |
945 |
' ',className, ' allStateNames\' , |
|
946 |
' "\'. |
|
947 |
self |
|
948 |
compile:code withCRs |
|
949 |
forClass:metaClass |
|
950 |
inCategory:'queries'. |
|
951 |
||
952 |
self executeCollectedChangesNamed:('Generate EnumType Code for ' , className). |
|
953 |
||
954 |
aClass initialize. |
|
955 |
||
956 |
"Modified: / 1.2.1998 / 16:10:03 / cg" |
|
957 |
! |
|
958 |
||
6718 | 959 |
createInitializedInstanceCreationMethodsIn:aClass |
5758 | 960 |
"create a #new and #initialize methods (I'm tired of typing)" |
961 |
||
6050 | 962 |
|nonMetaClass metaClass className code initializer m| |
963 |
||
964 |
nonMetaClass := aClass theNonMetaclass. |
|
965 |
metaClass := aClass theMetaclass. |
|
966 |
className := nonMetaClass name. |
|
5758 | 967 |
|
968 |
self startCollectChanges. |
|
969 |
||
6050 | 970 |
(nonMetaClass includesSelector:#'initialize') ifFalse:[ |
5758 | 971 |
code := |
972 |
'initialize |
|
973 |
"Invoked when a new instance is created." |
|
974 |
||
975 |
"/ please change as required (and remove this comment) |
|
976 |
'. |
|
977 |
||
6718 | 978 |
nonMetaClass instVarNames do:[:eachInstVar | |
979 |
initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ... |
|
980 |
code := code , (' "/ ' , eachInstVar , ' := ' , initializer , '.' , Character cr). |
|
981 |
]. |
|
5758 | 982 |
|
6718 | 983 |
m := nonMetaClass responseTo:#initialize. |
984 |
(m notNil and:[m messagesSent size == 0]) ifTrue:[ |
|
985 |
"/ inherits an empty initialize. |
|
5758 | 986 |
|
6718 | 987 |
code := code , ' |
5758 | 988 |
"/ super initialize. -- commented since inherited method does nothing |
989 |
'. |
|
6718 | 990 |
] ifFalse:[ |
991 |
code := code , ' |
|
992 |
super initialize. |
|
993 |
'. |
|
5758 | 994 |
]. |
995 |
||
996 |
self |
|
997 |
compile:code |
|
6050 | 998 |
forClass:nonMetaClass |
5758 | 999 |
inCategory:'initialization'. |
1000 |
]. |
|
1001 |
||
6050 | 1002 |
(metaClass includesSelector:#'new') ifFalse:[ |
1003 |
m := metaClass responseTo:#new. |
|
6718 | 1004 |
(m isNil |
1005 |
or:[ (m sends:#initialize) not |
|
1006 |
or:[ |answer| |
|
1007 |
(Dialog |
|
1008 |
confirmWithCancel:'The inherited #new method already seems to invoke #initialize. Redefine ?' |
|
1009 |
onCancel:[^ self]) ]]) ifTrue:[ |
|
1010 |
code := |
|
5758 | 1011 |
'new |
1012 |
^ self basicNew initialize. |
|
1013 |
'. |
|
6718 | 1014 |
self |
1015 |
compile:code |
|
1016 |
forClass:metaClass |
|
1017 |
inCategory:'instance creation'. |
|
1018 |
]. |
|
1019 |
]. |
|
1020 |
||
1021 |
self executeCollectedChangesNamed:('Add Initialized Instance Creation to ' , className). |
|
1022 |
||
1023 |
"Created: / 11.10.2001 / 22:18:55 / cg" |
|
1024 |
! |
|
1025 |
||
1026 |
createParametrizedInstanceCreationMethodsNamed:selector in:aClass |
|
1027 |
"create a #selector instance creation method (I'm tired of typing)" |
|
1028 |
||
1029 |
|nonMetaClass metaClass className code initializer m dfn| |
|
1030 |
||
1031 |
dfn := Method methodDefinitionTemplateForSelector:selector. |
|
1032 |
||
1033 |
nonMetaClass := aClass theNonMetaclass. |
|
1034 |
metaClass := aClass theMetaclass. |
|
1035 |
className := nonMetaClass name. |
|
1036 |
||
1037 |
self startCollectChanges. |
|
1038 |
||
1039 |
(nonMetaClass includesSelector:selector asSymbol) ifFalse:[ |
|
1040 |
code := |
|
1041 |
'initialize',dfn asUppercaseFirst,' |
|
1042 |
"Invoked when a new instance is created for arg." |
|
1043 |
||
1044 |
"/ please change as required (and remove these comments) |
|
1045 |
"/ do something with arg here (instVar-foo := arg) |
|
1046 |
'. |
|
1047 |
nonMetaClass instVarNames do:[:eachInstVar | |
|
1048 |
initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ... |
|
1049 |
code := code , (' "/ ' , eachInstVar , ' := ' , initializer , '.' , Character cr). |
|
1050 |
]. |
|
1051 |
||
1052 |
m := nonMetaClass responseTo:#initialize. |
|
1053 |
(m notNil and:[ m messagesSent size == 0 ]) ifTrue:[ |
|
1054 |
"/ inherits an empty initialize. |
|
1055 |
||
1056 |
code := code , ' |
|
1057 |
"/ super initialize. -- commented since inherited method does nothing |
|
1058 |
'. |
|
1059 |
] ifFalse:[ |
|
1060 |
code := code , ' |
|
1061 |
super initialize. |
|
1062 |
'. |
|
1063 |
]. |
|
1064 |
||
5758 | 1065 |
self |
1066 |
compile:code |
|
6718 | 1067 |
forClass:nonMetaClass |
1068 |
inCategory:'initialization'. |
|
5758 | 1069 |
]. |
1070 |
||
6718 | 1071 |
(metaClass includesSelector:selector) ifFalse:[ |
1072 |
m := metaClass responseTo:selector. |
|
1073 |
(m isNil |
|
1074 |
or:[ (Dialog confirmWithCancel:'The ',selector,'- method is already inherited. Redefine ?' onCancel:[^ self]) ]) |
|
1075 |
ifTrue:[ |
|
1076 |
code := |
|
1077 |
dfn,' |
|
1078 |
"Create & return a new instance for arg." |
|
5758 | 1079 |
|
6718 | 1080 |
^ self basicNew initialize',dfn asUppercaseFirst,' |
1081 |
'. |
|
1082 |
self |
|
1083 |
compile:code |
|
1084 |
forClass:metaClass |
|
1085 |
inCategory:'instance creation'. |
|
1086 |
]. |
|
1087 |
]. |
|
1088 |
||
1089 |
self executeCollectedChangesNamed:('Add Parametrized Instance Creation to ' , className). |
|
5758 | 1090 |
! |
1091 |
||
7470 | 1092 |
createPoolInitializationCodeFor:aClass |
1093 |
|nonMetaClass metaClass className poolVars code initCode runValue maxValue| |
|
1094 |
||
1095 |
self startCollectChanges. |
|
1096 |
||
1097 |
nonMetaClass := aClass theNonMetaclass. |
|
1098 |
metaClass := aClass theMetaclass. |
|
1099 |
className := nonMetaClass name. |
|
1100 |
||
1101 |
poolVars := nonMetaClass classVarNames. |
|
1102 |
||
1103 |
initCode := WriteStream on: String new. |
|
1104 |
initCode nextPutLine:'initialize'. |
|
1105 |
||
1106 |
poolVars do:[:eachVariableName | |
|
1107 |
|oldValue thisValue| |
|
1108 |
||
1109 |
oldValue := nonMetaClass classVarAt:eachVariableName. |
|
1110 |
oldValue notNil ifTrue:[ |
|
1111 |
thisValue := oldValue. |
|
1112 |
] ifFalse:[ |
|
1113 |
thisValue := nil. |
|
1114 |
]. |
|
1115 |
initCode |
|
1116 |
nextPutAll:' '; |
|
1117 |
nextPutAll:eachVariableName; |
|
1118 |
nextPutAll:' := '; |
|
1119 |
nextPutAll:thisValue storeString; |
|
1120 |
nextPutLine:'.'. |
|
1121 |
]. |
|
1122 |
initCode cr. |
|
1123 |
initCode nextPutLine:' "'. |
|
1124 |
initCode nextPutLine:' ',className, ' initialize'. |
|
1125 |
initCode nextPutLine:' "'. |
|
1126 |
||
1127 |
self |
|
1128 |
compile:(initCode contents) |
|
1129 |
forClass:metaClass |
|
1130 |
inCategory:'class initialization'. |
|
1131 |
||
1132 |
self executeCollectedChangesNamed:('Generate Pool Initialization Code for ' , className). |
|
1133 |
||
1134 |
aClass initialize. |
|
1135 |
||
1136 |
"Created: / 25-10-2006 / 09:28:40 / cg" |
|
1137 |
! |
|
1138 |
||
5953 | 1139 |
createStandardPrintOnMethodIn:aClass |
1140 |
"create a #printOn: method (I'm tired of typing)" |
|
1141 |
||
6050 | 1142 |
|code nonMetaClass| |
1143 |
||
1144 |
nonMetaClass := aClass theNonMetaclass. |
|
5953 | 1145 |
|
1146 |
self startCollectChanges. |
|
1147 |
||
6050 | 1148 |
(nonMetaClass includesSelector:#'printOn:') ifFalse:[ |
5953 | 1149 |
code := |
1150 |
'printOn:aStream |
|
1151 |
"append a printed representation if the receiver to the argument, aStream" |
|
1152 |
||
1153 |
super printOn:aStream. |
|
1154 |
'. |
|
6050 | 1155 |
nonMetaClass instVarNames do:[:eachInstVarName | |
5953 | 1156 |
code := code , ' '. |
1157 |
code := code , 'aStream nextPutAll:'''. |
|
1158 |
code := code , eachInstVarName. |
|
1159 |
code := code , ': ''.' , Character cr. |
|
1160 |
code := code , ' '. |
|
1161 |
code := code , eachInstVarName. |
|
1162 |
code := code , ' printOn:aStream.' , Character cr. |
|
1163 |
||
1164 |
]. |
|
1165 |
||
1166 |
self |
|
1167 |
compile:code |
|
6050 | 1168 |
forClass:nonMetaClass |
5953 | 1169 |
inCategory:'printing & storing'. |
1170 |
]. |
|
1171 |
||
1172 |
||
6050 | 1173 |
self executeCollectedChangesNamed:('Add #printOn: to ' , nonMetaClass name). |
5953 | 1174 |
|
1175 |
"Created: / 11.10.2001 / 22:18:55 / cg" |
|
1176 |
! |
|
1177 |
||
5758 | 1178 |
createTestCaseSampleCodeFor:aClass |
1179 |
"create an (almost) empty testCase class" |
|
1180 |
||
1181 |
|nonMetaClass metaClass| |
|
1182 |
||
1183 |
nonMetaClass := aClass theNonMetaclass. |
|
1184 |
metaClass := aClass theMetaclass. |
|
1185 |
"/ className := nonMetaClass name. |
|
1186 |
||
1187 |
( nonMetaClass includesSelector:#test1 ) ifFalse:[ |
|
1188 |
self |
|
1189 |
compile: |
|
1190 |
'test1 |
|
1191 |
"This is a demonstration testCase - it is meant to be removed eventually. |
|
1192 |
This testCase will PASS. |
|
1193 |
Double click on the TestCase class or open a TestRunner to see me checking... |
|
1194 |
- please add more methods like this..." |
|
1195 |
||
1196 |
|o| |
|
1197 |
||
1198 |
o := Array new:2. |
|
1199 |
self assert: ( o size == 2 ). |
|
1200 |
self should: [ o at:0 ] raise:Error. |
|
1201 |
self shouldnt: [ o at:1 ] raise:Error. |
|
1202 |
||
1203 |
" |
|
1204 |
self run:#test1 |
|
1205 |
self new test1 |
|
1206 |
" |
|
1207 |
' |
|
1208 |
forClass:nonMetaClass |
|
1209 |
inCategory:'tests'. |
|
1210 |
]. |
|
1211 |
||
1212 |
( nonMetaClass includesSelector:#test2 ) ifFalse:[ |
|
1213 |
self |
|
1214 |
compile: |
|
1215 |
'test2 |
|
1216 |
"This is a demonstration testCase - it is meant to be removed eventually.. |
|
1217 |
This testCase WILL FAIL. |
|
1218 |
Double click on the TestCase class or open a TestRunner to see me checking... |
|
1219 |
- please add more methods like this..." |
|
1220 |
||
1221 |
|o| |
|
1222 |
||
1223 |
o := Array new:2. |
|
1224 |
self assert: ( o size == 3 ). |
|
1225 |
||
1226 |
" |
|
1227 |
self run:#test2 |
|
1228 |
self new test2 |
|
1229 |
" |
|
1230 |
' |
|
1231 |
forClass:nonMetaClass |
|
1232 |
inCategory:'tests'. |
|
1233 |
]. |
|
1234 |
||
1235 |
( nonMetaClass includesSelector:#test3 ) ifFalse:[ |
|
1236 |
self |
|
1237 |
compile: |
|
1238 |
'test3 |
|
1239 |
"This is a demonstration testCase - it is meant to be removed eventually.. |
|
1240 |
This testCase WILL generate an ERROR. |
|
1241 |
Double click on the TestCase class or open a TestRunner to see me checking... |
|
1242 |
- please add more methods like this..." |
|
1243 |
||
1244 |
|o| |
|
1245 |
||
1246 |
o := Array new:2. |
|
1247 |
self assert: ( o foo ). |
|
1248 |
||
1249 |
" |
|
1250 |
self run:#test3 |
|
1251 |
self new test3 |
|
1252 |
" |
|
1253 |
' |
|
1254 |
forClass:nonMetaClass |
|
1255 |
inCategory:'tests'. |
|
1256 |
]. |
|
1257 |
||
1258 |
( nonMetaClass includesSelector:#setUp ) ifFalse:[ |
|
1259 |
self |
|
1260 |
compile: |
|
1261 |
'setUp |
|
1262 |
"common setup - invoked before testing." |
|
1263 |
||
1264 |
super setUp |
|
1265 |
' |
|
1266 |
forClass:nonMetaClass |
|
1267 |
inCategory:'initialize / release'. |
|
1268 |
]. |
|
1269 |
||
1270 |
( nonMetaClass includesSelector:#tearDown ) ifFalse:[ |
|
1271 |
self |
|
1272 |
compile: |
|
1273 |
'tearDown |
|
1274 |
"common cleanup - invoked after testing." |
|
1275 |
||
1276 |
super tearDown |
|
1277 |
' |
|
1278 |
forClass:nonMetaClass |
|
1279 |
inCategory:'initialize / release'. |
|
1280 |
] |
|
1281 |
! |
|
1282 |
||
1283 |
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass |
|
1284 |
"create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)" |
|
1285 |
||
1286 |
|sel| |
|
1287 |
||
6921 | 1288 |
self assert:( visitedClass isMeta not ). |
1289 |
self assert:( visitorClass isMeta not ). |
|
5758 | 1290 |
|
1291 |
self startCollectChanges. |
|
1292 |
||
1293 |
sel := ('visit' , visitedClass nameWithoutPrefix , ':'). |
|
1294 |
self createAcceptVisitorMethod:sel in:visitedClass. |
|
1295 |
||
1296 |
(visitorClass includesSelector:sel) ifFalse:[ |
|
1297 |
self |
|
1298 |
compile: |
|
1299 |
(('%1anObject |
|
1300 |
"dispatched back from the visited %2-object (visitor pattern)" |
|
1301 |
||
1302 |
"fall back to general object-case - please change as required" |
|
1303 |
||
1304 |
^ self visitObject:anObject |
|
1305 |
') bindWith:sel with:visitedClass nameWithoutPrefix asLowercaseFirst) |
|
1306 |
forClass:visitorClass |
|
1307 |
inCategory:'visiting'. |
|
1308 |
]. |
|
1309 |
||
1310 |
(visitorClass includesSelector:#'visitObject:') ifFalse:[ |
|
1311 |
self |
|
1312 |
compile: |
|
1313 |
('visitObject:anObject |
|
1314 |
"dispatched back from the visited objects (visitor pattern)" |
|
1315 |
||
1316 |
"general fallBack - please change as required" |
|
1317 |
||
1318 |
self halt:''not yet implemented'' |
|
1319 |
') |
|
1320 |
forClass:visitorClass |
|
1321 |
inCategory:'visiting'. |
|
1322 |
]. |
|
1323 |
||
1324 |
(visitorClass includesSelector:#'visit:') ifFalse:[ |
|
1325 |
self |
|
1326 |
compile: |
|
1327 |
('visit:anObject |
|
1328 |
"visit anObject (visitor pattern). |
|
1329 |
The object should call back one of my visitXXXX methods." |
|
1330 |
||
1331 |
^ anObject acceptVisitor:self |
|
1332 |
') |
|
1333 |
forClass:visitorClass |
|
1334 |
inCategory:'visiting'. |
|
1335 |
]. |
|
1336 |
||
1337 |
self executeCollectedChangesNamed:('Add Visitor Pattern'). |
|
6050 | 1338 |
! |
1339 |
||
1340 |
createWebApplicationCodeFor:aClass |
|
1341 |
"create an empty webApplication framework" |
|
1342 |
||
1343 |
|nonMetaClass metaClass className txt| |
|
1344 |
||
1345 |
self startCollectChanges. |
|
1346 |
||
1347 |
nonMetaClass := aClass theNonMetaclass. |
|
1348 |
metaClass := aClass theMetaclass. |
|
1349 |
className := nonMetaClass name. |
|
1350 |
||
7973 | 1351 |
(metaClass includesSelector:#pageSpec) ifFalse:[ |
1352 |
txt := self class initialPageSpecMethodSourceForWebApplications. |
|
1353 |
self |
|
1354 |
compile:(txt bindWith:className) |
|
1355 |
forClass:metaClass |
|
1356 |
inCategory:'page specs'. |
|
1357 |
]. |
|
1358 |
||
1359 |
self executeCollectedChangesNamed:('Add WebApplication Code for ' , className). |
|
1360 |
||
1361 |
"Modified: / 1.2.1998 / 16:10:03 / cg" |
|
1362 |
! |
|
1363 |
||
1364 |
createWebServiceCodeFor:aClass |
|
1365 |
"create an empty webService framework" |
|
1366 |
||
1367 |
|nonMetaClass metaClass className txt| |
|
1368 |
||
1369 |
self startCollectChanges. |
|
1370 |
||
1371 |
nonMetaClass := aClass theNonMetaclass. |
|
1372 |
metaClass := aClass theMetaclass. |
|
1373 |
className := nonMetaClass name. |
|
1374 |
||
6050 | 1375 |
(nonMetaClass includesSelector:#process:) ifFalse:[ |
1376 |
txt := |
|
1377 |
'process:aRequest |
|
7973 | 1378 |
"This is the web services main processing method. |
6050 | 1379 |
It will be invoked for every incoming webBrowser-request. |
1380 |
The argument, aRequest contains the parameters (url, fields, parameters etc.)." |
|
1381 |
||
1382 |
|response| |
|
1383 |
||
1384 |
response := aRequest response. |
|
1385 |
response nextPutLine:''<HTML>''. |
|
1386 |
response nextPutLine:'' <HEAD>''. |
|
1387 |
response nextPutLine:'' <TITLE>Hello</TITLE>''. |
|
1388 |
response nextPutLine:'' </HEAD>''. |
|
1389 |
response nextPutLine:'' <BODY>''. |
|
1390 |
response nextPutLine:'' <H1>Hello World !!</H1>''. |
|
1391 |
response nextPutLine:'' </BODY>''. |
|
1392 |
response nextPutLine:''</HTML>''. |
|
1393 |
'. |
|
1394 |
self |
|
1395 |
compile:txt |
|
1396 |
forClass:nonMetaClass |
|
1397 |
inCategory:'response generation'. |
|
1398 |
]. |
|
1399 |
||
1400 |
(metaClass includesSelector:#linkName) ifFalse:[ |
|
1401 |
txt := |
|
1402 |
'linkName |
|
1403 |
"return the default linkName path (with slash)." |
|
1404 |
||
1405 |
^ ''/NewService'' |
|
1406 |
'. |
|
1407 |
self |
|
1408 |
compile:txt |
|
1409 |
forClass:metaClass |
|
1410 |
inCategory:'defaults'. |
|
1411 |
]. |
|
1412 |
||
1413 |
(metaClass includesSelector:#settingsApplicationClass) ifFalse:[ |
|
1414 |
txt := |
|
1415 |
'settingsApplicationClass |
|
1416 |
"a SettingsApplication class - or nil (used in the settings dialog if non-nil)." |
|
1417 |
||
1418 |
^ nil |
|
1419 |
'. |
|
1420 |
self |
|
1421 |
compile:txt |
|
1422 |
forClass:metaClass |
|
1423 |
inCategory:'defaults'. |
|
1424 |
]. |
|
1425 |
||
1426 |
||
7973 | 1427 |
self executeCollectedChangesNamed:('Add WebService Code for ' , className). |
6050 | 1428 |
|
1429 |
"Modified: / 1.2.1998 / 16:10:03 / cg" |
|
5758 | 1430 |
! ! |
1431 |
||
1432 |
!CodeGeneratorTool methodsFor:'code generation-basic'! |
|
1433 |
||
1434 |
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization |
|
1435 |
"workhorse for creating access methods for instvars." |
|
1436 |
||
1437 |
|classesClassVars generateComments generateCommentsForSetters generateCommentsForGetters| |
|
1438 |
||
1439 |
self startCollectChanges. |
|
1440 |
||
1441 |
generateComments := UserPreferences current generateComments. |
|
1442 |
generateCommentsForSetters := UserPreferences current generateCommentsForSetters. |
|
1443 |
generateCommentsForGetters := UserPreferences current generateCommentsForGetters. |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1444 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1445 |
classesClassVars := aClass theNonMetaclass allClassVarNames. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1446 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1447 |
aCollectionOfVarNames do:[:name | |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1448 |
|source varType methodName defaultMethodName| |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1449 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1450 |
varType := (classesClassVars includes:name) |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1451 |
ifTrue:['static'] |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1452 |
ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1453 |
(aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1454 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1455 |
methodName := name. |
6643 | 1456 |
name isUppercaseFirst ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1457 |
methodName := methodName asLowercaseFirst. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1458 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1459 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1460 |
"/ the GETTER |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1461 |
writersOnly ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1462 |
lazyInitialization ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1463 |
defaultMethodName := 'default' , name asUppercaseFirst. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1464 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1465 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1466 |
"check, if method is not already present" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1467 |
(aClass includesSelector:(methodName asSymbol)) ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1468 |
asValueHolder ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1469 |
source := methodName , '\'. |
5758 | 1470 |
generateComments ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1471 |
source := source , ' "return/create the ''%2'' value holder (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1472 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1473 |
source := source , ' %2 isNil ifTrue:[\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1474 |
lazyInitialization ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1475 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1476 |
, ' %2 := self class %3 asValue.\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1477 |
] ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1478 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1479 |
, ' %2 := ValueHolder new.\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1480 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1481 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1482 |
withChange ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1483 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1484 |
, ' %2 addDependent:self.\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1485 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1486 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1487 |
, ' ].\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1488 |
, ' ^ %2'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1489 |
] ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1490 |
source := methodName , '\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1491 |
lazyInitialization ifTrue:[ |
5758 | 1492 |
generateCommentsForGetters ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1493 |
source := source , ' "return the %1 instance variable ''%2'' with lazy instance creation (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1494 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1495 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1496 |
, ' %2 isNil ifTrue:[\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1497 |
, ' %2 := self class %3.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1498 |
, ' ].\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1499 |
, ' ^ %2'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1500 |
] ifFalse:[ |
5758 | 1501 |
generateCommentsForGetters ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1502 |
source := source , ' "return the %1 instance variable ''%2'' (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1503 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1504 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1505 |
, ' ^ %2'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1506 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1507 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1508 |
source := (source bindWith:varType with:name with:defaultMethodName) withCRs. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1509 |
self compile:source forClass:aClass inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']). |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1510 |
] ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1511 |
Transcript showCR:'method ''', methodName , ''' already present' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1512 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1513 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1514 |
"/ default for lazy on class side |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1515 |
lazyInitialization ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1516 |
(aClass class includesSelector:(defaultMethodName asSymbol)) ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1517 |
source := defaultMethodName , '\'. |
5758 | 1518 |
generateComments ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1519 |
source := source , ' "default value for the ''%2'' instance variable (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1520 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1521 |
source := source |
6839
c25218305e50
Send #shouldImplement instead of #halt:.
Stefan Vogel <sv@exept.de>
parents:
6791
diff
changeset
|
1522 |
, ' self shouldImplement.\' |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1523 |
, ' ^ nil.'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1524 |
source := (source bindWith:varType with:name) withCRs. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1525 |
self compile:source forClass:aClass class inCategory:'defaults'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1526 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1527 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1528 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1529 |
|
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1530 |
"/ the SETTER |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1531 |
readersOnly ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1532 |
(aClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1533 |
asValueHolder ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1534 |
source := methodName , ':something\'. |
5758 | 1535 |
generateComments ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1536 |
source := source , ' "set the ''%2'' value holder' , ' (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1537 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1538 |
withChange ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1539 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1540 |
, ' |oldValue newValue|\\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1541 |
, ' %2 notNil ifTrue:[\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1542 |
, ' oldValue := %2 value.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1543 |
, ' %2 removeDependent:self.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1544 |
, ' ].\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1545 |
, ' %2 := something.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1546 |
, ' %2 notNil ifTrue:[\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1547 |
, ' %2 addDependent:self.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1548 |
, ' ].\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1549 |
, ' newValue := %2 value.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1550 |
, ' oldValue ~~ newValue ifTrue:[\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1551 |
, ' self update:#value with:newValue from:%2.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1552 |
, ' ].\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1553 |
] ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1554 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1555 |
, ' %2 := something.'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1556 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1557 |
] ifFalse:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1558 |
source := methodName , ':something\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1559 |
withChange ifTrue:[ |
5758 | 1560 |
generateComments ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1561 |
source := source , ' "set the value of the %1 variable ''%2'''. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1562 |
source := source , ' and send a change notification (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1563 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1564 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1565 |
, ' (%2 ~~ something) ifTrue:[\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1566 |
, ' %2 := something.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1567 |
, ' self changed:#%2.\' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1568 |
, ' ].\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1569 |
] ifFalse:[ |
5758 | 1570 |
generateCommentsForSetters ifTrue:[ |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1571 |
source := source , ' "set the value of the %1 variable ''%2'''. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1572 |
source := source , ' (automatically generated)"\\'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1573 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1574 |
source := source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1575 |
, ' %2 := something.'. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1576 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1577 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1578 |
source := (source bindWith:varType with:name) withCRs. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1579 |
self |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1580 |
compile:source |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1581 |
forClass:aClass |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1582 |
inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']). |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1583 |
] ifTrue:[ |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1584 |
Transcript showCR:'method ''', methodName , ':'' already present' |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1585 |
]. |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1586 |
]. |
5758 | 1587 |
]. |
1588 |
||
1589 |
self executeCollectedChangesNamed:('Add Accessors'). |
|
5763 | 1590 |
! |
1591 |
||
7615 | 1592 |
createCollectionAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange |
1593 |
||
1594 |
|classesClassVars generateComments generateCommentsForSetters generateCommentsForGetters| |
|
1595 |
||
1596 |
self startCollectChanges. |
|
1597 |
||
1598 |
generateComments := UserPreferences current generateComments. |
|
1599 |
||
1600 |
classesClassVars := aClass theNonMetaclass allClassVarNames. |
|
1601 |
||
1602 |
aCollectionOfVarNames do:[:name | |
|
1603 |
|source varType methodNameBase methodName defaultMethodName| |
|
1604 |
||
1605 |
varType := (classesClassVars includes:name) |
|
1606 |
ifTrue:['static'] |
|
1607 |
ifFalse:[ |
|
1608 |
(aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])]. |
|
1609 |
||
1610 |
methodNameBase := name asUppercaseFirst. |
|
1611 |
(methodNameBase endsWith:'s') ifTrue:[ |
|
1612 |
methodNameBase := methodNameBase copyWithoutLast:1. |
|
1613 |
]. |
|
1614 |
methodName := 'add' , methodNameBase, ':'. |
|
1615 |
||
1616 |
"check, if method is not already present" |
|
1617 |
(aClass includesSelector:(methodName asSymbol)) ifFalse:[ |
|
1618 |
source := methodName , 'a%1\'. |
|
1619 |
generateComments ifTrue:[ |
|
1620 |
source := source , ' "add a ',methodNameBase,'"\\'. |
|
1621 |
]. |
|
1622 |
source := source , ' %2 isNil ifTrue:[\'. |
|
1623 |
source := source |
|
1624 |
, ' %2 := OrderedCollection new.\'. |
|
1625 |
source := source |
|
1626 |
, ' ].\' |
|
1627 |
, ' %2 add: a%1'. |
|
1628 |
source := (source bindWith:methodNameBase with:name) withCRs. |
|
1629 |
self compile:source forClass:aClass inCategory:'accessing'. |
|
1630 |
] ifTrue:[ |
|
1631 |
Transcript showCR:'method ''', methodName , ''' already present' |
|
1632 |
]. |
|
1633 |
||
1634 |
methodName := 'remove' , methodNameBase, ':'. |
|
1635 |
||
1636 |
"check, if method is not already present" |
|
1637 |
(aClass includesSelector:(methodName asSymbol)) ifFalse:[ |
|
1638 |
source := methodName , 'a%1\'. |
|
1639 |
generateComments ifTrue:[ |
|
1640 |
source := source , ' "remove a ',methodNameBase,'"\\'. |
|
1641 |
]. |
|
1642 |
source := source |
|
1643 |
, ' %2 remove: a%1'. |
|
1644 |
source := (source bindWith:methodNameBase with:name) withCRs. |
|
1645 |
self compile:source forClass:aClass inCategory:'accessing'. |
|
1646 |
] ifTrue:[ |
|
1647 |
Transcript showCR:'method ''', methodName , ''' already present' |
|
1648 |
]. |
|
1649 |
]. |
|
1650 |
||
1651 |
self |
|
1652 |
createAccessMethodsFor:aCollectionOfVarNames |
|
1653 |
in:aClass |
|
1654 |
withChange:withChange |
|
1655 |
asValueHolder:false |
|
1656 |
readersOnly:true |
|
1657 |
writersOnly:false |
|
1658 |
lazyInitialization:false. |
|
1659 |
||
1660 |
self executeCollectedChangesNamed:('Add Collection Access'). |
|
1661 |
||
1662 |
"Created: / 04-02-2007 / 15:52:31 / cg" |
|
1663 |
! |
|
1664 |
||
5763 | 1665 |
createValueHoldersFor:aCollectionOfVarNames in:aClass lazyInitialization:lazyInitialization |
1666 |
"workhorse for creating access methods for instvars." |
|
1667 |
||
6050 | 1668 |
|nonMetaClass metaClass classesClassVars generateComments generateCommentsForSetters generateCommentsForGetters| |
1669 |
||
1670 |
nonMetaClass := aClass theNonMetaclass. |
|
1671 |
metaClass := aClass theMetaclass. |
|
5763 | 1672 |
|
1673 |
self startCollectChanges. |
|
1674 |
||
1675 |
generateComments := UserPreferences current generateComments. |
|
1676 |
generateCommentsForSetters := UserPreferences current generateCommentsForSetters. |
|
1677 |
generateCommentsForGetters := UserPreferences current generateCommentsForGetters. |
|
1678 |
||
6050 | 1679 |
classesClassVars := nonMetaClass allClassVarNames. |
5763 | 1680 |
|
1681 |
aCollectionOfVarNames do:[:name | |
|
1682 |
|source varType methodName holderMethodName defaultMethodName| |
|
1683 |
||
1684 |
holderMethodName := name. |
|
6643 | 1685 |
name isUppercaseFirst ifTrue:[ |
5763 | 1686 |
holderMethodName := holderMethodName asLowercaseFirst. |
1687 |
]. |
|
1688 |
(holderMethodName endsWith:'Holder') ifTrue:[ |
|
1689 |
methodName := holderMethodName copyWithoutLast:6. |
|
1690 |
] ifFalse:[ |
|
1691 |
methodName := holderMethodName. |
|
1692 |
holderMethodName := methodName , 'Holder'. |
|
1693 |
]. |
|
1694 |
||
1695 |
methodName notNil ifTrue:[ |
|
6050 | 1696 |
(metaClass includesSelector:(methodName asSymbol)) ifFalse:[ |
5763 | 1697 |
source := '%1\'. |
1698 |
generateComments ifTrue:[ |
|
1699 |
source := source , ' "return the value in ''%2''"\\'. |
|
1700 |
]. |
|
1701 |
source := source , ' ^ self %2 value'. |
|
1702 |
source := (source bindWith:methodName with:holderMethodName) withCRs. |
|
6050 | 1703 |
self compile:source forClass:nonMetaClass inCategory:('accessing'). |
5763 | 1704 |
] ifTrue:[ |
1705 |
Transcript showCR:'method ''', methodName , ''' already present' |
|
1706 |
]. |
|
1707 |
||
6050 | 1708 |
(metaClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[ |
5763 | 1709 |
source := '%1: newValue\'. |
1710 |
generateComments ifTrue:[ |
|
1711 |
source := source , ' "set the value in ''%2''"\\'. |
|
1712 |
]. |
|
1713 |
source := source , ' self %2 value: newValue'. |
|
1714 |
source := (source bindWith:methodName with:holderMethodName) withCRs. |
|
6050 | 1715 |
self compile:source forClass:nonMetaClass inCategory:('accessing'). |
5763 | 1716 |
] ifTrue:[ |
1717 |
Transcript showCR:'method ''', methodName , ':'' already present' |
|
1718 |
]. |
|
1719 |
]. |
|
6050 | 1720 |
(metaClass includesSelector:(holderMethodName asSymbol)) ifFalse:[ |
5763 | 1721 |
source := '%1\'. |
1722 |
generateComments ifTrue:[ |
|
1723 |
source := source , ' "return/create the valueHolder ''%1''"\\'. |
|
1724 |
]. |
|
1725 |
source := source , ' %1 isNil ifTrue:[\'. |
|
1726 |
source := source , ' %1 := ValueHolder with:nil "defaultValue here".\'. |
|
1727 |
source := source , ' ].\'. |
|
1728 |
source := source , ' ^ %1\'. |
|
1729 |
source := (source bindWith:holderMethodName) withCRs. |
|
6050 | 1730 |
self compile:source forClass:nonMetaClass inCategory:('accessing'). |
5763 | 1731 |
] ifTrue:[ |
1732 |
Transcript showCR:'method ''', methodName , ''' already present' |
|
1733 |
]. |
|
1734 |
]. |
|
1735 |
||
1736 |
self executeCollectedChangesNamed:('Add ValueHolder'). |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1737 |
! ! |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
1738 |
|
5758 | 1739 |
!CodeGeneratorTool methodsFor:'code generation-individual methods'! |
3712 | 1740 |
|
1741 |
createAcceptVisitorMethod:selector in:aClass |
|
1742 |
"create an acceptVisitor: method |
|
1743 |
(I'm tired of typing)" |
|
1744 |
||
6921 | 1745 |
self assert:( aClass isMeta not ). |
3712 | 1746 |
|
1747 |
(aClass includesSelector:#'acceptVisitor:') ifFalse:[ |
|
1748 |
self |
|
1749 |
compile: |
|
1750 |
(('acceptVisitor:aVisitor |
|
1751 |
"Double dispatch back to the visitor, passing my type encoded in |
|
1752 |
the selector (visitor pattern)" |
|
1753 |
||
1754 |
"stub code automatically generated - please change if required" |
|
1755 |
||
1756 |
^ aVisitor %1self |
|
1757 |
') bindWith:selector) |
|
1758 |
forClass:aClass |
|
1759 |
inCategory:'visiting'. |
|
1760 |
] |
|
1761 |
! |
|
1762 |
||
1763 |
createAcceptVisitorMethodIn:aClass |
|
1764 |
"create an acceptVisitor: method |
|
1765 |
(I'm tired of typing)" |
|
1766 |
||
1767 |
self |
|
1768 |
createAcceptVisitorMethod:('visit' , aClass nameWithoutPrefix , ':') asSymbol |
|
1769 |
in:aClass |
|
1770 |
! |
|
1771 |
||
1772 |
createCopyrightMethodFor:aClass |
|
1773 |
"add copyright method containing your/your companies |
|
1774 |
copyright template but only if not already present. |
|
1775 |
this is only added, if specified in the |
|
1776 |
COPYRIGHT_TEMPLATE_FILE resources." |
|
1777 |
||
1778 |
|fn txt| |
|
1779 |
||
1780 |
(aClass includesSelector:#copyright) ifFalse:[ |
|
1781 |
fn := SystemBrowser classResources at:#'COPYRIGHT_TEMPLATE_FILE' default:nil. |
|
1782 |
fn notNil ifTrue:[ |
|
1783 |
fn := fn asFilename. |
|
1784 |
fn exists ifTrue:[ |
|
1785 |
txt := fn contents asString |
|
1786 |
] |
|
1787 |
]. |
|
1788 |
||
1789 |
txt notNil ifTrue:[ |
|
1790 |
txt := txt bindWith:(Date today year). |
|
1791 |
self compile: |
|
1792 |
'copyright |
|
1793 |
" |
|
1794 |
' , txt , ' |
|
1795 |
" |
|
1796 |
' forClass:aClass |
|
1797 |
inCategory:'documentation'. |
|
1798 |
] |
|
1799 |
]. |
|
1800 |
! |
|
1801 |
||
1802 |
createDocumentationMethodFor:aClass |
|
1803 |
"add documentation method containing doc template |
|
1804 |
but only if not already present." |
|
1805 |
||
6050 | 1806 |
|metaClass nonMetaClass userName loginName hostName emailAddress code existingComment| |
1807 |
||
1808 |
metaClass := aClass theMetaclass. |
|
1809 |
nonMetaClass := aClass theNonMetaclass. |
|
3712 | 1810 |
|
6050 | 1811 |
(metaClass includesSelector:#documentation) ifFalse:[ |
1812 |
existingComment := nonMetaClass comment. |
|
1813 |
existingComment isEmptyOrNil ifTrue:[ |
|
1814 |
(nonMetaClass isSubclassOf:HTTPService) ifTrue:[ |
|
6159 | 1815 |
existingComment := ' [start Server with:] |
7545
df2fc5dbee78
changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents:
7480
diff
changeset
|
1816 |
HTTPServer startServerOnPort:8080 |
6159 | 1817 |
|
1818 |
[start with:] |
|
6050 | 1819 |
(self new) |
7545
df2fc5dbee78
changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents:
7480
diff
changeset
|
1820 |
registerServiceOn:(HTTPServer runningServerOnPort:8080)'. |
6050 | 1821 |
]. |
1822 |
]. |
|
1823 |
||
3712 | 1824 |
userName := OperatingSystem getFullUserName. |
1825 |
loginName := OperatingSystem getLoginName. |
|
1826 |
hostName := OperatingSystem getHostName. |
|
1827 |
emailAddress := loginName , '@' , hostName. |
|
1828 |
||
5756 | 1829 |
"/ ugly; should ask the class for that |
6350 | 1830 |
metaClass isJavaScriptMetaclass ifTrue:[ |
5756 | 1831 |
code := |
1832 |
'function documentation() { |
|
1833 |
/* |
|
6050 | 1834 |
' , (existingComment ? ' documentation to be added.') , ' |
5756 | 1835 |
|
1836 |
[author:] |
|
1837 |
' , userName |
|
1838 |
, ' (' , emailAddress , ')' , ' |
|
1839 |
||
1840 |
[instance variables:] |
|
1841 |
||
1842 |
[class variables:] |
|
1843 |
||
1844 |
[see also:] |
|
1845 |
||
1846 |
*/ |
|
1847 |
} |
|
1848 |
' |
|
1849 |
] ifFalse:[ |
|
1850 |
code:= |
|
3712 | 1851 |
'documentation |
1852 |
" |
|
6050 | 1853 |
' , (existingComment ? ' documentation to be added.') , ' |
3712 | 1854 |
|
1855 |
[author:] |
|
1856 |
' , userName |
|
1857 |
, ' (' , emailAddress , ')' , ' |
|
1858 |
||
1859 |
[instance variables:] |
|
1860 |
||
1861 |
[class variables:] |
|
1862 |
||
1863 |
[see also:] |
|
1864 |
||
1865 |
" |
|
5756 | 1866 |
' |
1867 |
]. |
|
1868 |
||
1869 |
self |
|
1870 |
compile:code |
|
6050 | 1871 |
forClass:metaClass |
5756 | 1872 |
inCategory:'documentation'. |
3712 | 1873 |
]. |
7545
df2fc5dbee78
changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents:
7480
diff
changeset
|
1874 |
|
df2fc5dbee78
changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents:
7480
diff
changeset
|
1875 |
"Modified: / 24-11-2006 / 15:54:27 / cg" |
3712 | 1876 |
! |
1877 |
||
1878 |
createExamplesMethodFor:aClass |
|
1879 |
"add examples method containing examples template |
|
1880 |
but only if not already present." |
|
1881 |
||
6050 | 1882 |
|nonMetaclass fragment| |
1883 |
||
1884 |
nonMetaclass := aClass theNonMetaclass. |
|
1885 |
(nonMetaclass isSubclassOf:ApplicationModel) ifFalse:[ |
|
1886 |
^ self |
|
1887 |
]. |
|
3712 | 1888 |
|
1889 |
(aClass includesSelector:#examples) ifFalse:[ |
|
6050 | 1890 |
(nonMetaclass isSubclassOf:ApplicationModel) ifTrue:[ |
3712 | 1891 |
fragment := ' Starting the application: |
1892 |
[exBegin] |
|
6050 | 1893 |
' , nonMetaclass name , ' open |
3712 | 1894 |
|
1895 |
[exEnd] |
|
1896 |
' |
|
1897 |
] ifFalse:[ |
|
1898 |
fragment := '' |
|
1899 |
]. |
|
1900 |
||
1901 |
self |
|
1902 |
compile: |
|
1903 |
'examples |
|
1904 |
" |
|
1905 |
' , fragment , ' |
|
1906 |
more examples to be added: |
|
1907 |
[exBegin] |
|
1908 |
... add code fragment for |
|
1909 |
... executable example here ... |
|
1910 |
[exEnd] |
|
1911 |
" |
|
1912 |
' |
|
1913 |
forClass:aClass |
|
1914 |
inCategory:'documentation'. |
|
1915 |
]. |
|
1916 |
! |
|
1917 |
||
3822
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1918 |
createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1919 |
|imageStoreStream mthd imageKey category| |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1920 |
|
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1921 |
anImage storeOn: (imageStoreStream := WriteStream on: ''). |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1922 |
|
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1923 |
"/ if that method already exists, do not overwrite the category |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1924 |
category := 'image specs'. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1925 |
(mthd := aClass compiledMethodAt:sel) notNil ifTrue:[ |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1926 |
category := mthd category. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1927 |
]. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1928 |
|
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1929 |
imageKey := (aClass name, ' ', sel) asSymbol. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1930 |
Icon constantNamed: imageKey put:nil. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1931 |
aClass |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1932 |
compile: ((sel, |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1933 |
'\', comment, |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1934 |
'\\' , |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1935 |
' "\', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1936 |
' self ' , sel , ' inspect\', |
3823 | 1937 |
' ImageEditor openOnClass:self andSelector:#', sel, '\', |
3822
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1938 |
' Icon flushCachedIcons', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1939 |
'\ "', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1940 |
'\\', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1941 |
' <resource: #image>', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1942 |
'\\', |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1943 |
' ^Icon\') withCRs, |
7967
2560906ca552
use string-key in constantNamed:-icon caching
Claus Gittinger <cg@exept.de>
parents:
7615
diff
changeset
|
1944 |
' constantNamed:''', imageKey, '''\' withCRs, |
3822
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1945 |
' ifAbsentPut:[', imageStoreStream contents, ']') |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1946 |
classified: category. |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1947 |
! |
4e9f2f69875f
code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents:
3804
diff
changeset
|
1948 |
|
3712 | 1949 |
createInitialHistoryMethodFor:aClass |
1950 |
"add history method containing created-entry |
|
1951 |
but only if not already present." |
|
1952 |
||
5758 | 1953 |
|code| |
1954 |
||
3712 | 1955 |
(aClass includesSelector:#history) ifFalse:[ |
1956 |
HistoryManager notNil ifTrue:[ |
|
5758 | 1957 |
code := HistoryManager codeForInitialHistoryMethodIn:aClass. |
1958 |
self |
|
1959 |
compile:code |
|
1960 |
forClass:aClass |
|
1961 |
inCategory:'documentation'. |
|
3712 | 1962 |
]. |
1963 |
]. |
|
1964 |
! |
|
1965 |
||
4512 | 1966 |
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass |
1967 |
"add an inst-creation method" |
|
1968 |
||
1969 |
|template| |
|
1970 |
||
1971 |
(aMetaClass includesSelector:selector) ifFalse:[ |
|
1972 |
template := Parser methodSpecificationForSelector:selector. |
|
1973 |
self |
|
1974 |
compile: |
|
1975 |
template , ' |
|
1976 |
^ self new ' , template , ' |
|
1977 |
' |
|
1978 |
forClass:aMetaClass |
|
1979 |
inCategory:category. |
|
1980 |
]. |
|
1981 |
! |
|
1982 |
||
3712 | 1983 |
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass |
1984 |
"create a multi-setter method for instvars." |
|
1985 |
||
1986 |
|source| |
|
1987 |
||
1988 |
source := ''. |
|
1989 |
aCollectionOfVarNames do:[:eachVar | |
|
1990 |
source := source , (eachVar , ':' , eachVar , 'Arg '). |
|
1991 |
]. |
|
1992 |
source := source , Character cr. |
|
6992 | 1993 |
(UserPreferences current generateCommentsForSetters) ifTrue:[ |
6993 | 1994 |
source := source , (' "set instance variables"' , Character cr , Character cr). |
6992 | 1995 |
]. |
3712 | 1996 |
aCollectionOfVarNames do:[:eachVar | |
1997 |
source := source , (' ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr). |
|
1998 |
]. |
|
1999 |
self compile:source forClass:aClass inCategory:'accessing'. |
|
2000 |
! |
|
2001 |
||
3800
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2002 |
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2003 |
"add a subclassResponsibility method; |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2004 |
but only if not already present." |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2005 |
|
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2006 |
(aClass includesSelector:aSelector) ifFalse:[ |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2007 |
|
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2008 |
self compile: |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2009 |
(Method methodDefinitionTemplateForSelector:aSelector) , |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2010 |
' |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2011 |
"raise an error: must be redefined in concrete subclass(es)" |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2012 |
|
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2013 |
^ self subclassResponsibility |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2014 |
' |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2015 |
forClass:aClass |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2016 |
inCategory:cat. |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2017 |
]. |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2018 |
! |
a5c75c369855
added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents:
3719
diff
changeset
|
2019 |
|
3712 | 2020 |
createUpdateMethodIn:aClass |
2021 |
"create an update:with:from:-method |
|
2022 |
(I'm tired of typing)" |
|
2023 |
||
2024 |
(aClass includesSelector:#'update:with:from:') ifFalse:[ |
|
2025 |
self |
|
2026 |
compile: |
|
2027 |
'update:something with:aParameter from:changedObject |
|
2028 |
"Invoked when an object that I depend upon sends a change notification." |
|
2029 |
||
2030 |
"stub code automatically generated - please change as required" |
|
2031 |
||
2032 |
"/ changedObject == someOfMyValueHolders ifTrue:[ |
|
4926 | 2033 |
"/ self doSomethingApropriate. |
2034 |
"/ ^ self. |
|
3712 | 2035 |
"/ ]. |
2036 |
super update:something with:aParameter from:changedObject |
|
2037 |
' |
|
2038 |
forClass:aClass |
|
2039 |
inCategory:'change & update'. |
|
2040 |
] |
|
2041 |
! |
|
2042 |
||
2043 |
createVersionMethodFor:aClass |
|
2044 |
"add version method containing RCS template |
|
2045 |
but only if not already present and its not a private class." |
|
2046 |
||
5756 | 2047 |
|code| |
2048 |
||
3712 | 2049 |
aClass isPrivate ifFalse:[ |
2050 |
(aClass includesSelector:#version) ifFalse:[ |
|
5756 | 2051 |
"/ ugly; should ask the class for that |
2052 |
aClass isJavaScriptClass ifTrue:[ |
|
2053 |
code:= ('function version() {\ return ("$' , 'Header$");\}') withCRs |
|
2054 |
] ifFalse:[ |
|
2055 |
code:= ('version\ ^ ''$' , 'Header$''') withCRs |
|
2056 |
]. |
|
2057 |
self |
|
2058 |
compile:code |
|
2059 |
forClass:aClass |
|
2060 |
inCategory:'documentation'. |
|
3712 | 2061 |
] |
2062 |
]. |
|
2063 |
! ! |
|
2064 |
||
7480
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2065 |
!CodeGeneratorTool methodsFor:'code templates'! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2066 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2067 |
codeFor_closeAccept |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2068 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2069 |
'closeAccept |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2070 |
"This is a hook method generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2071 |
It will be invoked when your dialog-window is closed with OK." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2072 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2073 |
"/ add any actions as required here ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2074 |
Transcript showCR:''dialog accepted''. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2075 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2076 |
"/ do not remove the one below (otherwise, the dialog will not close itself)... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2077 |
^ super closeAccept |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2078 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2079 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2080 |
"Created: / 27-10-2006 / 10:03:31 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2081 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2082 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2083 |
codeFor_closeDownViews |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2084 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2085 |
'closeDownViews |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2086 |
"This is a hook method generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2087 |
It will be invoked when your app/dialog-window is really closed. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2088 |
See also #closeDownViews, which is invoked before and may suppress the close |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2089 |
or ask the user for confirmation." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2090 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2091 |
"/ change the code below as required ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2092 |
"/ This should cleanup any leftover resources |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2093 |
"/ (for example, temporary files) |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2094 |
"/ super closeRequest will initiate the closeDown |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2095 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2096 |
"/ add your code here |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2097 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2098 |
"/ do not remove the one below ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2099 |
^ super closeDownViews |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2100 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2101 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2102 |
"Created: / 27-10-2006 / 10:01:32 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2103 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2104 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2105 |
codeFor_closeRequest |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2106 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2107 |
'closeRequest |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2108 |
"This is a hook method generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2109 |
It will be invoked when your app/dialog-window is about to be |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2110 |
closed (this method has a chance to suppress the close). |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2111 |
See also #closeDownViews, which is invoked when the close is really done." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2112 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2113 |
"/ change the code below as required ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2114 |
"/ Closing can be suppressed, by simply returning. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2115 |
"/ The ''super closeRequest'' at the end will initiate the real closeDown |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2116 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2117 |
self hasUnsavedChanges ifTrue:[ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2118 |
(self confirm:(resources string:''Close without saving ?'')) ifFalse:[ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2119 |
^ self |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2120 |
] |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2121 |
]. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2122 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2123 |
^ super closeRequest |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2124 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2125 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2126 |
"Created: / 27-10-2006 / 10:01:06 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2127 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2128 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2129 |
codeFor_doSaveAs |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2130 |
^ self codeFor_emptyMenuActionCodeFor:#doSaveAs menuItem:'save/saveAs' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2131 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2132 |
"Created: / 27-10-2006 / 10:22:06 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2133 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2134 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2135 |
codeFor_emptyMenuActionCodeFor:selector menuItem:item |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2136 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2137 |
selector,' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2138 |
"This method was generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2139 |
It will be invoked when the menu-item ''',item,''' is selected." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2140 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2141 |
"/ change below and add any actions as required here ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2142 |
self warn:''no action for ''''',item,''''' defined.''. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2143 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2144 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2145 |
"Created: / 27-10-2006 / 10:16:43 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2146 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2147 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2148 |
codeFor_hasUnsavedChanges |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2149 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2150 |
'hasUnsavedChanges |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2151 |
"Return true, if any unsaved changes are present |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2152 |
(i.e. the contents needs to be saved or else will be lost)" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2153 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2154 |
"/ add real code as required (or remove the halt and always return false)... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2155 |
self halt:''check this code''. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2156 |
^ false. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2157 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2158 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2159 |
"Created: / 27-10-2006 / 10:00:36 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2160 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2161 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2162 |
codeFor_menuNew |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2163 |
^ self codeFor_emptyMenuActionCodeFor:#menuNew menuItem:'new' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2164 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2165 |
"Created: / 27-10-2006 / 10:17:08 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2166 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2167 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2168 |
codeFor_menuOpen |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2169 |
^ self codeFor_emptyMenuActionCodeFor:#menuOpen menuItem:'open' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2170 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2171 |
"Created: / 27-10-2006 / 10:17:18 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2172 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2173 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2174 |
codeFor_menuSave |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2175 |
^ self codeFor_emptyMenuActionCodeFor:#menuSave menuItem:'save' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2176 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2177 |
"Created: / 27-10-2006 / 10:17:25 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2178 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2179 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2180 |
codeFor_menuSaveAs |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2181 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2182 |
'menuSaveAs |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2183 |
"This method was generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2184 |
It will be invoked when the menu-item ''saveAs'' is selected." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2185 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2186 |
"/ change below as required... (see examples in Dialog class for more options) |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2187 |
Dialog |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2188 |
requestSaveFileName:(resources string:''Save'') |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2189 |
default:''foo.txt'' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2190 |
fromDirectory:nil |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2191 |
action:[:fileName | self doSaveAs:fileName] |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2192 |
appendAction:nil. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2193 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2194 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2195 |
"Created: / 27-10-2006 / 10:01:57 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2196 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2197 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2198 |
codeFor_openAboutThisApplication |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2199 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2200 |
'openAboutThisApplication |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2201 |
"This method was generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2202 |
It will be invoked when the menu-item ''help-about'' is selected." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2203 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2204 |
"/ could open a customized aboutBox here ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2205 |
super openAboutThisApplication |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2206 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2207 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2208 |
"Created: / 27-10-2006 / 10:03:13 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2209 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2210 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2211 |
codeFor_openDocumentation |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2212 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2213 |
'openDocumentation |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2214 |
"This method was generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2215 |
It will be invoked when the menu-item ''help-documentation'' is selected." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2216 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2217 |
"/ change below as required ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2218 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2219 |
"/ to open an HTML viewer on some document (under ''doc/online/<language>/'' ): |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2220 |
HTMLDocumentView openFullOnDocumentationFile:''TOP.html''. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2221 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2222 |
"/ add application-specific help files under the ''doc/online/<language>/help/appName'' |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2223 |
"/ directory, and open a viewer with: |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2224 |
"/ HTMLDocumentView openFullOnDocumentationFile:''help/<MyApplication>/TOP.html''. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2225 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2226 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2227 |
"Created: / 27-10-2006 / 10:02:55 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2228 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2229 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2230 |
codeFor_postBuildWith |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2231 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2232 |
'postBuildWith:aBuilder |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2233 |
"This is a hook method generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2234 |
It will be invoked during the initialization of your app/dialog, |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2235 |
after all of the visual components have been built, |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2236 |
but BEFORE the top window is made visible. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2237 |
Add any app-specific actions here (reading files, setting up values etc.) |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2238 |
See also #postOpenWith:, which is invoked after opening." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2239 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2240 |
"/ add any code here ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2241 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2242 |
^ super postBuildWith:aBuilder |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2243 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2244 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2245 |
"Created: / 27-10-2006 / 09:59:33 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2246 |
! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2247 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2248 |
codeFor_postOpenWith |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2249 |
^ |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2250 |
'postOpenWith:aBuilder |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2251 |
"This is a hook method generated by the Browser. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2252 |
It will be invoked right after the applications window has been opened. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2253 |
Add any app-specific actions here (starting background processes etc.). |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2254 |
See also #postBuildWith:, which is invoked before opening." |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2255 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2256 |
"/ add any code here ... |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2257 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2258 |
^ super postOpenWith:aBuilder |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2259 |
'. |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2260 |
|
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2261 |
"Created: / 27-10-2006 / 09:59:56 / cg" |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2262 |
! ! |
33930379ab27
code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents:
7470
diff
changeset
|
2263 |
|
6938 | 2264 |
!CodeGeneratorTool methodsFor:'compilation'! |
2265 |
||
2266 |
compile:theCode forClass:aClass inCategory:cat |
|
2267 |
"install some code for a class. |
|
2268 |
If refactory browser stuff is avaliable the refactory tools are used to support undo" |
|
2269 |
||
7037 | 2270 |
self |
2271 |
compile:theCode forClass:aClass inCategory:cat |
|
2272 |
skipIfSame:true |
|
2273 |
! |
|
6938 | 2274 |
|
7037 | 2275 |
compile:theCode forClass:aClass inCategory:cat skipIfSame:skipIfSame |
2276 |
"install some code for a class. |
|
2277 |
If refactory browser stuff is avaliable the refactory tools are used to support undo" |
|
2278 |
||
2279 |
|change compiler selector oldMthd isSame| |
|
6938 | 2280 |
|
7037 | 2281 |
isSame := false. |
2282 |
skipIfSame ifTrue:[ |
|
2283 |
compiler := aClass compilerClass new. |
|
2284 |
compiler parseMethod:theCode in:aClass ignoreErrors:true ignoreWarnings:true. |
|
2285 |
||
2286 |
selector := compiler selector. |
|
2287 |
selector notNil ifTrue:[ |
|
2288 |
oldMthd := aClass compiledMethodAt:selector. |
|
2289 |
isSame := (oldMthd notNil and:[oldMthd source = theCode]). |
|
2290 |
isSame ifTrue:[ ^ self ]. |
|
6938 | 2291 |
]. |
2292 |
]. |
|
2293 |
||
2294 |
self canUseRefactoringSupport ifFalse:[ |
|
2295 |
"/ compile immediately |
|
2296 |
aClass compile:theCode classified:cat. |
|
2297 |
^ self. |
|
2298 |
]. |
|
2299 |
||
2300 |
change := InteractiveAddMethodChange compile:(theCode asString) in:aClass classified:cat. |
|
2301 |
||
2302 |
"/ if collecting, add to changes (to be executed as one change at the end, |
|
2303 |
"/ in order to have only one change in the undo-list (instead of many) |
|
2304 |
compositeChangeCollector notNil ifTrue:[ |
|
2305 |
compositeChangeCollector addChange:change |
|
2306 |
] ifFalse:[ |
|
7037 | 2307 |
RefactoryChangeManager performChange:change. |
6938 | 2308 |
] |
2309 |
||
2310 |
"Modified: / 21-08-2006 / 18:39:06 / cg" |
|
2311 |
! ! |
|
3712 | 2312 |
|
5758 | 2313 |
!CodeGeneratorTool methodsFor:'private'! |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2314 |
|
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
2315 |
canUseRefactoringSupport |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
2316 |
"check if refactory browser stuff is avaliable" |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
2317 |
|
5758 | 2318 |
^ self class canUseRefactoringSupport |
5013
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
2319 |
! |
0f2c39fc6e8c
comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents:
4926
diff
changeset
|
2320 |
|
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2321 |
privCreateClassResponsibleProtocolFor:aClass |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2322 |
"create stubs for the required protocol. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2323 |
aClass may be a a MetaClass or a non-MetaClass" |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2324 |
|
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2325 |
|selectors| |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2326 |
|
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2327 |
selectors := IdentitySet new. |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2328 |
aClass allSuperclassesDo:[:eachSuperClass | |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2329 |
eachSuperClass methodDictionary keysAndValuesDo:[:eachSelector :eachMethod | |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2330 |
(eachMethod sends:#subclassResponsibility) ifTrue:[ |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2331 |
selectors add:eachSelector. |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2332 |
] |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2333 |
] |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2334 |
]. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2335 |
|
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2336 |
selectors do:[:eachSelector | |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2337 |
|mthd comment implClass methodBodyStream| |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2338 |
|
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2339 |
implClass := aClass whichClassIncludesSelector:eachSelector. |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2340 |
implClass ~~ aClass ifTrue:[ |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2341 |
mthd := implClass compiledMethodAt:eachSelector. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2342 |
(mthd sends:#subclassResponsibility) ifTrue:[ |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2343 |
methodBodyStream := '' writeStream. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2344 |
methodBodyStream |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2345 |
nextPutAll:mthd methodDefinitionTemplate; cr; |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2346 |
nextPutAll:' "'. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2347 |
|
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2348 |
comment := mthd methodComment. |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2349 |
comment isEmptyOrNil ifTrue:[ |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2350 |
methodBodyStream |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2351 |
nextPutAll:('Superclass <1s> says that I am responsible to implement this method' |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2352 |
expandMacrosWith:implClass name) |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2353 |
] ifFalse:[ |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2354 |
comment asStringCollection do:[:eachLine| |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2355 |
methodBodyStream nextPutAll:eachLine. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2356 |
] separatedBy:[ |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2357 |
methodBodyStream cr; nextPutAll:' '. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2358 |
]. |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2359 |
]. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2360 |
|
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2361 |
methodBodyStream |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2362 |
nextPut:$"; cr; cr; |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2363 |
nextPutAll:' self shouldImplement'; cr. |
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2364 |
|
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2365 |
self |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2366 |
compile:methodBodyStream contents |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2367 |
forClass:aClass |
6791
6559c9ebb561
Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents:
6718
diff
changeset
|
2368 |
inCategory:mthd category. |
4108
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2369 |
]. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2370 |
]. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2371 |
]. |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2372 |
! ! |
19af32811dfd
Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents:
3823
diff
changeset
|
2373 |
|
3712 | 2374 |
!CodeGeneratorTool class methodsFor:'documentation'! |
2375 |
||
2376 |
version |
|
7973 | 2377 |
^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.55 2008-02-11 14:24:42 cg Exp $' |
3712 | 2378 |
! ! |