eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CodeGeneratorTool':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CodeGeneratorTool


Inheritance:

   Object
   |
   +--CodeGeneratorTool
      |
      +--JavaScriptCodeGeneratorTool
      |
      +--SmalltalkCodeGeneratorTool

Package:
stx:libtool
Category:
Interface-Browsers
Version:
rev: 1.126 date: 2017/07/16 09:50:52
user: cg
file: CodeGeneratorTool.st directory: libtool
module: stx stc-classLibrary: libtool
Author:
Claus Gittiner

Description:


This utility class contains various code generation facilites;
these were extracted from the old and newBrowser.
There is probably more to come...

Note: being refactored into separate per-language generators


Class protocol:

code generation
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly
create accessors in aClass

o  createApplicationCodeFor: aClass
create an empty application framework

o  createClassResponsibleProtocolFor: aClass
create stubs for the required protocol

o  createClassTypeTestMethodsIn: aClass forClasses: subClasses
create a #isXXX test methods (I'm tired of typing)

o  createDocumentationMethodsFor: aClass
create empty documentation methods

o  createEnumTypeCodeFor: aClass

o  createInitializationMethodIn: aClass
create a #initialize methods (I'm tired of typing)

o  createInitializedInstanceCreationMethodsIn: aClass
create a #new and #initialize methods (I'm tired of typing)

o  createIsAbstractMethodIn: aClass
create a #isABstract query method (I'm tired of typing)

o  createParametrizedInstanceCreationMethodsNamed: selector in: aClass
create a #selector instance creation method (I'm tired of typing)

o  createRedefinedInstanceCreationMethodsIn: aClass
create a redefined #new method

o  createSingletonPatternInstanceCreationMethodsIn: aClass usingVariable: varName
create redefined #new method for singleton pattern

o  createStandaloneStartupCodeFor: aClass
create an empty console application framework

o  createStartupCodeFor: aClass forStartOf: anApplicationClassOrNil
create standAloneStartup code

o  createTestCaseSampleCodeFor: aClass
create an (almost) empty testCase class

o  createVisitorMethodsIn: visitedClass andVisitorClass: visitorClass
create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)

o  createWebApplicationCodeFor: aClass
create an empty webApplication framework

o  createWebServiceCodeFor: aClass
create an empty webService framework

o  createWidgetCodeFor: aClass
create usually required widget code (redraw, model update, event handling)

o  initialMenuSpecMethodSourceForApplications
return code for a menuSpec with typical stuff in it

** This method raises an error - it must be redefined in concrete classes **

o  initialPageMenuSpecMethodSourceForWebApplications
return code for a menuSpec with typical stuff in it

** This method raises an error - it must be redefined in concrete classes **

o  initialPageSpecMethodSourceForWebApplications
return an empty pageSpec

** This method raises an error - it must be redefined in concrete classes **

o  initialToolbarMenuSpecMethodSource
return a menuSpec with typical stuff in it

** This method raises an error - it must be redefined in concrete classes **

o  initialWindowSpecMethodSourceForApplications
return an empty windowSpec with an initial menubar in it

** This method raises an error - it must be redefined in concrete classes **

o  initialWindowSpecMethodSourceForDialogs
return an empty windowSpec for dialogs

** This method raises an error - it must be redefined in concrete classes **

code generation-basic
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

