SmalltalkCodeGeneratorTool.st
changeset 16355 b680900382b8
parent 16326 d7236edb4060
child 16369 1090224cc0db
child 16393 50c131b059ec
equal deleted inserted replaced
16354:8605914a0b9e 16355:b680900382b8
   305                 method := method, key, 'arg', i printString, ' '.
   305                 method := method, key, 'arg', i printString, ' '.
   306             ].
   306             ].
   307         ]
   307         ]
   308     ].
   308     ].
   309     ^ method
   309     ^ method
       
   310 ! !
       
   311 
       
   312 !SmalltalkCodeGeneratorTool class methodsFor:'utilities - source code'!
       
   313 
       
   314 methodTemplate
       
   315     "return a method definition template string"
       
   316 
       
   317     |s|
       
   318 
       
   319     s := (TextStream ? WriteStream) on:''.
       
   320     s nextPutAll:
       
   321 'message "selector and argument names"
       
   322     "comment stating purpose of this message"
       
   323 
       
   324     |temporaries|
       
   325 
       
   326     "statement."
       
   327     "statement."
       
   328 
       
   329     "
       
   330      optional: comment giving example use
       
   331     "
       
   332 '.
       
   333     s cr.
       
   334     s emphasis:(UserPreferences current commentEmphasisAndColor).
       
   335     s nextPutAll:
       
   336 '"
       
   337  change the above template into real code;
       
   338  remove this comment.
       
   339  Then `accept'' either via the menu 
       
   340  or via the keyboard (usually CMD-A).
       
   341 
       
   342  You do not need this template; you can also
       
   343  select any existing methods code, change it,
       
   344  and finally `accept''. The method will then be
       
   345  installed under the selector as defined in the
       
   346  actual text - no matter which method is selected
       
   347  in the browser.
       
   348 
       
   349  Or clear this text, type in the method from scratch
       
   350  and install it with `accept''.
       
   351 
       
   352  If you don''t like this method template to appear,
       
   353  disable it either via the global or browser''s settings dialog,
       
   354  or by evaluating:
       
   355      UserPreferences current showMethodTemplate:false
       
   356 "
       
   357 '.
       
   358     ^ s contents
       
   359 !
       
   360 
       
   361 methodTemplateForDocumentation
       
   362     "return a method definition template string"
       
   363 
       
   364     |s|
       
   365 
       
   366     s := (TextStream ? WriteStream) on:''.
       
   367     s nextPutAll:
       
   368 'documentation
       
   369 '.
       
   370     s emphasis:(UserPreferences current commentEmphasisAndColor).
       
   371     s nextPutAll:(
       
   372 '"
       
   373     comment describing this class.
       
   374     you can disable the generation of this template by evaluating:
       
   375          UserPreferences current showMethodTemplate:false
       
   376 
       
   377     [instance variables:]
       
   378         describe instance variables
       
   379     [class variables:]
       
   380         describe class variables
       
   381     [see also:]
       
   382         
       
   383     [author:]
       
   384         %1
       
   385 "
       
   386 ' bindWith:(OperatingSystem getFullUserName)).
       
   387     ^ s contents
       
   388 !
       
   389 
       
   390 methodTemplateForVersionMethodCVS
       
   391     "careful to avoid expansion by cvs here!!"
       
   392 
       
   393     ^ ('version_CVS\    ^ ''$' , 'Header$''') withCRs
       
   394 
       
   395     "Created: / 21-08-2012 / 11:52:27 / cg"
   310 ! !
   396 ! !
   311 
   397 
   312 !SmalltalkCodeGeneratorTool methodsFor:'code generation'!
   398 !SmalltalkCodeGeneratorTool methodsFor:'code generation'!
   313 
   399 
   314 createClassInitializeMethodIn:aClass
   400 createClassInitializeMethodIn:aClass
  2151 
  2237 
  2152     self obsoleteMethodWarning.
  2238     self obsoleteMethodWarning.
  2153 
  2239 
  2154     aClass isPrivate ifFalse:[
  2240     aClass isPrivate ifFalse:[
  2155         (aClass includesSelector:#version) ifFalse:[
  2241         (aClass includesSelector:#version) ifFalse:[
  2156             code := aClass programmingLanguage versionMethodTemplateForCVS.
  2242             code := aClass programmingLanguage methodTemplateForVersionMethodCVS.
  2157             self 
  2243             self 
  2158                 compile:code
  2244                 compile:code
  2159                 forClass:aClass 
  2245                 forClass:aClass 
  2160                 inCategory:#documentation.
  2246                 inCategory:#documentation.
  2161         ]
  2247         ]