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