CodeGeneratorTool.st
author Claus Gittinger <cg@exept.de>
Fri, 19 Mar 2004 13:14:48 +0100
changeset 5759 b6cea74440db
parent 5758 8f88193a4a93
child 5763 8cce359fd150
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5141
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     1
"
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     3
              All Rights Reserved
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     4
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     5
 This software is furnished under a license and may be used
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     6
 only in accordance with the terms of that license and with the
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
     9
 other person.  No title to or ownership of the software is
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    10
 hereby transferred.
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    11
"
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    12
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libtool' }"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
Object subclass:#CodeGeneratorTool
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    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
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Interface-Browsers'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    22
!CodeGeneratorTool class methodsFor:'documentation'!
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    23
5141
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    24
copyright
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    25
"
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    26
 COPYRIGHT (c) 2002 by eXept Software AG
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    27
              All Rights Reserved
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    28
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    29
 This software is furnished under a license and may be used
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    30
 only in accordance with the terms of that license and with the
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    32
 be provided or otherwise made available to, or used by, any
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    33
 other person.  No title to or ownership of the software is
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    34
 hereby transferred.
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    35
"
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    36
!
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    37
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    38
documentation
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    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.
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    42
    There is probably more to gome...
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    43
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    44
    [author:]
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    45
        Claus Gittiner
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    46
"
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    47
! !
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
!CodeGeneratorTool class methodsFor:'code generation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    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
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    54
    ^ self new 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    55
        createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly
4444
6b077945517c generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents: 4351
diff changeset
    56
!
6b077945517c generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents: 4351
diff changeset
    57
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
createApplicationCodeFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "create an empty application framework"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    61
    ^ self new createApplicationCodeFor:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
3804
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    64
createClassResponsibleProtocolFor:aClass
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    65
    "create stubs for the required protocol"
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    66
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    67
    ^ self new createClassResponsibleProtocolFor:aClass
3804
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    68
!
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    69
5124
487a63f34ac0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5013
diff changeset
    70
createClassTypeTestMethodsIn:aClass forClasses:subClasses
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    71
    "create a #isXXX test methods (I'm tired of typing)"
4351
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    72
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    73
    ^ self new createClassTypeTestMethodsIn:aClass forClasses:subClasses
4351
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    74
!
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    75
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
createDocumentationMethodsFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    "create empty documentation methods"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    79
    ^ self new createDocumentationMethodsFor:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
createStandardInitializationMethodsIn:aClass
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    83
    "create a #new and #initialize methods (I'm tired of typing)"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    85
    ^ self new createStandardInitializationMethodsIn:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
createTestCaseSampleCodeFor:aClass
4590
2447e35a81d4 testCase stub code
Claus Gittinger <cg@exept.de>
parents: 4512
diff changeset
    89
    "create an (almost) empty testCase class"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    91
    ^ self new createTestCaseSampleCodeFor:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    95
    "create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    97
    ^ self new createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
initialMenuSpecMethodSourceForApplications
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   101
    "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
   102
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
'mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
     the MenuEditor may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
     MenuEditor new openOnClass:%1 andSelector:#mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    <resource: #menu>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    ^ #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
           #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
                #label: ''File''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
                          #label: ''New''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
                          #value: #menuNew
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
                          #label: ''Open...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
                          #value: #menuOpen
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
                          #label: ''Save''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
                          #value: #menuSave
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
                          #label: ''Save As...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
                          #value: #menuSaveAs
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
                          #label: ''Exit''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
                          #value: #closeRequest
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
                #label: ''Help''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
                #startGroup: #right
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
                          #label: ''Documentation''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
                          #value: #openDocumentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
                          #label: ''About this Application''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
                          #value: #openAboutThisApplication
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
          ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
          nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
initialWindowSpecMethodSourceForApplications
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   193
    "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
   194
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    ^ #(#FullSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
          #window: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
           #(#WindowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
              #name: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
              #layout: #(#LayoutFrame 204 0 162 0 503 0 461 0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
              #label: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
              #min: #(#Point 10 10)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
              #max: #(#Point 1024 768)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
              #bounds: #(#Rectangle 204 162 504 462)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
              #menu: #mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
              #usePreferredExtent: false
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
          #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
           #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
              #collection: #()
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
initialWindowSpecMethodSourceForDialogs
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   229
    "return an empty windowSpec for dialogs"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   230
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
       #(#FullSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
          #window: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
           #(#WindowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
              #name: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
              #layout: #(#LayoutFrame 221 0 118 0 520 0 417 0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
              #level: 0
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
              #label: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
              #min: #(#Point 10 10)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
              #max: #(#Point 1024 768)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
              #bounds: #(#Rectangle 221 118 521 418)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
              #usePreferredExtent: false
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
          #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
           #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
              #collection: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
               #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
                 #(#HorizontalPanelViewSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
                    #name: ''buttonPanel''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
                    #layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 0 1.0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
                    #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
                     #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
                        #collection: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
                         #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
                          #(#ActionButtonSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
                             #name: ''cancelButton''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
                             #label: ''Cancel''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
                             #tabable: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
                             #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
                             #model: #cancel
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
                             #extent: #(#Point 125 22)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
                           )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
                           #(#ActionButtonSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
                              #name: ''okButton''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
                              #label: ''OK''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
                              #tabable: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
                              #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
                              #isDefault: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
                              #model: #accept
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
                              #extent: #(#Point 125 22)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
                          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
                        )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
                    )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
                    #reverseOrderIfOKAtLeft: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
                    #horizontalLayout: #spreadSpaceMax
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
                    #verticalLayout: #center
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
                    #horizontalSpace: 3
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
                    #verticalSpace: 3
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
              )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   300