code generation-individual methods
o  createAcceptVisitorMethod: selector in: aClass
create an acceptVisitor: method
(I'm tired of typing)

o  createAcceptVisitorMethodIn: aClass
create an acceptVisitor: method
(I'm tired of typing)

o  createAspectMethodFor: anAspectSymbol in: aClass
create an aspect method.

o  createCopyrightMethodFor: aClass
add copyright method containing your/your companies
copyright template but only if not already present.
this is only added, if specified in the
COPYRIGHT_TEMPLATE_FILE resources.

o  createDocumentationMethodFor: aClass
add documentation method containing doc template
but only if not already present.

o  createExamplesMethodFor: aClass
add examples method containing examples template
but only if not already present.

o  createFalseReturnMethodFor: aSelector category: cat in: aClass
add a ^ false method;
but only if not already present.

o  createImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

o  createInitialHistoryMethodFor: aClass
add history method containing created-entry
but only if not already present.

o  createInstanceCreationMethodWithSetupFor: selector category: category in: aMetaClass
add an inst-creation method

o  createMultiSetterInstanceCreationMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter instance creator method for instvars.
This creates a multi setter method (a:val1 b:val2 c:val3...)
and a corresponding new method on the class side.

o  createMultiSetterMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter method (a:val1 b:val2 c:val3...) for instvars.

o  createSubclassResponsibilityMethodFor: aSelector category: cat in: aClass
add a subclassResponsibility method;
but only if not already present.

o  createUpdateMethodIn: aClass
create an update:with:from:-method
(I'm tired of typing)

o  createVersionMethodFor: aClass
add a version method containing RCS template
but only if not already present and it's not a private class.

code generation-menus
o  createActionMethodFor: aSelector in: aClass category: aCategory redefine: redefine

o  createAspectMethodFor: aSelector in: aClass category: aCategory redefine: redefine

compilation
o  compile: theCode forClass: aClass inCategory: cat
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

defaults
o  copyrightTemplate
return the contents of COPYRIGHT_TEMPLATE_FILE resources
or a standard template

o  copyrightTemplate: aString
set the COPYRIGHT_TEMPLATE_FILE

instance creation
o  new

interface specs
o  initialMenuSpecForApplications
return a menuSpec with typical stuff in it
usage example(s):
     MenuEditor new openOnClass:self andSelector:#initialMenuSpecForApplications

o  initialPageMenuSpecForWebApplications
return a menuSpec with typical stuff in it
usage example(s):
     MenuEditor new openOnClass:self andSelector:#initialPageMenuSpecForWebApplications

o  initialPageSpecForWebApplications
Do not manually edit this! If it is corrupted,
the UIPainter may not be able to read the specification.
usage example(s):
     UIPainter new openOnClass:self andSelector:#initialPageSpecForWebApplications

o  initialToolbarMenuSpec
This resource specification was automatically generated
by the MenuEditor of ST/X.
usage example(s):
     MenuEditor new openOnClass:CodeGeneratorTool andSelector:#initialToolbarMenuSpec
     (Menu new fromLiteralArrayEncoding:(CodeGeneratorTool initialToolbarMenuSpec)) startUp

o  initialWindowSpecForApplications
This resource specification was automatically generated
by the UIPainter of ST/X.
usage example(s):
     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForApplications

o  initialWindowSpecForApplications2
This resource specification was automatically generated
by the UIPainter of ST/X.
usage example(s):
     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForApplications2

o  initialWindowSpecForDialogs
This resource specification was automatically generated
by the UIPainter of ST/X.
usage example(s):
     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForDialogs

private
o  canUseRefactoringSupport
check if refactory browser stuff is available

o  methodNameTemplateFor: aSelector

queries
o  isAbstract

utilities
o  missingRequiredProtocolFor: aClass
return the missing required protocol;
that is the set of selectors which send #subclassResponsibility in a superclass and
have no implementation in aClass or in any class between aClass and that superclass

utilities - source code
o  methodTemplate
return a method definition template string

o  methodTemplateForDocumentation
return a method definition template string for a documentation method

o  methodTemplateForPackageDocumentation
return a documentation method definition template string for a package


Instance protocol:

bulk changes
o  addChange: aChange

o  executeCollectedChangesNamed: name
if both the compositeChangeCollector and I myself think, that it should be confirmed,
the let user do it - I am not sure, if the heuristics here is useful;
it might be better to let the generator decide (for example, if it does high-impact
changes, as opposed to simple ones)

o  startCollectChanges

code generation
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly
create accessors in aClass

o  createApplicationCodeFor: aClass
create an empty application framework

o  createClassInitializeMethodIn: aClass
create a #initialize method on the class side (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createClassResponsibleProtocolFor: aClass
create stubs for the required protocol

o  createClassTypeTestMethodsIn: aClass forClasses: subClasses
create a #isXXX test methods (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createDocumentationMethodsFor: aClass
create empty documentation methods

o  createEnumTypeCodeFor: aClass

o  createExamplesMethodForViewClass: aClass
create an examples method

** This method raises an error - it must be redefined in concrete classes **

o  createInitializationMethodIn: aClass
create a #initialize methods (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createInitializedInstanceCreationMethodsIn: aClass
create a #new and #initialize methods (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createIsAbstractMethodIn: aClass
create a #isAbstract query method (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createParametrizedInstanceCreationMethodsNamed: selector in: aClass
create a #selector instance creation method (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createPoolInitializationCodeFor: aClass

o  createRedefinedInstanceCreationMethodsIn: aClass
create a redefined #new methods

** This method raises an error - it must be redefined in concrete classes **

o  createSingletonPatternInstanceCreationMethodsIn: aClass usingVariable: varName
create redefined #new methods for a singleton pattern

** This method raises an error - it must be redefined in concrete classes **

o  createStandaloneStartupCodeFor: aClass
create an empty console application framework

o  createStandardPrintOnMethodIn: aClass
create a #printOn: method (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createStartupCodeFor: aClass forStartOf: anApplicationClassOrNil
create startup code (main)

** This method raises an error - it must be redefined in concrete classes **

o  createTestCaseSampleCodeFor: aClass
create an (almost) empty testCase class

** This method raises an error - it must be redefined in concrete classes **

o  createVisitorMethodsIn: visitedClass andCompilerClass: visitorClass

This is much like createVisitorMethodsIn:andVisitorClass:,
but generates
acceptVisitor:forEffect:
and
visit<NODE>:forEffect:
in visit* methods.

o  createVisitorMethodsIn: visitedClass andVisitorClass2: visitorClass

This is much like createVisitorMethodsIn:andVisitorClass:,
but generates
self visitSuperclass: anObject
in visit* methods.

o  createVisitorMethodsIn: visitedClass andVisitorClass: visitorClass
create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createVisitorMethodsIn: arg1 andVisitorClass: arg2 withParameter: arg3 withSuper: arg4
raise an error: must be redefined in concrete subclass(es)

** This method raises an error - it must be redefined in concrete classes **

o  createWebApplicationCodeFor: aClass
create an empty webApplication framework

** This method raises an error - it must be redefined in concrete classes **

o  createWebServiceCodeFor: aClass
create an empty webService framework

** This method raises an error - it must be redefined in concrete classes **

o  createWidgetCodeFor: aClass
create usually required widget code (redraw, model update, event handling)

** This method raises an error - it must be redefined in concrete classes **

code generation-basic
o  createAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange asValueHolder: asValueHolder readersOnly: readersOnly writersOnly: writersOnly lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

** This method raises an error - it must be redefined in concrete classes **

o  createCollectionAccessMethodsFor: aCollectionOfVarNames in: aClass withChange: withChange

o  createGetterFor: aVarName in: aClass

o  createSetterFor: aVarName in: aClass


o  createValueHoldersFor: aCollectionOfVarNames in: aClass lazyInitialization: lazyInitialization
workhorse for creating access methods for instvars.

** This method raises an error - it must be redefined in concrete classes **

code generation-individual methods
o  createAcceptVisitorMethod: selector in: aClass
create an acceptVisitor: method
(I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createAcceptVisitorMethodIn: aClass
create an acceptVisitor: method
(I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createAspectMethodFor: anAspectSymbol in: aClass
create an aspect method.

** This method raises an error - it must be redefined in concrete classes **

o  createCopyrightMethodFor: aClass
add copyright method containing your/your companies
copyright template but only if not already present.
this is only added, if specified in the
COPYRIGHT_TEMPLATE_FILE resources.

o  createCopyrightMethodFor: copyRightText for: aClass
add copyright method containing text,
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createDocumentationMethodFor: aClass
add documentation method containing doc template
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createExamplesMethodFor: aClass
add examples method containing examples template
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createFalseReturnMethodFor: aSelector category: cat in: aClass
add a ^false method;
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createImageSpecMethodFor: anImage comment: comment in: aClass selector: sel

o  createInitialHistoryMethodFor: aClass
add history method containing created-entry
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createInstanceCreationMethodWithSetupFor: selector category: category in: aMetaClass
add an inst-creation method

** This method raises an error - it must be redefined in concrete classes **

o  createMultiSetterInstanceCreationMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter instance creator method for instvars.
This creates a multi setter method (a:val1 b:val2 c:val3...)
and a corresponding new method on the class side.

** This method raises an error - it must be redefined in concrete classes **

o  createMultiSetterMethodFor: aCollectionOfVarNames in: aClass
create a multi-setter method (a:val1 b:val2 c:val3...) for instvars.

** This method raises an error - it must be redefined in concrete classes **

o  createShouldImplementMethodFor: aSelector category: cat in: aClass
add a shouldImplement method;
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createSubclassResponsibilityMethodFor: aSelector category: cat in: aClass
add a subclassResponsibility method;
but only if not already present.

** This method raises an error - it must be redefined in concrete classes **

o  createUpdateMethodIn: aClass
create an update:with:from:-method
(I'm tired of typing)

** This method raises an error - it must be redefined in concrete classes **

o  createVersionMethodFor: aClass
add version method containing RCS template
but only if not already present and its not a private class.

** This method raises an error - it must be redefined in concrete classes **
** This is an obsolete interface - do not use it (it may vanish in future versions) **

code templates
o  codeFor_classInitialize

o  codeFor_closeAccept

o  codeFor_closeDownViews

o  codeFor_closeRequest

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_doSaveAs

o  codeFor_emptyMenuActionCodeFor: selector menuItem: item

o  codeFor_hasUnsavedChanges

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_menuNew

o  codeFor_menuOpen

o  codeFor_menuReload

o  codeFor_menuSave

o  codeFor_menuSaveAs

o  codeFor_openAboutThisApplication

o  codeFor_openDocumentation

o  codeFor_postBuildWith

o  codeFor_postOpenWith

o  codeFor_shouldImplementFor: selector inClass: aClass
used in the 'generate required protocol' to generate a shouldImplement-sending
method for each subclassClassresponsibility method above aClass.

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_standAloneApplicationRegistryPath

o  codeFor_standAloneApplicationRegistryPathFor: aClass

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_standAloneApplicationUUID

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_standAloneMain

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_standAloneRealMainMethodFor: aClass

** This method raises an error - it must be redefined in concrete classes **

o  codeFor_standAloneUsage

** This method raises an error - it must be redefined in concrete classes **

o  code_forWidget_buttonPress

o  code_forWidget_initialize

o  code_forWidget_keyPress

o  code_forWidget_redraw

o  code_forWidget_sizeChanged

o  code_forWidget_update

compilation
o  compile: theCode forClass: aClass inCategory: cat
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

o  compile: theCode forClass: aClass inCategory: categoryOrNil skipIfSame: skipIfSame
install some code for a class.
If refactory browser stuff is available the refactory tools are used to support undo

o  compilerClass
Return a real compiler classto use to compile code

** This method raises an error - it must be redefined in concrete classes **

initialization
o  confirmChanges
if true, let user confirm complicated changes; if false, just do it

o  confirmChanges: aBoolean
if true, let user confirm complicated changes; if false, just do it

o  initialize

private
o  canUseRefactoringSupport
check if refactory browser stuff is available

o  privCreateClassResponsibleProtocolFor: aClass
create stubs for the required protocol.
aClass may be a a MetaClass or a non-MetaClass



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Fri, 20 Jul 2018 06:52:18 GMT