!CodeGeneratorTool class methodsFor:'code generation-basic'!
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   301
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   302
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
   303
    "workhorse for creating access methods for instvars."
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   304
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   305
    ^ self new 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   306
        createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   307
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   308
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   309
!CodeGeneratorTool class methodsFor:'code generation-individual methods'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   310
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   311
createAcceptVisitorMethod:selector in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   312
    "create an acceptVisitor: method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   313
     (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   314
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   315
    ^ self new createAcceptVisitorMethod:selector in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   316
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   317
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   318
createAcceptVisitorMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   319
    "create an acceptVisitor: method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   320
     (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   321
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   322
    ^ self new createAcceptVisitorMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   323
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   324
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   325
createCopyrightMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   326
    "add copyright method containing your/your companies
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   327
     copyright template but only if not already present.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   328
     this is only added, if specified in the 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   329
     COPYRIGHT_TEMPLATE_FILE resources."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   330
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   331
    ^ self new createCopyrightMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   332
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   333
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   334
createDocumentationMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   335
    "add documentation method containing doc template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   336
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   337
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   338
    ^ self new createDocumentationMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   339
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   340
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   341
createExamplesMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   342
    "add examples method containing examples template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   343
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   344
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   345
    ^ self new createExamplesMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   346
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   347
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   348
createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   349
    ^ self new createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   350
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   351
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   352
createInitialHistoryMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   353
    "add history method containing created-entry
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   354
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   355
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   356
    ^ self new createInitialHistoryMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   357
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   358
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   359
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   360
    "add an inst-creation method"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   361
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   362
    ^ self new createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   363
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   364
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   365
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   366
    "create a multi-setter method for instvars."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   367
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   368
    ^ self new createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   369
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   370
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   371
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   372
    "add a subclassResponsibility method;
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   373
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   374
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   375
    ^ self new createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   376
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   377
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   378
createUpdateMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   379
    "create an update:with:from:-method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   380
     (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   381
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   382
    ^ self new createUpdateMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   383
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   384
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   385
createVersionMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   386
    "add version method containing RCS template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   387
     but only if not already present and its not a private class."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   388
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   389
    ^ self new createVersionMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   390
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   391
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   392
!CodeGeneratorTool class methodsFor:'compilation'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   393
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   394
compile:theCode forClass:aClass inCategory:cat 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   395
    "install some code for a class.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   396
     If refactory browser stuff is avaliable the refactory tools are used to support undo"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   397
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   398
    ^ self new compile:theCode forClass:aClass inCategory:cat
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   399
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   400
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   401
!CodeGeneratorTool class methodsFor:'private'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   402
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   403
canUseRefactoringSupport
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   404
    "check if refactory browser stuff is avaliable"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   405
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   406
     ^ RefactoryChangeManager notNil 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   407
    and:[RefactoryChangeManager isLoaded
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   408
    and:[UserPreferences current useRefactoringSupport]]
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   409
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   410
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   411
!CodeGeneratorTool methodsFor:'buld changes'!
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   412
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   413
executeCollectedChangesNamed:name
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   414
    compositeChangeCollector notNil ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   415
        compositeChangeNesting := compositeChangeNesting - 1.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   416
        compositeChangeNesting == 0 ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   417
            compositeChangeCollector name:name.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   418
            compositeChangeCollector changesSize == 0 ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   419
                self information:'Nothing generated.'.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   420
            ] ifFalse:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   421
                RefactoryChangeManager instance performChange:compositeChangeCollector.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   422
            ].
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   423
            compositeChangeCollector := nil.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   424
        ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   425
    ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   426
!
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   427
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   428
startCollectChanges
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   429
    (self canUseRefactoringSupport) ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   430
        compositeChangeCollector isNil ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   431
            compositeChangeCollector := CompositeRefactoryChange new.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   432
            compositeChangeNesting := 0.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   433
        ].
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   434
        compositeChangeNesting := compositeChangeNesting + 1.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   435
    ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   436
! !
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   437
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   438
!CodeGeneratorTool methodsFor:'code generation'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   439
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   440
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   441
    "create accessors in aClass"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   442
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   443
    self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   444
        createAccessMethodsFor:aCollectionOfVarNames 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   445
        in:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   446
        withChange:withChange 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   447
        asValueHolder:asValueHolder 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   448
        readersOnly:readersOnly 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   449
        writersOnly:writersOnly 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   450
        lazyInitialization:false
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   451
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   452
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   453
createApplicationCodeFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   454
    "create an empty application framework"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   455
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   456
    |nonMetaClass metaClass className txt isDialog categoryForMenuActionsMethods|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   457
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   458
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   459
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   460
    categoryForMenuActionsMethods := UserPreferences current categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   461
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   462
    nonMetaClass := aClass theNonMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   463
    metaClass := aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   464
    className := nonMetaClass name.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   465
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   466
    isDialog := (nonMetaClass isSubclassOf:SimpleDialog).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   467
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   468
    "/ add a windowSpec method for an empty applicationWindow,
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   469
    "/ with a menuPanel.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   470
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   471
    (metaClass includesSelector:#windowSpec) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   472
        isDialog ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   473
            txt := self class initialWindowSpecMethodSourceForDialogs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   474
        ] ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   475
            txt := self class initialWindowSpecMethodSourceForApplications.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   476
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   477
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   478
            compile:(txt bindWith:className)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   479
            forClass:metaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   480
            inCategory:'interface specs'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   481
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   482
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   483
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   484
        "/ add a topMenu method 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   485
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   486
        (metaClass includesSelector:#mainMenu) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   487
            txt := self class initialMenuSpecMethodSourceForApplications.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   488
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   489
                compile:(txt bindWith:className)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   490
                forClass:metaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   491
                inCategory:'menu specs'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   492
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   493
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   494
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   495
    (metaClass includesSelector:#postBuildWith:) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   496
        txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   497
'postBuildWith:aBuilder
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   498
    "This is a hook method generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   499
     It will be invoked during the initialization of your app/dialog,
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   500
     after all of the visual components have been built, 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   501
     but BEFORE the top window is made visible.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   502
     Add any app-specific actions here (reading files, setting up values etc.)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   503
     See also #postOpenWith:, which is invoked after opening."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   504
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   505
    "/ add any code here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   506
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   507
    ^ super postBuildWith:aBuilder
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   508
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   509
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   510
            compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   511
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   512
            inCategory:'initialization & release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   513
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   514
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   515
    (metaClass includesSelector:#postOpenWith:) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   516
        txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   517
'postOpenWith:aBuilder
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   518
    "This is a hook method generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   519
     It will be invoked right after the applications window has been opened.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   520
     Add any app-specific actions here (starting background processes etc.).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   521
     See also #postBuildWith:, which is invoked before opening."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   522
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   523
    "/ add any code here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   524
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   525
    ^ super postOpenWith:aBuilder
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   526
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   527
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   528
            compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   529
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   530
            inCategory:'initialization & release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   531
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   532
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   533
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   534
        (metaClass includesSelector:#closeRequest) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   535
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   536
'closeRequest
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   537
    "This is a hook method generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   538
     It will be invoked when your app/dialog-window is about to be
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   539
     closed (this method has a chance to suppress the close).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   540
     See also #closeDownViews, which is invoked when the close is really done."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   541
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   542
    "/ change the code below as required ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   543
    "/ Closing can be suppressed, by simply returning.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   544
    "/ The ''super closeRequest'' at the end will initiate the real closeDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   545
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   546
    ("self hasUnsavedChanges" true) ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   547
        (self confirm:(resources string:''Close without saving ?'')) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   548
            ^ self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   549
        ]
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   550
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   551
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   552
    ^ super closeRequest
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   553
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   554
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   555
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   556
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   557
                inCategory:'initialization & release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   558
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   559
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   560
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   561
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   562
        (metaClass includesSelector:#closeDownViews) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   563
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   564
'closeDownViews
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   565
    "This is a hook method generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   566
     It will be invoked when your app/dialog-window is really closed.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   567
     See also #closeDownViews, which is invoked before and may suppress the close
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   568
     or ask the user for confirmation."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   569
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   570
    "/ change the code below as required ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   571
    "/ This should cleanup any leftover resources
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   572
    "/ (for example, temporary files)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   573
    "/ super closeRequest will initiate the closeDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   574
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   575
    "/ add your code here
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   576
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   577
    "/ do not remove the one below ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   578
    ^ super closeDownViews
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   579
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   580
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   581
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   582
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   583
                inCategory:'initialization & release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   584
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   585
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   586
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   587
    isDialog ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   588
        (metaClass includesSelector:#accept) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   589
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   590
'closeAccept
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   591
    "This is a hook method generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   592
     It will be invoked when your dialog-window is closed with OK."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   593
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   594
    "/ add any actions as required here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   595
    Transcript showCR:''dialog accepted''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   596
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   597
    "/ do not remove the one below ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   598
    ^ super closeAccept
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   599
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   600
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   601
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   602
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   603
                inCategory:'user actions'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   604
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   605
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   606
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   607
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   608
        (metaClass includesSelector:#menuNew) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   609
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   610
'menuNew
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   611
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   612
     It will be invoked when the menu-item ''new'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   613
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   614
    "/ change below and add any actions as required here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   615
    self warn:''no action for ''''new'''' available.''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   616
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   617
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   618
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   619
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   620
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   621
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   622
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   623
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   624
        (metaClass includesSelector:#menuOpen) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   625
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   626
'menuOpen
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   627
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   628
     It will be invoked when the menu-item ''open'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   629
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   630
    "/ change below and add any actions as required here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   631
    self warn:''no action for ''''open'''' available.''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   632
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   633
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   634
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   635
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   636
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   637
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   638
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   639
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   640
        (metaClass includesSelector:#menuSave) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   641
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   642
'menuSave
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   643
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   644
     It will be invoked when the menu-item ''save'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   645
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   646
    "/ change below and add any actions as required here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   647
    self warn:''no action for ''''save'''' available.''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   648
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   649
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   650
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   651
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   652
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   653
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   654
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   655
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   656
        (metaClass includesSelector:#menuSaveAs) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   657
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   658
'menuSaveAs
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   659
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   660
     It will be invoked when the menu-item ''saveAs'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   661
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   662
    "/ change below and add any actions as required here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   663
    self warn:''no action for ''''saveAs'''' available.''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   664
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   665
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   666
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   667
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   668
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   669
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   670
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   671
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   672
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   673
        (metaClass includesSelector:#openDocumentation) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   674
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   675
'openDocumentation
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   676
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   677
     It will be invoked when the menu-item ''help-documentation'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   678
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   679
    "/ change below as required ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   680
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   681
    "/ to open an HTML viewer on some document (under ''doc/online/<language>/'' ):
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   682
    HTMLDocumentView openFullOnDocumentationFile:''TOP.html''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   683
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   684
    "/ add application-specific help files under the ''doc/online/<language>/help/appName''
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   685
    "/ directory, and open a viewer with:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   686
    "/ HTMLDocumentView openFullOnDocumentationFile:''help/<MyApplication>/TOP.html''.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   687
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   688
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   689
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   690
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   691
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   692
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   693
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   694
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   695
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   696
        (metaClass includesSelector:#openAboutThisApplication) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   697
            txt :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   698
'openAboutThisApplication
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   699
    "This method was generated by the Browser.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   700
     It will be invoked when the menu-item ''help-about'' is selected."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   701
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   702
    "/ could open a customized aboutBox here ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   703
    super openAboutThisApplication
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   704
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   705
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   706
                compile:txt
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   707
                forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   708
                inCategory:categoryForMenuActionsMethods.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   709
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   710
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   711
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   712
    self executeCollectedChangesNamed:('Add Application Code' , aClass nonMetaclass name).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   713
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   714
    "Modified: / 1.2.1998 / 16:10:03 / cg"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   715
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   716
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   717
createClassResponsibleProtocolFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   718
    "create stubs for the required protocol"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   719
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   720
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   721
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   722
    self privCreateClassResponsibleProtocolFor:aClass theNonMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   723
    self privCreateClassResponsibleProtocolFor:aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   724
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   725
    self executeCollectedChangesNamed:('Add Required Protocol to ' , aClass theNonMetaclass name).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   726
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   727
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   728
createClassTypeTestMethodsIn:aClass forClasses:subClasses
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   729
    "create a #isXXX test methods (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   730
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   731
    | code|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   732
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   733
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   734
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   735
    subClasses do:[:eachSubClass |
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   736
        |nm selector|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   737
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   738
        nm := eachSubClass nameWithoutPrefix.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   739
        selector := 'is' , nm.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   740
        (aClass includesSelector:selector) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   741
            code := (selector , '\    ^ false') withCRs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   742
            self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   743
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   744
                forClass:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   745
                inCategory:'testing'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   746
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   747
        (eachSubClass includesSelector:selector) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   748
            code := (selector , '\    ^ true') withCRs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   749
            self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   750
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   751
                forClass:eachSubClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   752
                inCategory:'testing'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   753
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   754
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   755
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   756
    self executeCollectedChangesNamed:'Add ClassType Tests'
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   757
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   759
createDocumentationMethodsFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   760
    "create empty documentation methods"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   761
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   762
    |cls|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   763
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   764
    cls := aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   765
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   766
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   767
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   768
    self createVersionMethodFor:cls.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   769
    self createCopyrightMethodFor:aClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   770
    self createDocumentationMethodFor:aClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   771
    self createInitialHistoryMethodFor:aClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   772
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   773
    self executeCollectedChangesNamed:('Add Documentation to ' , aClass theNonMetaclass name).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   774
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   775
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   776
createStandardInitializationMethodsIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   777
    "create a #new and #initialize methods (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   778
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   779
    |code initializer m|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   780
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   781
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   782
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   783
    (aClass includesSelector:#'initialize') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   784
        code :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   785
'initialize
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   786
    "Invoked when a new instance is created."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   787
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   788
    super initialize.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   789
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   790
    "/ please change as required (and remove this comment)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   791
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   792
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   793
        m := aClass responseTo:#initialize.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   794
        m notNil ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   795
            m messagesSent size == 0 ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   796
                "/ inherits an empty initialize.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   797
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   798
                code :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   799
'initialize
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   800
    "Invoked when a new instance is created."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   801
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   802
    "/ please change as required (and remove this comment)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   803
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   804
    "/ super initialize.   -- commented since inherited method does nothing
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   805
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   806
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   807
            ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   808
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   809
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   810
        aClass instVarNames do:[:eachInstVar |
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   811
            initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   812
            code := code , ('    ' , eachInstVar , ' := ' , initializer , Character cr).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   813
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   814
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   815
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   816
            compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   817
            forClass:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   818
            inCategory:'initialization'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   819
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   820
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   821
    (aClass class includesSelector:#'new') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   822
        m := aClass class responseTo:#new.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   823
        m notNil ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   824
            (m sends:#initialize) ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   825
                (self confirm:'The inherited #new method already seems to invoke #initialize. Redefine ?')
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   826
                ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   827
                    ^ self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   828
                ]
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   829
            ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   830
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   831
        code :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   832
'new
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   833
    ^ self basicNew initialize.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   834
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   835
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   836
            compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   837
            forClass:aClass class 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   838
            inCategory:'instance creation'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   839
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   840
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   841
    self executeCollectedChangesNamed:('Add Initialization to ' , aClass theNonMetaclass name).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   842
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   843
    "Created: / 11.10.2001 / 22:18:55 / cg"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   844
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   845
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   846
createTestCaseSampleCodeFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   847
    "create an (almost) empty testCase class"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   848
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   849
    |nonMetaClass metaClass|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   850
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   851
    nonMetaClass := aClass theNonMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   852
    metaClass := aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   853
    "/ className := nonMetaClass name.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   854
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   855
    ( nonMetaClass includesSelector:#test1 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   856
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   857
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   858
'test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   859
    "This is a demonstration testCase - it is meant to be removed eventually.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   860
     This testCase will PASS.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   861
     Double click on the TestCase class or open a TestRunner to see me checking...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   862
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   863
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   864
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   865
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   866
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   867
    self assert: ( o size == 2 ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   868
    self should: [ o at:0 ] raise:Error.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   869
    self shouldnt: [ o at:1 ] raise:Error.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   870
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   871
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   872
     self run:#test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   873
     self new test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   874
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   875
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   876
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   877
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   878
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   879
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   880
    ( nonMetaClass includesSelector:#test2 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   881
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   882
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   883
'test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   884
    "This is a demonstration testCase - it is meant to be removed eventually..
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   885
     This testCase WILL FAIL.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   886
     Double click on the TestCase class or open a TestRunner to see me checking...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   887
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   888
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   889
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   890
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   891
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   892
    self assert: ( o size == 3 ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   893
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   894
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   895
     self run:#test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   896
     self new test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   897
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   898
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   899
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   900
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   901
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   902
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   903
    ( nonMetaClass includesSelector:#test3 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   904
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   905
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   906
'test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   907
    "This is a demonstration testCase - it is meant to be removed eventually..
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   908
     This testCase WILL generate an ERROR.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   909
     Double click on the TestCase class or open a TestRunner to see me checking...
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   910
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   911
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   912
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   913
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   914
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   915
    self assert: ( o foo ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   916
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   917
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   918
     self run:#test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   919
     self new test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   920
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   921
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   922
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   923
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   924
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   925
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   926
    ( nonMetaClass includesSelector:#setUp ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   927
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   928
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   929
'setUp
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   930
    "common setup - invoked before testing."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   931
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   932
    super setUp
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   933
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   934
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   935
            inCategory:'initialize / release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   936
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   937
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   938
    ( nonMetaClass includesSelector:#tearDown ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   939
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   940
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   941
'tearDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   942
    "common cleanup - invoked after testing."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   943
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   944
    super tearDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   945
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   946
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   947
            inCategory:'initialize / release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   948
    ]
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   949
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   950
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   951
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   952
    "create acceptVisitor: in visitedClass and acceptXXX in visitorClass. (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   953
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   954
    |sel|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   955
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   956
    visitedClass isMeta ifTrue:[self halt].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   957
    visitorClass isMeta ifTrue:[self halt].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   958
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   959
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   960
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   961
    sel := ('visit' , visitedClass nameWithoutPrefix , ':').
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   962
    self createAcceptVisitorMethod:sel in:visitedClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   963
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   964
    (visitorClass includesSelector:sel) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   965
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   966
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   967
(('%1anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   968
    "dispatched back from the visited %2-object (visitor pattern)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   969
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   970
    "fall back to general object-case - please change as required"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   971
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   972
    ^ self visitObject:anObject
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   973
') bindWith:sel with:visitedClass nameWithoutPrefix asLowercaseFirst)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   974
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   975
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   976
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   977
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   978
    (visitorClass includesSelector:#'visitObject:') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   979
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   980
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   981
('visitObject:anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   982
    "dispatched back from the visited objects (visitor pattern)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   983
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   984
    "general fallBack - please change as required"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   985
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   986
    self halt:''not yet implemented''
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   987
')
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   988
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   989
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   990
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   991
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   992
    (visitorClass includesSelector:#'visit:') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   993
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   994
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   995
('visit:anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   996
    "visit anObject (visitor pattern).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   997
     The object should call back one of my visitXXXX methods."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   998
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   999
    ^ anObject acceptVisitor:self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1000
')
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1001
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1002
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1003
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1004
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1005
    self executeCollectedChangesNamed:('Add Visitor Pattern').
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1006
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1007
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1008
!CodeGeneratorTool methodsFor:'code generation-basic'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1009
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1010
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1011
    "workhorse for creating access methods for instvars."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1012
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1013
    |classesClassVars generateComments generateCommentsForSetters generateCommentsForGetters|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1014
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1015
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1016
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1017
    generateComments := UserPreferences current generateComments.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1018
    generateCommentsForSetters := UserPreferences current generateCommentsForSetters.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1019
    generateCommentsForGetters := UserPreferences current generateCommentsForGetters.
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1020
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1021
    classesClassVars := aClass theNonMetaclass allClassVarNames.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1022
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1023
    aCollectionOfVarNames do:[:name |
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1024
        |source varType methodName defaultMethodName|
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1025
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1026
        varType := (classesClassVars includes:name) 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1027
                        ifTrue:['static'] 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1028
                        ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1029
                            (aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1030
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1031
        methodName := name.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1032
        name first isUppercase ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1033
            methodName := methodName asLowercaseFirst. 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1034
        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1035
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1036
        "/ the GETTER
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1037
        writersOnly ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1038
            lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1039
                defaultMethodName := 'default' , name asUppercaseFirst.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1040
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1041
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1042
            "check, if method is not already present"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1043
            (aClass includesSelector:(methodName asSymbol)) ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1044
                asValueHolder ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1045
                    source := methodName , '\'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1046
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1047
                        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
  1048
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1049
                    source := source , '    %2 isNil ifTrue:[\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1050
                    lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1051
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1052
                                   , '        %2 := self class %3 asValue.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1053
                    ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1054
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1055
                                   , '        %2 := ValueHolder new.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1056
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1057
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1058
                    withChange ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1059
                    source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1060
                               , '        %2 addDependent:self.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1061
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1062
                    source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1063
                               , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1064
                               , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1065
                ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1066
                    source := methodName , '\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1067
                    lazyInitialization ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1068
                        generateCommentsForGetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1069
                            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
  1070
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1071
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1072
                                    , '    %2 isNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1073
                                    , '        %2 := self class %3.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1074
                                    , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1075
                                    , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1076
                    ] ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1077
                        generateCommentsForGetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1078
                            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
  1079
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1080
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1081
                                    , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1082
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1083
                ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1084
                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
  1085
                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
  1086
            ] ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1087
                Transcript showCR:'method ''', methodName , ''' already present'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1088
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1089
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1090
            "/ default for lazy on class side
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1091
            lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1092
                (aClass class includesSelector:(defaultMethodName asSymbol)) ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1093
                    source := defaultMethodName , '\'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1094
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1095
                        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
  1096
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1097
                    source := source    
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1098
                               , '    self halt:''unfinished code''.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1099
                               , '    ^ nil.'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1100
                    source := (source bindWith:varType with:name) withCRs.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1101
                    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
  1102
                ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1103
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1104
        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1105
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1106
        "/ the SETTER
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1107
        readersOnly ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1108
            (aClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1109
                asValueHolder ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1110
                    source := methodName , ':something\'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1111
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1112
                        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
  1113
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1114
                    withChange ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1115
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1116
                                  , '    |oldValue newValue|\\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1117
                                  , '    %2 notNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1118
                                  , '        oldValue := %2 value.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1119
                                  , '        %2 removeDependent:self.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1120
                                  , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1121
                                  , '    %2 := something.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1122
                                  , '    %2 notNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1123
                                  , '        %2 addDependent:self.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1124
                                  , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1125
                                  , '    newValue := %2 value.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1126
                                  , '    oldValue ~~ newValue ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1127
                                  , '        self update:#value with:newValue from:%2.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1128
                                  , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1129
                    ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1130
                        source := source 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1131
                                  , '    %2 := something.'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1132
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1133
                ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1134
                    source := methodName , ':something\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1135
                    withChange ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1136
                        generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1137
                            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
  1138
                            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
  1139
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1140
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1141
                                  , '    (%2 ~~ something) ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1142
                                  , '        %2 := something.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1143
                                  , '        self changed:#%2.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1144
                                  , '     ].\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1145
                    ] ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1146
                        generateCommentsForSetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1147
                            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
  1148
                            source := source , ' (automatically generated)"\\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1149
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1150
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1151
                                  , '    %2 := something.'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1152
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1153
                ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1154
                source := (source bindWith:varType with:name) withCRs.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1155
                self 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1156
                    compile:source 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1157
                    forClass:aClass 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1158
                    inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1159
            ] ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1160
                Transcript showCR:'method ''', methodName , ':'' already present'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1161
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1162
        ].
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1163
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1164
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1165
    self executeCollectedChangesNamed:('Add Accessors').
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1166
! !
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1167
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1168
!CodeGeneratorTool methodsFor:'code generation-individual methods'!
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
createAcceptVisitorMethod:selector in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1174
    aClass isMeta ifTrue:[self halt].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1175
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
    (aClass includesSelector:#'acceptVisitor:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
(('acceptVisitor:aVisitor 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
    "Double dispatch back to the visitor, passing my type encoded in
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
     the selector (visitor pattern)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
    "stub code automatically generated - please change if required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1184
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1185
    ^ aVisitor %1self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1186
') bindWith:selector)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1187
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1188
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1189
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1190
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
createAcceptVisitorMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1193
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1195
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1196
    self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
        createAcceptVisitorMethod:('visit' , aClass nameWithoutPrefix , ':') asSymbol
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
        in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
createCopyrightMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
    "add copyright method containing your/your companies
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
     copyright template but only if not already present.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
     this is only added, if specified in the 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
     COPYRIGHT_TEMPLATE_FILE resources."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1206
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
    |fn txt|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
    (aClass includesSelector:#copyright) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
        fn := SystemBrowser classResources at:#'COPYRIGHT_TEMPLATE_FILE' default:nil.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
        fn notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
            fn := fn asFilename.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
            fn exists ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
                txt := fn contents asString
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
            ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
        txt notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1219
            txt := txt bindWith:(Date today year).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1220
            self compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
'copyright
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
' , txt , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
'             forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
              inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
createDocumentationMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
    "add documentation method containing doc template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1235
    |userName loginName hostName emailAddress code|
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1236
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    (aClass includesSelector:#documentation) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
        userName := OperatingSystem getFullUserName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
        loginName := OperatingSystem getLoginName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1240
        hostName := OperatingSystem getHostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1241
        emailAddress := loginName , '@' , hostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1242
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1243
        "/ ugly; should ask the class for that    
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1244
        aClass isJavaScriptClass ifTrue:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1245
            code :=
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1246
'function documentation() {
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1247
/*
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1248
' , (aClass theNonMetaclass comment ? '    documentation to be added.') , '
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1249
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1250
    [author:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1251
        ' , userName 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1252
          , ' (' , emailAddress , ')' , '
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1253
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1254
    [instance variables:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1255
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1256
    [class variables:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1257
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1258
    [see also:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1259
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1260
*/
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1261
}
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1262
'
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1263
        ] ifFalse:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1264
            code:= 
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
'documentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
"
5401
dfe896e65a14 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5313
diff changeset
  1267
' , (aClass theNonMetaclass comment ? '    documentation to be added.') , '
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
    [author:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
        ' , userName 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
          , ' (' , emailAddress , ')' , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
    [instance variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
    [class variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
    [see also:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
"
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1280
'
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1281
        ].
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1282
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1283
        self 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1284
            compile:code
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1285
            forClass:aClass 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1286
            inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
createExamplesMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
    "add examples method containing examples template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
    |fragment|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
    (aClass includesSelector:#examples) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
        (aClass theNonMetaclass isSubclassOf:ApplicationModel) ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
            fragment := '  Starting the application:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
                                                                [exBegin]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
    ' , aClass theNonMetaclass name , ' open
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1302
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1303
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1304
        ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1305
            fragment := ''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1306
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1308
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
'examples
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
' , fragment , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
  more examples to be added:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
                                                                [exBegin]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
    ... add code fragment for 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
    ... executable example here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
'                   
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
            inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
3822
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1325
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
  1326
    |imageStoreStream mthd imageKey category|
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1327
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1328
    anImage storeOn: (imageStoreStream := WriteStream on: '').
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1329
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1330
    "/ 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
  1331
    category := 'image specs'.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1332
    (mthd := aClass compiledMethodAt:sel) notNil ifTrue:[
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1333
        category := mthd category.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1334
    ].
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1335
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1336
    imageKey :=  (aClass name, ' ', sel) asSymbol.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1337
    Icon constantNamed: imageKey put:nil.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1338
    aClass
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1339
        compile: ((sel,
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1340
            '\', comment,
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1341
            '\\' , 
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1342
            '    "\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1343
            '     self ' , sel , ' inspect\',
3823
1ed101fe88a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  1344
            '     ImageEditor openOnClass:self andSelector:#', sel, '\',
3822
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1345
            '     Icon flushCachedIcons', 
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1346
            '\    "',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1347
            '\\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1348
            '    <resource: #image>',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1349
            '\\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1350
            '    ^Icon\') withCRs, 
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1351
            '        constantNamed:#''', imageKey, '''\' withCRs,
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1352
            '        ifAbsentPut:[', imageStoreStream contents, ']')
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1353
       classified: category.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1354
!
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  1355
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1356
createInitialHistoryMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
    "add history method containing created-entry
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1359
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1360
    |code|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1361
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
    (aClass includesSelector:#history) ifFalse:[ 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
        HistoryManager notNil ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1364
            code := HistoryManager codeForInitialHistoryMethodIn:aClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1365
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1366
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1367
                forClass:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1368
                inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1369
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1370
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1371
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
4512
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1373
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1374
    "add an inst-creation method"
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1375
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1376
    |template|
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1377
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1378
    (aMetaClass includesSelector:selector) ifFalse:[
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1379
        template := Parser methodSpecificationForSelector:selector.
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1380
        self 
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1381
            compile:
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1382
template , '
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1383
    ^ self new ' , template , '
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1384
'                   
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1385
            forClass:aMetaClass 
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1386
            inCategory:category.
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1387
    ].
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1388
!
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  1389
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1390
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1391
    "create a multi-setter method for instvars."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1392
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1393
    |source|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
    source := ''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
        source := source , (eachVar , ':' , eachVar , 'Arg ').
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1398
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
    source := source , Character cr.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
    source := source , ('    "set instance variables (automatically generated)"' , Character cr , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
        source := source , ('    ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
    self compile:source forClass:aClass inCategory:'accessing'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
3800
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1407
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1408
    "add a subclassResponsibility method;
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1409
     but only if not already present."
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1410
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1411
    (aClass includesSelector:aSelector) ifFalse:[
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1412
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1413
        self compile:
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1414
(Method methodDefinitionTemplateForSelector:aSelector) ,
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1415
'
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1416
    "raise an error: must be redefined in concrete subclass(es)"
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1417
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1418
    ^ self subclassResponsibility
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1419
' 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1420
              forClass:aClass 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1421
              inCategory:cat.
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1422
    ].
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1423
!
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1424
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1425
createUpdateMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1426
    "create an update:with:from:-method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
    (aClass includesSelector:#'update:with:from:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
'update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
    "Invoked when an object that I depend upon sends a change notification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
    "stub code automatically generated - please change as required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1436
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1437
    "/ changedObject == someOfMyValueHolders ifTrue:[
4926
f0ab6bb01771 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4908
diff changeset
  1438
    "/     self doSomethingApropriate.
f0ab6bb01771 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4908
diff changeset
  1439
    "/     ^ self.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
    "/ ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
    super update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
            inCategory:'change & update'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
createVersionMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
    "add version method containing RCS template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
     but only if not already present and its not a private class."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1452
    |code|
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1453
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1454
    aClass isPrivate ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
        (aClass includesSelector:#version) ifFalse:[
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1456
            "/ ugly; should ask the class for that    
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1457
            aClass isJavaScriptClass ifTrue:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1458
                code:= ('function version() {\    return ("$' , 'Header$");\}') withCRs
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1459
            ] ifFalse:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1460
                code:= ('version\    ^ ''$' , 'Header$''') withCRs
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1461
            ].
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1462
            self 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1463
                compile:code
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1464
                forClass:aClass 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  1465
                inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1469
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1470
!CodeGeneratorTool methodsFor:'compilation'!
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1472
compile:theCode forClass:aClass inCategory:cat 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1473
    "install some code for a class.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1474
     If refactory browser stuff is avaliable the refactory tools are used to support undo"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1475
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
    |change|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
    self canUseRefactoringSupport ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1479
        "/ compile immediately
3716
cbaffbf250f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
  1480
        aClass compile:theCode classified:cat.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1481
        ^ self.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
3716
cbaffbf250f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
  1484
    change := InteractiveAddMethodChange compile:(theCode asString) in:aClass classified:cat.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1485
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1486
    "/ if collecting, add to changes (to be executed as one change at the end,
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1487
    "/ in order to have only one change in the undo-list (instead of many)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1488
    compositeChangeCollector notNil ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1489
        compositeChangeCollector addChange:change
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1490
    ] ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1491
        RefactoryChangeManager instance performChange:change.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1492
    ]
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1493
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1494
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1495
!CodeGeneratorTool methodsFor:'private'!
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1496
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1497
canUseRefactoringSupport
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1498
    "check if refactory browser stuff is avaliable"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1499
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1500
     ^ self class canUseRefactoringSupport
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1501
!
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1502
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1503
privCreateClassResponsibleProtocolFor:aClass
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1504
    "create stubs for the required protocol aClass may be a a MetaClass
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1505
     or a NonMetaClass"
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1506
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1507
    |selectors|
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1508
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1509
    selectors := IdentitySet new.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1510
    aClass allSuperclassesDo:[:cls |
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1511
        cls methodDictionary keysAndValuesDo:[:sel :mthd |
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1512
            (mthd sends:#subclassResponsibility) ifTrue:[
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1513
                selectors add:sel.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1514
            ]
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1515
        ]
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1516
    ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1517
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1518
    selectors do:[:eachSelector |
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1519
        |cat comment mthd implClass|
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1520
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1521
        implClass := aClass whichClassImplements:eachSelector.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1522
        implClass ~~ aClass ifTrue:[
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1523
            mthd := implClass compiledMethodAt:eachSelector.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1524
            (mthd sends:#subclassResponsibility) ifTrue:[
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1525
                cat := mthd category.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1526
                comment := mthd methodComment.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1527
                comment size == 0 ifTrue:[
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1528
                    comment := 'Superclass says that I am responsible to implement this method'
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1529
                ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1530
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1531
                self 
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1532
                    compile:
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1533
(Method methodDefinitionTemplateForSelector:eachSelector), Character cr, '    "', comment,
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1534
'"
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1535
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1536
    self shouldImplement
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1537
' 
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1538
                    forClass:aClass 
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1539
                    inCategory:cat.
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1540
            ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1541
        ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1542
    ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1543
! !
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  1544
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
!CodeGeneratorTool class methodsFor:'documentation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1546
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1547
version
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
  1548
    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.25 2004-03-19 12:14:48 cg Exp $'
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
! !