CodeGeneratorTool.st
author fm
Mon, 26 Oct 2009 13:54:28 +0100
changeset 9081 d59a59877121
parent 9054 5ee0f83a1944
child 9099 2729600bb93c
permissions -rw-r--r--
changed: #createStartupCodeFor:forStartOf:
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
"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Object subclass:#CodeGeneratorTool
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    15
	instanceVariableNames:'compositeChangeCollector compositeChangeNesting userPreferences
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    16
		generateComments'
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
    17
	classVariableNames:'GenerateCommentsForGetters GenerateCommentsForSetters
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
    18
		CopyrightTemplate'
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Interface-Browsers'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    23
!CodeGeneratorTool class methodsFor:'documentation'!
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    24
5141
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    25
copyright
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    26
"
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    27
 COPYRIGHT (c) 2002 by eXept Software AG
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    28
              All Rights Reserved
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    29
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    30
 This software is furnished under a license and may be used
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    31
 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
    32
 inclusion of the above copyright notice.   This software may not
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    34
 other person.  No title to or ownership of the software is
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    35
 hereby transferred.
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
!
ffd2a0198999 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5124
diff changeset
    38
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    39
documentation
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    40
"
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    41
    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
    42
    these were extracted from the old and newBrowser.
6791
6559c9ebb561 Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents: 6718
diff changeset
    43
    There is probably more to come...
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    44
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    45
    [author:]
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    46
        Claus Gittiner
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    47
"
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    48
! !
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    50
!CodeGeneratorTool class methodsFor:'instance creation'!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    51
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    52
new
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    53
    ^ self basicNew initialize.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    54
! !
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
    55
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
!CodeGeneratorTool class methodsFor:'code generation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
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
    59
    "create accessors in aClass"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    60
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    61
    ^ self new 
6313
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    62
        createAccessMethodsFor:aCollectionOfVarNames 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    63
        in:aClass 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    64
        withChange:withChange 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    65
        asValueHolder:asValueHolder 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    66
        readersOnly:readersOnly 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    67
        writersOnly:writersOnly
4444
6b077945517c generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents: 4351
diff changeset
    68
!
6b077945517c generate instvar accessors with lazy-init
Claus Gittinger <cg@exept.de>
parents: 4351
diff changeset
    69
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
createApplicationCodeFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    "create an empty application framework"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    73
    ^ self new createApplicationCodeFor:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
3804
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    76
createClassResponsibleProtocolFor:aClass
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    77
    "create stubs for the required protocol"
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    78
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    79
    ^ self new createClassResponsibleProtocolFor:aClass
3804
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    80
!
d2bc07d678f3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3800
diff changeset
    81
5124
487a63f34ac0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5013
diff changeset
    82
createClassTypeTestMethodsIn:aClass forClasses:subClasses
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    83
    "create a #isXXX test methods (I'm tired of typing)"
4351
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    84
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
    85
    ^ self new createClassTypeTestMethodsIn:aClass forClasses:subClasses
4351
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    86
!
cc4739c4797b create test methods
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
    87
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
createDocumentationMethodsFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    "create empty documentation methods"
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 createDocumentationMethodsFor: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
6313
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    94
createEnumTypeCodeFor:aClass
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    95
    ^ self new createEnumTypeCodeFor:aClass
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    96
!
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
    97
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
    98
createInitializedInstanceCreationMethodsIn:aClass
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
    99
    "create a #new and #initialize methods (I'm tired of typing)"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   101
    ^ self new createInitializedInstanceCreationMethodsIn:aClass
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   102
!
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   103
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   104
createParametrizedInstanceCreationMethodsNamed:selector in:aClass
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   105
    "create a #selector instance creation method (I'm tired of typing)"
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   106
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
   107
    ^ self new createParametrizedInstanceCreationMethodsNamed:selector in:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
8344
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   110
createRedefinedInstanceCreationMethodsIn:aClass
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   111
    "create a redefined #new method"
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   112
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   113
    ^ self new createRedefinedInstanceCreationMethodsIn:aClass
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   114
!
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
   115
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
   116
createStartupCodeFor:aClass forStartOf:anApplicationClassOrNil
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
   117
    "create standAloneStartup code"
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
   118
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
   119
    ^ self new createStartupCodeFor:aClass forStartOf:anApplicationClassOrNil
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
   120
!
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
   121
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
createTestCaseSampleCodeFor:aClass
4590
2447e35a81d4 testCase stub code
Claus Gittinger <cg@exept.de>
parents: 4512
diff changeset
   123
    "create an (almost) empty testCase class"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   125
    ^ self new createTestCaseSampleCodeFor:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   129
    "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
   130
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   131
    ^ self new createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   134
createWebApplicationCodeFor:aClass
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   135
    "create an empty webApplication framework"
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   136
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   137
    ^ self new createWebApplicationCodeFor:aClass
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   138
!
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   139
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   140
createWebServiceCodeFor:aClass
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   141
    "create an empty webService framework"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   142
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   143
    ^ self new createWebServiceCodeFor:aClass
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   144
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   145
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   146
createWidgetCodeFor:aClass
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   147
    "create usually required widget code (redraw, model update, event handling)"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   148
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   149
    ^ self new createWidgetCodeFor:aClass
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   150
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   151
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
initialMenuSpecMethodSourceForApplications
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   153
    "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
   154
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
'mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
     the MenuEditor may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
     MenuEditor new openOnClass:%1 andSelector:#mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    <resource: #menu>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    ^ #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
           #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
                #label: ''File''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
                          #label: ''New''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
                          #value: #menuNew
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
                          #label: ''Open...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
                          #value: #menuOpen
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
                          #label: ''Save''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
                          #value: #menuSave
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
                          #label: ''Save As...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
                          #value: #menuSaveAs
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
                          #label: ''Exit''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
                          #value: #closeRequest
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
                #label: ''Help''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
                #startGroup: #right
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
                          #label: ''Documentation''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
                          #value: #openDocumentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
                       #(#MenuItem
6643
abd4749a00ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6350
diff changeset
   230
                          #label: ''About this Application...''
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
                          #value: #openAboutThisApplication
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
          ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
          nil
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
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   244
initialPageMenuSpec
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   245
    "return a menuSpec with typical stuff in it"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   246
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   247
    "This resource specification was automatically generated by the CodeGeneratorTool."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   248
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   249
    "Do not manually edit this!! If it is corrupted,
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   250
     the MenuEditor may not be able to read the specification."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   251
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   252
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   253
     MenuEditor new openOnClass:%1 andSelector:#mainMenu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   254
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   255
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   256
    <resource: #menu>
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   257
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   258
    ^ #(#Menu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   259
           #(
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   260
             #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   261
                #label: 'AAA'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   262
                #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   263
                #submenu: 
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   264
                 #(#Menu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   265
                     #(
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   266
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   267
                          #label: 'New'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   268
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   269
                          #value: #menuNew
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   270
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   271
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   272
                          #label: '-'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   273
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   274
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   275
                          #label: 'Open...'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   276
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   277
                          #value: #menuOpen
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   278
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   279
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   280
                          #label: '-'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   281
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   282
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   283
                          #label: 'Save'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   284
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   285
                          #value: #menuSave
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   286
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   287
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   288
                          #label: 'Save As...'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   289
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   290
                          #value: #menuSaveAs
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   291
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   292
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   293
                          #label: '-'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   294
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   295
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   296
                          #label: 'Exit'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   297
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   298
                          #value: #closeRequest
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   299
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   300
                    ) nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   301
                    nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   302
                )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   303
            )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   304
             #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   305
                #label: 'Help'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   306
                #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   307
                #startGroup: #right
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   308
                #submenu: 
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   309
                 #(#Menu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   310
                     #(
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   311
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   312
                          #label: 'Documentation'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   313
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   314
                          #value: #openDocumentation
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   315
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   316
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   317
                          #label: '-'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   318
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   319
                       #(#MenuItem
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   320
                          #label: 'About this Application...'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   321
                          #translateLabel: true
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   322
                          #value: #openAboutThisApplication
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   323
                      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   324
                    ) nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   325
                    nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   326
                )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   327
            )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   328
          ) nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   329
          nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   330
      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   331
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   332
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   333
initialPageMenuSpecMethodSourceForWebApplications
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   334
    "return a menuSpec with typical stuff in it"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   335
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   336
    ^
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   337
'mainMenu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   338
    "This resource specification was automatically generated by the CodeGeneratorTool."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   339
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   340
    "Do not manually edit this!! If it is corrupted,
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   341
     the MenuEditor may not be able to read the specification."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   342
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   343
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   344
     MenuEditor new openOnClass:%1 andSelector:#mainMenu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   345
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   346
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   347
    <resource: #menu>
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   348
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   349
    ^ ',(self initialPageMenuSpec decodeAsLiteralArray literalArrayEncoding storeString),'
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   350
'.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   351
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   352
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   353
     self initialPageMenuSpecMethodSourceForWebApplications
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   354
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   355
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   356
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   357
initialPageSpecMethodSourceForWebApplications
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   358
    "return an empty pageSpec"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   359
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   360
    ^
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   361
'pageSpec
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   362
    "This resource specification was automatically generated by the CodeGeneratorTool."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   363
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   364
    "Do not manually edit this!! If it is corrupted,
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   365
     the UIPainter may not be able to read the specification."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   366
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   367
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   368
     UIPainter new openOnClass:%1 andSelector:#windowSpec
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   369
    "
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   370
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   371
    <resource: #canvas>
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   372
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   373
    ^ #(#FullSpec
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   374
          #window: 
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   375
           #(#WindowSpec
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   376
              #name: ''%1''
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   377
              #layout: #(#LayoutFrame 204 0 162 0 503 0 461 0)
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   378
              #label: ''%1''
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   379
              #min: #(#Point 10 10)
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   380
              #max: #(#Point 1024 768)
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   381
              #bounds: #(#Rectangle 204 162 504 462)
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   382
              #menu: #pageMenu
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   383
              #usePreferredExtent: false
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   384
          )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   385
          #component: 
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   386
           #(#SpecCollection
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   387
              #collection: #()
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   388
          )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   389
      )
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   390
'.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   391
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   392
9054
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   393
initialWindowSpecForApplications
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   394
    "This resource specification was automatically generated
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   395
     by the UIPainter of ST/X."
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   396
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   397
    "Do not manually edit this!! If it is corrupted,
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   398
     the UIPainter may not be able to read the specification."
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   399
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   400
    "
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   401
     UIPainter new openOnClass:CodeGeneratorTool andSelector:#initialWindowSpecForApplications
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   402
    "
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   403
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   404
    <resource: #canvas>
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   405
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   406
    ^ 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   407
     #(FullSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   408
        name: initialWindowSpecForApplications
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   409
        window: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   410
       (WindowSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   411
          label: '%1'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   412
          name: '%1'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   413
          min: (Point 10 10)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   414
          max: (Point 1024 768)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   415
          bounds: (Rectangle 0 0 300 300)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   416
          menu: mainMenu
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   417
        )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   418
        component: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   419
       (SpecCollection
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   420
          collection: (
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   421
           (LabelSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   422
              label: 'Hello World'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   423
              name: 'Label1'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   424
              layout: (LayoutFrame 0 0.0 60 0 0 1.0 219 0)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   425
              translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   426
            )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   427
           )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   428
         
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   429
        )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   430
      )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   431
!
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   432
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   433
initialWindowSpecForDialogs
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   434
    <resource: #canvas>
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   435
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   436
    "return an initial windowSpec for dialogs"
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   437
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   438
    ^  #(#FullSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   439
          #window: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   440
           #(#WindowSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   441
              #name: '%1'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   442
              #layout: #(#LayoutFrame 221 0 118 0 520 0 417 0)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   443
              #level: 0
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   444
              #label: '%1'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   445
              #min: #(#Point 10 10)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   446
              #max: #(#Point 1024 768)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   447
              #bounds: #(#Rectangle 221 118 521 418)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   448
              #usePreferredExtent: false
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   449
          )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   450
          #component: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   451
           #(#SpecCollection
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   452
              #collection: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   453
               #(
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   454
                 #(#HorizontalPanelViewSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   455
                    #name: 'buttonPanel'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   456
                    #layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 0 1.0)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   457
                    #component: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   458
                     #(#SpecCollection
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   459
                        #collection: 
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   460
                         #(
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   461
                          #(#ActionButtonSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   462
                             #name: 'cancelButton'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   463
                             #label: 'Cancel'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   464
                             #tabable: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   465
                             #translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   466
                             #model: #cancel
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   467
                             #extent: #(#Point 125 22)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   468
                           )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   469
                           #(#ActionButtonSpec
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   470
                              #name: 'okButton'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   471
                              #label: 'OK'
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   472
                              #tabable: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   473
                              #translateLabel: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   474
                              #isDefault: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   475
                              #model: #accept
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   476
                              #extent: #(#Point 125 22)
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   477
                          )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   478
                        )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   479
                    )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   480
                    #reverseOrderIfOKAtLeft: true
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   481
                    #horizontalLayout: #spreadSpaceMax
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   482
                    #verticalLayout: #center
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   483
                    #horizontalSpace: 3
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   484
                    #verticalSpace: 3
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   485
                )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   486
              )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   487
          )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   488
      )
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   489
!
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   490
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
initialWindowSpecMethodSourceForApplications
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   492
    "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
   493
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
9054
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   507
    ^ ',
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   508
        self initialWindowSpecForApplications decodeAsLiteralArray prettyPrintString           
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   509
.
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   510
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   511
    "
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   512
     self initialWindowSpecMethodSourceForApplications
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   513
    "
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
initialWindowSpecMethodSourceForDialogs
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   517
    "return an empty windowSpec for dialogs"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   518
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
9054
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   532
    ^ ',
Claus Gittinger <cg@exept.de>
parents: 9053
diff changeset
   533
        self initialWindowSpecForDialogs decodeAsLiteralArray prettyPrintString           
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   536
!CodeGeneratorTool class methodsFor:'code generation-basic'!
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   537
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   538
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
   539
    "workhorse for creating access methods for instvars."
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
   540
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   541
    ^ self new 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   542
        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
   543
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   544
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   545
!CodeGeneratorTool class methodsFor:'code generation-individual methods'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   546
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   547
createAcceptVisitorMethod:selector in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   548
    "create an acceptVisitor: method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   549
     (I'm tired of typing)"
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
    ^ self new createAcceptVisitorMethod:selector in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   552
!
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
createAcceptVisitorMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   555
    "create an acceptVisitor: method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   556
     (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   557
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   558
    ^ self new createAcceptVisitorMethodIn:aClass
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
createCopyrightMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   562
    "add copyright method containing your/your companies
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   563
     copyright template but only if not already present.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   564
     this is only added, if specified in the 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   565
     COPYRIGHT_TEMPLATE_FILE resources."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   566
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   567
    ^ self new createCopyrightMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   568
!
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
createDocumentationMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   571
    "add documentation method containing doc template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   572
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   573
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   574
    ^ self new createDocumentationMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   575
!
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
createExamplesMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   578
    "add examples method containing examples template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   579
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   580
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   581
    ^ self new createExamplesMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   582
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   583
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   584
createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   585
    ^ self new createImageSpecMethodFor:anImage comment:comment in:aClass selector:sel
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
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   588
createInitialHistoryMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   589
    "add history method containing created-entry
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   590
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   591
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   592
    ^ self new createInitialHistoryMethodFor:aClass
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
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   595
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   596
    "add an inst-creation method"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   597
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   598
    ^ self new createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
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
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   601
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   602
    "create a multi-setter method for instvars."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   603
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   604
    ^ self new createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
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
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   608
    "add a subclassResponsibility method;
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   609
     but only if not already present."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   610
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   611
    ^ self new createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   612
!
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
createUpdateMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   615
    "create an update:with:from:-method
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   616
     (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   617
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   618
    ^ self new createUpdateMethodIn:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   619
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   620
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   621
createVersionMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   622
    "add version method containing RCS template
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   623
     but only if not already present and its not a private class."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   624
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   625
    ^ self new createVersionMethodFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   626
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   627
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   628
!CodeGeneratorTool class methodsFor:'code generation-menus'!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   629
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   630
createActionMethodFor:aSelector in:aClass category:aCategory redefine:redefine
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   631
    |alreadyInSuperclass method code|
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   632
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   633
    (aClass includesSelector:aSelector) ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   634
        ^ nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   635
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   636
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   637
    alreadyInSuperclass := aClass superclass canUnderstand:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   638
    (alreadyInSuperclass and:[redefine not]) ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   639
        ^ nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   640
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   641
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   642
    method := self methodNameTemplateFor:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   643
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   644
    code := '%1
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   645
    "automatically generated by UIEditor ..."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   646
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   647
    "*** the code below performs no action"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   648
    "*** (except for some feedback on the Transcript)"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   649
    "*** Please change as required and accept in the browser."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   650
    "*** (and replace this comment by something more useful ;-)"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   651
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   652
    "action to be added ..."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   653
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   654
    Transcript showCR:self class name, '': action for #%2 ...''.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   655
' bindWith:method with:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   656
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   657
    alreadyInSuperclass ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   658
        code := code, (('\    super %1\' bindWith:method) withCRs).
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   659
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   660
    self compile:code forClass:aClass inCategory:(aCategory ? 'actions').
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   661
    ^ code
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   662
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   663
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   664
createAspectMethodFor:aSelector in:aClass category:aCategory redefine:redefine
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   665
    |alreadyInSuperclass method code text|
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   666
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   667
    (aClass includesSelector:aSelector) ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   668
        ^ nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   669
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   670
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   671
    alreadyInSuperclass := aClass superclass canUnderstand:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   672
    (alreadyInSuperclass and:[redefine not]) ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   673
        ^ nil
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   674
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   675
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   676
    method := self methodNameTemplateFor:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   677
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   678
    code := '%1
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   679
    "automatically generated by UIEditor ..."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   680
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   681
    "*** the code below creates a default model when invoked"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   682
    "*** (which may not be the one you wanted)"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   683
    "*** Please change as required and accept in the browser."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   684
    "*** (and replace this comment by something more useful ;-)"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   685
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   686
    "aspect to be added ..."
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   687
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   688
    Transcript showCR:self class name, '': aspect for #%2 ...''.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   689
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   690
' bindWith:method with:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   691
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   692
    alreadyInSuperclass ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   693
        text := '    ^ super %1\' bindWith:method.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   694
    ] ifFalse:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   695
        text := '    ^ builder valueAspectFor:#''%1'' initialValue:true\' bindWith:aSelector.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   696
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   697
    code := code, (text withCRs).
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   698
    self compile:code forClass:aClass inCategory:(aCategory ? 'actions').
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   699
    ^ code
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   700
! !
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   701
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   702
!CodeGeneratorTool class methodsFor:'compilation'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   703
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   704
compile:theCode forClass:aClass inCategory:cat 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   705
    "install some code for a class.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   706
     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
   707
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   708
    ^ self new compile:theCode forClass:aClass inCategory:cat
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
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   711
!CodeGeneratorTool class methodsFor:'defaults'!
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   712
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   713
copyrightTemplate
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   714
    "return the contents of COPYRIGHT_TEMPLATE_FILE resources
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   715
     or a standard template"
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   716
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   717
    |fn|
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   718
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   719
    CopyrightTemplate notNil ifTrue:[^ CopyrightTemplate].
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   720
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   721
    fn := SystemBrowser classResources at:#'COPYRIGHT_TEMPLATE_FILE' default:nil.
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   722
    fn notNil ifTrue:[
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   723
        fn := fn asFilename.
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   724
        fn exists ifTrue:[
8488
bb2810d17bd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8344
diff changeset
   725
            ^ fn contentsAsString.
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   726
        ].
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   727
    ].
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   728
    ^ ' COPYRIGHT (c) %1 by >>yourCompany<<
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   729
              All Rights Reserved
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   730
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   731
 This software is furnished under a license and may be used
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   732
 only in accordance with the terms of that license and with the
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   733
 inclusion of the above copyright notice.   This software may not
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   734
 be provided or otherwise made available to, or used by, any
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   735
 other person.  No title to or ownership of the software is
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   736
 hereby transferred.
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   737
'.
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   738
!
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   739
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   740
copyrightTemplate:aString
8488
bb2810d17bd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8344
diff changeset
   741
    "set the COPYRIGHT_TEMPLATE_FILE"
bb2810d17bd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8344
diff changeset
   742
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   743
    CopyrightTemplate := aString.
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   744
! !
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
   745
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   746
!CodeGeneratorTool class methodsFor:'private'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   747
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   748
canUseRefactoringSupport
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   749
    "check if refactory browser stuff is avaliable"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   750
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   751
     ^ RefactoryChangeManager notNil 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   752
    and:[RefactoryChangeManager isLoaded
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   753
    and:[UserPreferences current useRefactoringSupport]]
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   754
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   755
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   756
methodNameTemplateFor:aSelector
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   757
    |numArgs method|
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   758
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   759
    numArgs := aSelector numArgs.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   760
    numArgs == 1 ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   761
        method := aSelector, 'anArgument'.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   762
    ] ifFalse:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   763
        numArgs == 0 ifTrue:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   764
            method := aSelector
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   765
        ] ifFalse:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   766
            method := ''.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   767
            aSelector keywords keysAndValuesDo:[:i :key|
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   768
                method := method, key, 'arg', i printString, ' '.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   769
            ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   770
        ]
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   771
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
   772
    ^ method
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   773
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   774
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   775
!CodeGeneratorTool class methodsFor:'utilities'!
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   776
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   777
missingRequiredProtocolFor:aClass
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   778
    "return the missing required protocol; 
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   779
     that is the set of selectors which send #subclassResponsibility in a superclass and 
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   780
     have no implementation in aClass or in any class between aClass and that superclass"
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   781
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   782
    |requiredSelectors implementedSelectors|
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   783
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   784
    requiredSelectors := IdentitySet new.
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   785
    implementedSelectors := IdentitySet withAll:(aClass methodDictionary keys).
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   786
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   787
    aClass allSuperclassesDo:[:eachSuperClass |
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   788
        eachSuperClass methodDictionary keysAndValuesDo:[:eachSelector :eachMethod |
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   789
            ((eachMethod sends:#subclassResponsibility) or:[eachMethod sends:#subclassResponsibility:]) ifTrue:[
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   790
                (implementedSelectors includes:eachSelector) ifFalse:[
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   791
                    requiredSelectors add:eachSelector.
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   792
                ]
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   793
            ] ifFalse:[
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   794
                (requiredSelectors includes:eachSelector) ifFalse:[
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   795
                    implementedSelectors add:eachSelector.
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   796
                ].
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   797
            ].
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   798
        ]
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   799
    ].
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   800
    ^ requiredSelectors
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   801
! !
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
   802
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   803
!CodeGeneratorTool methodsFor:'buld changes'!
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   804
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
   805
addChange:aChange
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
   806
    compositeChangeCollector addChange:aChange
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
   807
!
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
   808
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   809
executeCollectedChangesNamed:name
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   810
    compositeChangeCollector notNil ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   811
        compositeChangeNesting := compositeChangeNesting - 1.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   812
        compositeChangeNesting == 0 ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   813
            compositeChangeCollector name:name.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   814
            compositeChangeCollector changesSize == 0 ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   815
                self information:'Nothing generated.'.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   816
            ] ifFalse:[
7037
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
   817
                RefactoryChangeManager performChange:compositeChangeCollector.
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   818
            ].
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   819
            compositeChangeCollector := nil.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   820
        ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   821
    ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   822
!
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   823
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   824
startCollectChanges
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   825
    (self canUseRefactoringSupport) ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   826
        compositeChangeCollector isNil ifTrue:[
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   827
            compositeChangeCollector := CompositeRefactoryChange new.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   828
            compositeChangeNesting := 0.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   829
        ].
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   830
        compositeChangeNesting := compositeChangeNesting + 1.
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   831
    ]
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   832
! !
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
   833
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   834
!CodeGeneratorTool methodsFor:'code generation'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   835
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   836
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   837
    "create accessors in aClass"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   838
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   839
    self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   840
        createAccessMethodsFor:aCollectionOfVarNames 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   841
        in:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   842
        withChange:withChange 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   843
        asValueHolder:asValueHolder 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   844
        readersOnly:readersOnly 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   845
        writersOnly:writersOnly 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   846
        lazyInitialization:false
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   847
!
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
createApplicationCodeFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   850
    "create an empty application framework"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   851
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   852
    |nonMetaClass metaClass className txt isDialog 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   853
     categoryForMenuActionsMethods compileMenuAction compileTemplateAction|
5758
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
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   856
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
   857
    categoryForMenuActionsMethods := userPreferences categoryForMenuActionsMethods.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   858
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   859
    nonMetaClass := aClass theNonMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   860
    metaClass := aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   861
    className := nonMetaClass name.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   862
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   863
    isDialog := (nonMetaClass isSubclassOf:SimpleDialog).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   864
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   865
    "/ add a windowSpec method for an empty applicationWindow,
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   866
    "/ with a menuPanel.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   867
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   868
    (metaClass includesSelector:#windowSpec) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   869
        isDialog ifTrue:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   870
            txt := self class initialWindowSpecMethodSourceForDialogs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   871
        ] ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   872
            txt := self class initialWindowSpecMethodSourceForApplications.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   873
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   874
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   875
            compile:(txt bindWith:className)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   876
            forClass:metaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   877
            inCategory:'interface specs'.
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
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   880
    compileTemplateAction := 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   881
        [:selector :category |
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   882
            (nonMetaClass includesSelector:selector) ifFalse:[
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   883
                |codeTemplateSelector|
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   884
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   885
                codeTemplateSelector := ('codeFor_',(selector upTo:$:)) asSymbol.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   886
                txt := self perform:codeTemplateSelector.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   887
                self
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   888
                    compile:txt
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   889
                    forClass:nonMetaClass 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   890
                    inCategory:(category = '*' ifTrue:categoryForMenuActionsMethods ifFalse:category).
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   891
            ]
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   892
        ].
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   893
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   894
    #(
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   895
        #'postBuildWith:'   'initialization & release'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   896
        #'postOpenWith:'    'initialization & release'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   897
    ) pairWiseDo:compileTemplateAction.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   898
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   899
    isDialog ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   900
        "/ add a topMenu method 
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
        (metaClass includesSelector:#mainMenu) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   903
            txt := self class initialMenuSpecMethodSourceForApplications.
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:(txt bindWith:className)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   906
                forClass:metaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   907
                inCategory:'menu specs'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   908
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   909
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   910
        #(
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   911
            #'hasUnsavedChanges'        'private queries'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   912
            #'closeRequest'             'initialization & release'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   913
            #'closeDownViews'           'initialization & release'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   914
            #'menuSaveAs'               '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   915
            #'menuNew'                  '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   916
            #'menuOpen'                 '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   917
            #'menuSave'                 '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   918
            #'doSaveAs'                 '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   919
            #'openDocumentation'        '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   920
            #'openAboutThisApplication' '*'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   921
        ) pairWiseDo:compileTemplateAction.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   922
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   923
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   924
    isDialog ifTrue:[
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   925
        #(
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   926
            #'closeAccept'      'user actions'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   927
        ) pairWiseDo:compileTemplateAction.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   928
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   929
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   930
    self executeCollectedChangesNamed:('Add Application Code for ' , className).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   931
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
   932
    "Modified: / 27-10-2006 / 10:21:58 / cg"
5758
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
8987
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   935
createClassInitializeMethodIn:aClass
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   936
    "create a #initialize method on the class side (I'm tired of typing)"
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   937
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   938
    |nonMetaClass metaClass className code initializer bindings|
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   939
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   940
    nonMetaClass := aClass theNonMetaclass.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   941
    metaClass := aClass theMetaclass.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   942
    className := nonMetaClass name.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   943
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   944
    self startCollectChanges.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   945
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   946
    (metaClass includesSelector:#'initialize') ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   947
'initialize
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   948
    "Invoked at system start or when the class is dynamically loaded."
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   949
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   950
    "/ please change as required (and remove this comment)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   951
'.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   952
        bindings := Dictionary new.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   953
        bindings at:'INIT_CLASSINSTVARS' put:(
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   954
            String streamContents:[:s |
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   955
                metaClass instVarNames do:[:eachClassInstVar |
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   956
                    initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   957
                    s nextPutLine:('    "/ %1 := %2.' bindWith:eachClassInstVar with:initializer).
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   958
                ]
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   959
            ]).
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   960
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   961
        bindings at:'INIT_CLASSVARS' put:(
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   962
            String streamContents:[:s |
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   963
                nonMetaClass classVarNames do:[:eachClassVar |
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   964
                    initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   965
                    s nextPutLine:('    "/ %1 := %2.' bindWith:eachClassVar with:initializer).
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   966
                ]
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   967
            ]).
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   968
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   969
        code := (self codeFor_classInitialize) expandPlaceholdersWith:bindings.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   970
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   971
        self 
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   972
            compile:code
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   973
            forClass:metaClass 
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   974
            inCategory:'initialization'.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   975
    ].
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   976
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   977
    self executeCollectedChangesNamed:('Add Class Initializer to ' , className).
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   978
!
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
   979
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   980
createClassResponsibleProtocolFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   981
    "create stubs for the required protocol"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   982
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   983
    |nonMetaClass metaClass className|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   984
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   985
    nonMetaClass := aClass theNonMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   986
    metaClass := aClass theMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   987
    className := nonMetaClass name.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   988
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   989
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   990
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   991
    self privCreateClassResponsibleProtocolFor:nonMetaClass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   992
    self privCreateClassResponsibleProtocolFor:metaClass.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   993
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
   994
    self executeCollectedChangesNamed:('Add Required Protocol to ' , className).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   995
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   996
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   997
createClassTypeTestMethodsIn:aClass forClasses:subClasses
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   998
    "create a #isXXX test methods (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
   999
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1000
    | code|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1001
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1002
    self startCollectChanges.
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
    subClasses do:[:eachSubClass |
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1005
        |nm selector|
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
        nm := eachSubClass nameWithoutPrefix.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1008
        selector := 'is' , nm.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1009
        (aClass includesSelector:selector) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1010
            code := (selector , '\    ^ false') withCRs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1011
            self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1012
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1013
                forClass:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1014
                inCategory:'testing'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1015
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1016
        (eachSubClass includesSelector:selector) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1017
            code := (selector , '\    ^ true') withCRs.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1018
            self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1019
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1020
                forClass:eachSubClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1021
                inCategory:'testing'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1022
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1023
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1024
5759
b6cea74440db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5758
diff changeset
  1025
    self executeCollectedChangesNamed:'Add ClassType Tests'
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1026
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1027
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1028
createDocumentationMethodsFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1029
    "create empty documentation methods"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1030
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1031
    |nonMetaClass metaClass className|
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1032
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1033
    nonMetaClass := aClass theNonMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1034
    metaClass := aClass theMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1035
    className := nonMetaClass name.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1036
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1037
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1038
8890
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  1039
"/    self createVersionMethodFor:metaClass.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1040
    self createCopyrightMethodFor:metaClass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1041
    self createDocumentationMethodFor:metaClass.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1042
    self createExamplesMethodFor:metaClass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1043
    "/ self createInitialHistoryMethodFor:metaClass.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1044
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1045
    self executeCollectedChangesNamed:('Add Documentation to ' , className).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1046
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1047
6313
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1048
createEnumTypeCodeFor:aClass
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1049
    |nonMetaClass metaClass className enumValues code initCode runValue maxValue|
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1050
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1051
    self startCollectChanges.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1052
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1053
    nonMetaClass := aClass theNonMetaclass.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1054
    metaClass := aClass theMetaclass.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1055
    className := nonMetaClass name.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1056
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1057
    enumValues := nonMetaClass classVarNames.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1058
    enumValues do:[:eachVariableName |
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1059
        self 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1060
            createAccessMethodsFor:(Array with:eachVariableName)
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1061
            in:metaClass  
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1062
            withChange:false
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1063
            asValueHolder:false
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1064
            readersOnly:true    
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1065
            writersOnly:false
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1066
    ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1067
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1068
    maxValue := enumValues 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1069
                    inject:0 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1070
                    into:[:maxSoFar :eachVariableName | 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1071
                            |oldVal val| 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1072
                            oldVal := nonMetaClass classVarAt:eachVariableName.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1073
                            oldVal notNil ifTrue:[ val := oldVal numericValue ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1074
                            (val ? maxSoFar) max:maxSoFar
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1075
                         ].
6313
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1076
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1077
    initCode := WriteStream on: String new.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1078
    initCode nextPutLine:'initialize'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1079
    runValue := maxValue + 1.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1080
    enumValues keysAndValuesDo:[:idx :eachVariableName |
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1081
        |oldValue thisValue|
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1082
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1083
        oldValue := nonMetaClass classVarAt:eachVariableName.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1084
        oldValue notNil ifTrue:[
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1085
            thisValue := oldValue numericValue.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1086
        ] ifFalse:[
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1087
            thisValue := runValue.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1088
            runValue := runValue + 1.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1089
        ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1090
        initCode 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1091
            nextPutAll:'    ';
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1092
            nextPutAll:eachVariableName;
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1093
            nextPutAll:' := self basicNew'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1094
        (aClass canUnderstand:#'setNumericValue:') ifTrue:[
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1095
            initCode nextPutAll:' setNumericValue: ',thisValue printString.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1096
        ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1097
        (aClass canUnderstand:#'setCssClassString:') ifTrue:[
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1098
            initCode nextPutAll:('; setCssClassString: ''' , nonMetaClass nameWithoutPrefix asLowercaseFirst , eachVariableName , '''').
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1099
        ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1100
        (aClass canUnderstand:#'setName:') ifTrue:[
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1101
            initCode nextPutAll:('; setName: ''' , eachVariableName asLowercaseFirst , '''').
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1102
        ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1103
        initCode nextPutLine:'.'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1104
    ].
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1105
    initCode cr.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1106
    initCode nextPutLine:'    "'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1107
    initCode nextPutLine:'     ',className, ' initialize'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1108
    initCode nextPutLine:'    "'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1109
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1110
    self
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1111
        compile:(initCode contents)
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1112
        forClass:metaClass 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1113
        inCategory:'class initialization'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1114
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1115
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1116
    code := 'allStateNames\    ^ #( ' ,
6341
200c762ce0ed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6313
diff changeset
  1117
                ((enumValues collect:[:each | '#''',each asLowercaseFirst,'''']) asStringWith:' ') , ')',
6313
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1118
                '\\    "\' ,
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1119
                '     ',className, ' allStateNames\' ,
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1120
                '    "\'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1121
    self
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1122
        compile:code withCRs
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1123
        forClass:metaClass 
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1124
        inCategory:'queries'.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1125
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1126
    self executeCollectedChangesNamed:('Generate EnumType Code for ' , className).
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1127
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1128
    aClass initialize.
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1129
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1130
    "Modified: / 1.2.1998 / 16:10:03 / cg"
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1131
!
e73b5d2d07f9 enumType generator
Claus Gittinger <cg@exept.de>
parents: 6159
diff changeset
  1132
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1133
createExamplesMethodForViewClass:aClass
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1134
    "create an examples method"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1135
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1136
    |nonMetaClass metaClass className code|
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1137
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1138
    nonMetaClass := aClass theNonMetaclass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1139
    metaClass := aClass theMetaclass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1140
    className := nonMetaClass name.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1141
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1142
    self startCollectChanges.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1143
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1144
    (metaClass includesSelector:#examples) ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1145
        code := 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1146
'examples
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1147
"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1148
 Notice that everything between [exBegin] and [exEnd] is extracted by the html-doc generator
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1149
 to create nicely formatted and clickable executable examples in the generated html-doc.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1150
 (see the browsers class-documentation menu items for more)
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1151
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1152
 trying the widget as standAlone view:
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1153
                                                        [exBegin]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1154
    %1 new open
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1155
                                                        [exEnd]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1156
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1157
 embedded in another view:
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1158
                                                        [exBegin]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1159
    |top v|
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1160
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1161
    top := StandardSystemView new.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1162
    top extent:300@300.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1163
    v := %1 new.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1164
    v origin:10@10 corner:150@150.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1165
    top add:v.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1166
    top open
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1167
                                                        [exEnd]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1168
"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1169
' bindWith:className.    
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1170
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1171
        self 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1172
            compile:code
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1173
            forClass:metaClass 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1174
            inCategory:'documentation'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1175
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1176
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1177
    self executeCollectedChangesNamed:('Add Example to ' , className).
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1178
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1179
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1180
createInitializedInstanceCreationMethodsIn:aClass
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1181
    "create a #new and #initialize methods (I'm tired of typing)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1182
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1183
    |nonMetaClass metaClass className code initializer m|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1184
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1185
    nonMetaClass := aClass theNonMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1186
    metaClass := aClass theMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1187
    className := nonMetaClass name.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1188
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1189
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1190
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1191
    (nonMetaClass includesSelector:#'initialize') ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1192
        code :=
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1193
'initialize
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1194
    "Invoked when a new instance is created."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1195
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1196
    "/ please change as required (and remove this comment)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1197
'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1198
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1199
        nonMetaClass instVarNames do:[:eachInstVar |
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1200
            initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1201
            code := code , ('    "/ ' , eachInstVar , ' := ' , initializer , '.' , Character cr).
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1202
        ].
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1203
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1204
        m := nonMetaClass responseTo:#initialize.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1205
        (m notNil and:[m messagesSent size == 0]) ifTrue:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1206
            "/ inherits an empty initialize.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1207
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1208
            code := code , '
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1209
    "/ super initialize.   -- commented since inherited method does nothing
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1210
'.
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1211
        ] ifFalse:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1212
            code := code , '
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1213
    super initialize.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1214
'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1215
        ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1216
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1217
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1218
            compile:code
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1219
            forClass:nonMetaClass 
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1220
            inCategory:'initialization'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1221
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1222
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1223
    (metaClass includesSelector:#'new') ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1224
        m := metaClass responseTo:#new.
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1225
        (m isNil 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1226
        or:[ (m sends:#initialize) not 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1227
        or:[ |answer|
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1228
            (Dialog 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1229
                confirmWithCancel:'The inherited #new method already seems to invoke #initialize. Redefine ?'
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1230
                onCancel:[^ self]) ]]) ifTrue:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1231
            code :=
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1232
'new
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1233
    ^ self basicNew initialize.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1234
'.
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1235
            self 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1236
                compile:code
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1237
                forClass:metaClass 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1238
                inCategory:'instance creation'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1239
        ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1240
    ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1241
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1242
    self executeCollectedChangesNamed:('Add Initialized Instance Creation to ' , className).
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1243
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1244
    "Created: / 11.10.2001 / 22:18:55 / cg"
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1245
!
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1246
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1247
createParametrizedInstanceCreationMethodsNamed:selector in:aClass
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1248
    "create a #selector instance creation method (I'm tired of typing)"
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1249
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1250
    |nonMetaClass metaClass className code initializer m dfn|
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1251
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1252
    dfn := Method methodDefinitionTemplateForSelector:selector.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1253
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1254
    nonMetaClass := aClass theNonMetaclass.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1255
    metaClass := aClass theMetaclass.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1256
    className := nonMetaClass name.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1257
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1258
    self startCollectChanges.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1259
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1260
    (nonMetaClass includesSelector:selector asSymbol) ifFalse:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1261
        code :=
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1262
'initialize',dfn asUppercaseFirst,'
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1263
    "Invoked when a new instance is created for arg."
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1264
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1265
    "/ please change as required (and remove these comments)
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1266
    "/ do something with arg here (instVar-foo := arg)
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1267
'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1268
        nonMetaClass instVarNames do:[:eachInstVar |
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1269
            initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1270
            code := code , ('    "/ ' , eachInstVar , ' := ' , initializer , '.' , Character cr).
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1271
        ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1272
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1273
        m := nonMetaClass responseTo:#initialize.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1274
        (m notNil and:[ m messagesSent size == 0 ]) ifTrue:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1275
            "/ inherits an empty initialize.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1276
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1277
            code := code , '
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1278
    "/ super initialize.   -- commented since inherited method does nothing
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1279
'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1280
        ] ifFalse:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1281
            code := code , '
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1282
    super initialize.  
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1283
'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1284
        ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1285
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1286
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1287
            compile:code
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1288
            forClass:nonMetaClass 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1289
            inCategory:'initialization'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1290
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1291
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1292
    (metaClass includesSelector:selector) ifFalse:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1293
        m := metaClass responseTo:selector.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1294
        (m isNil 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1295
        or:[ (Dialog confirmWithCancel:'The ',selector,'- method is already inherited. Redefine ?' onCancel:[^ self]) ])
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1296
        ifTrue:[
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1297
            code :=
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1298
dfn,'
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1299
    "Create & return a new instance for arg."
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1300
6718
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1301
    ^ self basicNew initialize',dfn asUppercaseFirst,'
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1302
'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1303
            self 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1304
                compile:code
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1305
                forClass:metaClass 
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1306
                inCategory:'instance creation'.
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1307
        ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1308
    ].
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1309
d6e9cae51834 more generators;
Claus Gittinger <cg@exept.de>
parents: 6643
diff changeset
  1310
    self executeCollectedChangesNamed:('Add Parametrized Instance Creation to ' , className).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1311
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1312
7470
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1313
createPoolInitializationCodeFor:aClass
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1314
    |nonMetaClass metaClass className poolVars code initCode runValue maxValue|
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1315
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1316
    self startCollectChanges.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1317
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1318
    nonMetaClass := aClass theNonMetaclass.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1319
    metaClass := aClass theMetaclass.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1320
    className := nonMetaClass name.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1321
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1322
    poolVars := nonMetaClass classVarNames.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1323
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1324
    initCode := WriteStream on: String new.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1325
    initCode nextPutLine:'initialize'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1326
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1327
    poolVars do:[:eachVariableName |
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1328
        |oldValue thisValue|
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1329
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1330
        oldValue := nonMetaClass classVarAt:eachVariableName.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1331
        oldValue notNil ifTrue:[
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1332
            thisValue := oldValue.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1333
        ] ifFalse:[
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1334
            thisValue := nil.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1335
        ].
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1336
        initCode 
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1337
            nextPutAll:'    ';
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1338
            nextPutAll:eachVariableName;
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1339
            nextPutAll:' := ';
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1340
            nextPutAll:thisValue storeString;
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1341
            nextPutLine:'.'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1342
    ].
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1343
    initCode cr.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1344
    initCode nextPutLine:'    "'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1345
    initCode nextPutLine:'     ',className, ' initialize'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1346
    initCode nextPutLine:'    "'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1347
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1348
    self
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1349
        compile:(initCode contents)
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1350
        forClass:metaClass 
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1351
        inCategory:'class initialization'.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1352
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1353
    self executeCollectedChangesNamed:('Generate Pool Initialization Code for ' , className).
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1354
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1355
    aClass initialize.
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1356
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1357
    "Created: / 25-10-2006 / 09:28:40 / cg"
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1358
!
12c6eb575d88 pool code generation
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  1359
8344
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1360
createRedefinedInstanceCreationMethodsIn:aClass
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1361
    "create a redefined #new methods"
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1362
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1363
    |nonMetaClass metaClass className code|
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1364
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1365
    nonMetaClass := aClass theNonMetaclass.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1366
    metaClass := aClass theMetaclass.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1367
    className := nonMetaClass name.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1368
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1369
    self startCollectChanges.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1370
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1371
    (metaClass includesSelector:#'new') ifFalse:[
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1372
        code :=
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1373
'new
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1374
    ^ super new.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1375
'.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1376
        self 
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1377
            compile:code
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1378
            forClass:metaClass 
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1379
            inCategory:'redefined instance creation'.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1380
    ].
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1381
    (metaClass includesSelector:#'new:') ifFalse:[
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1382
        code :=
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1383
'new:n
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1384
    ^ super new:n.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1385
'.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1386
        self 
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1387
            compile:code
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1388
            forClass:metaClass 
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1389
            inCategory:'redefined instance creation'.
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1390
    ].
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1391
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1392
    self executeCollectedChangesNamed:('Redefined Instance Creation to ' , className).
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1393
!
efda36a55d02 changed #createRedefinedInstanceCreationMethodsIn:
Claus Gittinger <cg@exept.de>
parents: 8258
diff changeset
  1394
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1395
createStandardPrintOnMethodIn:aClass
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1396
    "create a #printOn: method (I'm tired of typing)"
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1397
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1398
    |code nonMetaClass|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1399
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1400
    nonMetaClass := aClass theNonMetaclass.
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1401
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1402
    self startCollectChanges.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1403
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1404
    (nonMetaClass includesSelector:#'printOn:') ifFalse:[
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1405
        code :=
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1406
'printOn:aStream
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1407
    "append a printed representation if the receiver to the argument, aStream"
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1408
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1409
    super printOn:aStream.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1410
'.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1411
        nonMetaClass instVarNames do:[:eachInstVarName |
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1412
            code := code , '    '.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1413
            code := code , 'aStream nextPutAll:'''.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1414
            code := code , eachInstVarName.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1415
            code := code , ': ''.' , Character cr.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1416
            code := code , '    '.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1417
            code := code , eachInstVarName.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1418
            code := code , ' printOn:aStream.' , Character cr.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1419
        
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1420
        ].
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1421
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1422
        self 
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1423
            compile:code
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1424
            forClass:nonMetaClass 
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1425
            inCategory:'printing & storing'.
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1426
    ].
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1427
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1428
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1429
    self executeCollectedChangesNamed:('Add #printOn: to ' , nonMetaClass name).
5953
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1430
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1431
    "Created: / 11.10.2001 / 22:18:55 / cg"
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1432
!
bf6cdc968a53 *** empty log message ***
ca
parents: 5817
diff changeset
  1433
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1434
createStartupCodeFor:aClass forStartOf:anApplicationClassOrNil
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1435
    "create startup code (main)"
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1436
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1437
    |nonMetaClass metaClass className source 
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1438
     hasAplicationClass anApplicationClassNameOrStartupClassName|
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1439
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1440
    self startCollectChanges.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1441
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1442
    hasAplicationClass := anApplicationClassOrNil notNil.
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1443
    nonMetaClass := aClass theNonMetaclass.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1444
    metaClass := aClass theMetaclass.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1445
    className := nonMetaClass name.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1446
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1447
    (metaClass includesSelector:#main:) ifFalse:[
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1448
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1449
        source := String streamContents:[:stream |
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1450
            stream nextPutAll: 
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1451
'main:argv
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1452
    self verboseInfo:''starting %1''.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1453
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1454
'.
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1455
            hasAplicationClass ifTrue: [
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1456
                stream nextPutAll: 
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1457
'    %1 open.
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1458
'.
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1459
            ].
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1460
        ].
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1461
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1462
        anApplicationClassNameOrStartupClassName := hasAplicationClass 
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1463
            ifTrue: [anApplicationClassOrNil name]
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1464
            ifFalse: [className.].
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1465
        self
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  1466
            compile:(source bindWith:anApplicationClassNameOrStartupClassName)
9049
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1467
            forClass:metaClass 
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1468
            inCategory:'startup'.
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1469
    ].
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1470
    self executeCollectedChangesNamed:('Add Startup Code to ' , className).
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1471
!
9a2003a4fef3 added: #createStartupCodeFor:forStartOf:
Claus Gittinger <cg@exept.de>
parents: 9044
diff changeset
  1472
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1473
createTestCaseSampleCodeFor:aClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1474
    "create an (almost) empty testCase class"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1475
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1476
    |nonMetaClass metaClass|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1477
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1478
    nonMetaClass := aClass theNonMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1479
    metaClass := aClass theMetaclass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1480
    "/ className := nonMetaClass name.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1481
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1482
    ( nonMetaClass includesSelector:#test1 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1483
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1484
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1485
'test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1486
    "This is a demonstration testCase - it is meant to be removed eventually.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1487
     This testCase will PASS.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1488
     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
  1489
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1490
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1491
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1492
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1493
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1494
    self assert: ( o size == 2 ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1495
    self should: [ o at:0 ] raise:Error.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1496
    self shouldnt: [ o at:1 ] raise:Error.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1497
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1498
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1499
     self run:#test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1500
     self new test1
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1501
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1502
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1503
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1504
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1505
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1506
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1507
    ( nonMetaClass includesSelector:#test2 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1508
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1509
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1510
'test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1511
    "This is a demonstration testCase - it is meant to be removed eventually..
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1512
     This testCase WILL FAIL.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1513
     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
  1514
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1515
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1516
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1517
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1518
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1519
    self assert: ( o size == 3 ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1520
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1521
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1522
     self run:#test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1523
     self new test2
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1524
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1525
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1526
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1527
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1528
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1529
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1530
    ( nonMetaClass includesSelector:#test3 ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1531
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1532
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1533
'test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1534
    "This is a demonstration testCase - it is meant to be removed eventually..
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1535
     This testCase WILL generate an ERROR.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1536
     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
  1537
     - please add more methods like this..."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1538
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1539
    |o|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1540
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1541
    o := Array new:2.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1542
    self assert: ( o foo ).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1543
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1544
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1545
     self run:#test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1546
     self new test3
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1547
    "
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1548
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1549
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1550
            inCategory:'tests'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1551
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1552
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1553
    ( nonMetaClass includesSelector:#setUp ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1554
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1555
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1556
'setUp
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1557
    "common setup - invoked before testing."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1558
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1559
    super setUp
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1560
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1561
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1562
            inCategory:'initialize / release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1563
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1564
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1565
    ( nonMetaClass includesSelector:#tearDown ) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1566
        self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1567
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1568
'tearDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1569
    "common cleanup - invoked after testing."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1570
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1571
    super tearDown
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1572
'
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1573
            forClass:nonMetaClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1574
            inCategory:'initialize / release'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1575
    ]
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1576
!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1577
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1578
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1579
    "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
  1580
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1581
    |sel|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1582
6921
821413de0099 leftover halt.
Claus Gittinger <cg@exept.de>
parents: 6839
diff changeset
  1583
    self assert:( visitedClass isMeta not ).
821413de0099 leftover halt.
Claus Gittinger <cg@exept.de>
parents: 6839
diff changeset
  1584
    self assert:( visitorClass isMeta not ).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1585
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1586
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1587
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1588
    sel := ('visit' , visitedClass nameWithoutPrefix , ':').
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1589
    self createAcceptVisitorMethod:sel in:visitedClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1590
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1591
    (visitorClass includesSelector:sel) ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1592
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1593
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1594
(('%1anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1595
    "dispatched back from the visited %2-object (visitor pattern)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1596
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1597
    "fall back to general object-case - please change as required"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1598
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1599
    ^ self visitObject:anObject
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1600
') bindWith:sel with:visitedClass nameWithoutPrefix asLowercaseFirst)
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1601
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1602
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1603
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1604
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1605
    (visitorClass includesSelector:#'visitObject:') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1606
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1607
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1608
('visitObject:anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1609
    "dispatched back from the visited objects (visitor pattern)"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1610
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1611
    "general fallBack - please change as required"
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1612
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1613
    self halt:''not yet implemented''
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1614
')
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1615
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1616
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1617
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1618
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1619
    (visitorClass includesSelector:#'visit:') ifFalse:[
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1620
        self 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1621
            compile:
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1622
('visit:anObject 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1623
    "visit anObject (visitor pattern).
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1624
     The object should call back one of my visitXXXX methods."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1625
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1626
    ^ anObject acceptVisitor:self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1627
')
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1628
            forClass:visitorClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1629
            inCategory:'visiting'.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1630
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1631
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1632
    self executeCollectedChangesNamed:('Add Visitor Pattern').
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1633
!
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1634
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1635
createWebApplicationCodeFor:aClass
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1636
    "create an empty webApplication framework"
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1637
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1638
    |nonMetaClass metaClass className txt|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1639
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1640
    self startCollectChanges.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1641
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1642
    nonMetaClass := aClass theNonMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1643
    metaClass := aClass theMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1644
    className := nonMetaClass name.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1645
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1646
    (metaClass includesSelector:#pageSpec) ifFalse:[
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1647
        txt := self class initialPageSpecMethodSourceForWebApplications.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1648
        self
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1649
            compile:(txt bindWith:className)
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1650
            forClass:metaClass 
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1651
            inCategory:'page specs'.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1652
    ].
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1653
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1654
    self executeCollectedChangesNamed:('Add WebApplication Code for ' , className).
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1655
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1656
    "Modified: / 1.2.1998 / 16:10:03 / cg"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1657
!
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1658
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1659
createWebServiceCodeFor:aClass
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1660
    "create an empty webService framework"
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1661
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1662
    |nonMetaClass metaClass className txt|
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1663
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1664
    self startCollectChanges.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1665
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1666
    nonMetaClass := aClass theNonMetaclass.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1667
    metaClass := aClass theMetaclass.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1668
    className := nonMetaClass name.
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1669
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1670
    (nonMetaClass includesSelector:#process:) ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1671
        txt :=
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1672
'process:aRequest
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1673
    "This is the web services main processing method.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1674
     It will be invoked for every incoming webBrowser-request.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1675
     The argument, aRequest contains the parameters (url, fields, parameters etc.)."
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1676
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1677
    |response|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1678
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1679
    response := aRequest response.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1680
    response nextPutLine:''<HTML>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1681
    response nextPutLine:''  <HEAD>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1682
    response nextPutLine:''  <TITLE>Hello</TITLE>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1683
    response nextPutLine:''  </HEAD>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1684
    response nextPutLine:''  <BODY>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1685
    response nextPutLine:''    <H1>Hello World !!</H1>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1686
    response nextPutLine:''  </BODY>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1687
    response nextPutLine:''</HTML>''.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1688
'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1689
        self
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1690
            compile:txt
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1691
            forClass:nonMetaClass 
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1692
            inCategory:'response generation'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1693
    ].
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1694
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1695
    (metaClass includesSelector:#linkName) ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1696
        txt :=
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1697
'linkName
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1698
    "return the default linkName path (with slash)."
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1699
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1700
    ^ ''/NewService''
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1701
'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1702
        self
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1703
            compile:txt
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1704
            forClass:metaClass 
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1705
            inCategory:'defaults'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1706
    ].
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1707
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1708
    (metaClass includesSelector:#settingsApplicationClass) ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1709
        txt :=
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1710
'settingsApplicationClass
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1711
    "a SettingsApplication class - or nil (used in the settings dialog if non-nil)."
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1712
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1713
    ^ nil
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1714
'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1715
        self
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1716
            compile:txt
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1717
            forClass:metaClass 
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1718
            inCategory:'defaults'.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1719
    ].
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1720
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1721
7973
7fb67608aa3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7967
diff changeset
  1722
    self executeCollectedChangesNamed:('Add WebService Code for ' , className).
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1723
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  1724
    "Modified: / 1.2.1998 / 16:10:03 / cg"
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1725
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1726
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1727
createWidgetCodeFor:aClass
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1728
    "create usually required widget code (redraw, model update, event handling)"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1729
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1730
    |nonMetaClass metaClass className compileTemplateAction|
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1731
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1732
    self startCollectChanges.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1733
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1734
    nonMetaClass := aClass theNonMetaclass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1735
    metaClass := aClass theMetaclass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1736
    className := nonMetaClass name.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1737
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1738
    compileTemplateAction := 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1739
        [:selector :templateSelector :category |
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1740
            (nonMetaClass includesSelector:selector) ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1741
                |txt|
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1742
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1743
                txt := self perform:templateSelector.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1744
                self
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1745
                    compile:txt
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1746
                    forClass:nonMetaClass 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1747
                    inCategory:category.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1748
            ]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1749
        ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1750
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1751
    #(
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1752
        #'initialize'               #code_forWidget_initialize  'initialization & release'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1753
        #'update:with:from:'        #code_forWidget_update      'change & update'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1754
        #'redrawX:y:width:height:'  #code_forWidget_redraw      'drawing'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1755
        #'buttonPress:x:y:'         #code_forWidget_buttonPress 'event handling'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1756
        #'keyPress:x:y:'            #code_forWidget_keyPress    'event handling'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1757
        #'sizeChanged:'             #code_forWidget_sizeChanged 'event handling'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1758
    ) inGroupsOf:3 do:compileTemplateAction.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1759
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1760
    self executeCollectedChangesNamed:('Add Widget Code for ' , className).
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1761
! !
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1762
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1763
!CodeGeneratorTool methodsFor:'code generation-basic'!
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1764
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1765
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
  1766
    "workhorse for creating access methods for instvars."
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1767
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1768
    |classesClassVars generateCommentsForSetters generateCommentsForGetters|
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1769
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1770
    self startCollectChanges.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1771
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1772
    generateCommentsForSetters := userPreferences generateCommentsForSetters.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1773
    generateCommentsForGetters := userPreferences generateCommentsForGetters.
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1774
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1775
    classesClassVars := aClass theNonMetaclass allClassVarNames.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1776
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1777
    aCollectionOfVarNames do:[:name |
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1778
        |source varType methodName defaultMethodName argName|
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1779
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1780
        varType := (classesClassVars includes:name) 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1781
                        ifTrue:['static'] 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1782
                        ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1783
                            (aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1784
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1785
        methodName := name.
6643
abd4749a00ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6350
diff changeset
  1786
        name isUppercaseFirst ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1787
            methodName := methodName asLowercaseFirst. 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1788
        ].
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1789
        argName := 'something'.
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1790
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1791
        "/ the GETTER
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1792
        writersOnly ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1793
            lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1794
                defaultMethodName := 'default' , name asUppercaseFirst.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1795
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1796
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1797
            "check, if method is not already present"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1798
            (aClass includesSelector:(methodName asSymbol)) ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1799
                asValueHolder ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1800
                    source := methodName , '\'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1801
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1802
                        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
  1803
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1804
                    source := source , '    %2 isNil ifTrue:[\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1805
                    lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1806
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1807
                                   , '        %2 := self class %3 asValue.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1808
                    ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1809
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1810
                                   , '        %2 := ValueHolder new.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1811
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1812
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1813
                    withChange ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1814
                    source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1815
                               , '        %2 addDependent:self.\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1816
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1817
                    source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1818
                               , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1819
                               , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1820
                ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1821
                    source := methodName , '\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1822
                    lazyInitialization ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1823
                        generateCommentsForGetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1824
                            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
  1825
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1826
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1827
                                    , '    %2 isNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1828
                                    , '        %2 := self class %3.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1829
                                    , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1830
                                    , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1831
                    ] ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1832
                        generateCommentsForGetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1833
                            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
  1834
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1835
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1836
                                    , '    ^ %2'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1837
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1838
                ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1839
                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
  1840
                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
  1841
            ] ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1842
                Transcript showCR:'method ''', methodName , ''' already present'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1843
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1844
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1845
            "/ default for lazy on class side
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1846
            lazyInitialization ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1847
                (aClass class includesSelector:(defaultMethodName asSymbol)) ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1848
                    source := defaultMethodName , '\'.
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1849
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1850
                        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
  1851
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1852
                    source := source    
6839
c25218305e50 Send #shouldImplement instead of #halt:.
Stefan Vogel <sv@exept.de>
parents: 6791
diff changeset
  1853
                               , '    self shouldImplement.\'
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1854
                               , '    ^ nil.'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1855
                    source := (source bindWith:varType with:name) withCRs.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1856
                    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
  1857
                ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1858
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1859
        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1860
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1861
        "/ the SETTER
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1862
        readersOnly ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1863
            (aClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1864
                ((methodName size > 2) and:[ (methodName startsWith:'is') and:[ (methodName at:3) isUppercase ]])
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1865
                ifTrue:[
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1866
                    argName := 'aBoolean'
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1867
                ].
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1868
                asValueHolder ifTrue:[
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1869
                    source := methodName , ':%3\'.  "/ argName
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1870
                    generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1871
                        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
  1872
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1873
                    withChange ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1874
                        source := source
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1875
                                  , '    |oldValue newValue|\\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1876
                                  , '    %2 notNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1877
                                  , '        oldValue := %2 value.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1878
                                  , '        %2 removeDependent:self.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1879
                                  , '    ].\'
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1880
                                  , '    %2 := %3.\'        "/ argName
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1881
                                  , '    %2 notNil ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1882
                                  , '        %2 addDependent:self.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1883
                                  , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1884
                                  , '    newValue := %2 value.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1885
                                  , '    oldValue ~~ newValue ifTrue:[\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1886
                                  , '        self update:#value with:newValue from:%2.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1887
                                  , '    ].\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1888
                    ] ifFalse:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1889
                        source := source 
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1890
                                  , '    %2 := %3.'.  "/ argName
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1891
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1892
                ] ifFalse:[
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1893
                    source := methodName , ':%3\'.    "/ argName
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1894
                    withChange ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1895
                        generateComments ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1896
                            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
  1897
                            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
  1898
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1899
                        source := source
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1900
                                  , '    (%2 ~~ %3) ifTrue:[\'
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1901
                                  , '        %2 := %3.\'           "/ argName
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1902
                                  , '        self changed:#%2.\'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1903
                                  , '     ].\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1904
                    ] ifFalse:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1905
                        generateCommentsForSetters ifTrue:[
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1906
                            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
  1907
                            source := source , ' (automatically generated)"\\'.
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1908
                        ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1909
                        source := source
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1910
                                  , '    %2 := %3.'.          "/ argName
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1911
                    ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1912
                ].
8773
a722c4bb21a7 changed: #createAccessMethodsFor:in:withChange:asValueHolder:readersOnly:writersOnly:lazyInitialization:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  1913
                source := (source bindWith:varType with:name with:argName) withCRs.
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1914
                self 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1915
                    compile:source 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1916
                    forClass:aClass 
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1917
                    inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1918
            ] ifTrue:[
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1919
                Transcript showCR:'method ''', methodName , ':'' already present'
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1920
            ].
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  1921
        ].
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1922
    ].
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1923
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  1924
    self executeCollectedChangesNamed:('Add Accessors').
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  1925
!
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  1926
7615
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1927
createCollectionAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  1928
    |classesClassVars|
7615
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1929
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1930
    self startCollectChanges.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1931
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1932
    classesClassVars := aClass theNonMetaclass allClassVarNames.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1933
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1934
    aCollectionOfVarNames do:[:name |
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1935
        |source varType methodNameBase methodName defaultMethodName|
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1936
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1937
        varType := (classesClassVars includes:name) 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1938
                        ifTrue:['static'] 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1939
                        ifFalse:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1940
                            (aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1941
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1942
        methodNameBase := name asUppercaseFirst.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1943
        (methodNameBase endsWith:'s') ifTrue:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1944
            methodNameBase := methodNameBase copyWithoutLast:1.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1945
        ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1946
        methodName := 'add' , methodNameBase, ':'. 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1947
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1948
        "check, if method is not already present"
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1949
        (aClass includesSelector:(methodName asSymbol)) ifFalse:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1950
            source := methodName , 'a%1\'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1951
            generateComments ifTrue:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1952
                source := source , '    "add a ',methodNameBase,'"\\'. 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1953
            ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1954
            source := source , '    %2 isNil ifTrue:[\'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1955
                source := source
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1956
                           , '        %2 := OrderedCollection new.\'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1957
            source := source
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1958
                       , '    ].\'
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1959
                       , '    %2 add: a%1'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1960
            source := (source bindWith:methodNameBase with:name) withCRs.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1961
            self compile:source forClass:aClass inCategory:'accessing'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1962
        ] ifTrue:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1963
            Transcript showCR:'method ''', methodName , ''' already present'
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1964
        ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1965
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1966
        methodName := 'remove' , methodNameBase, ':'. 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1967
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1968
        "check, if method is not already present"
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1969
        (aClass includesSelector:(methodName asSymbol)) ifFalse:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1970
            source := methodName , 'a%1\'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1971
            generateComments ifTrue:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1972
                source := source , '    "remove a ',methodNameBase,'"\\'. 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1973
            ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1974
            source := source
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1975
                       , '    %2 remove: a%1'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1976
            source := (source bindWith:methodNameBase with:name) withCRs.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1977
            self compile:source forClass:aClass inCategory:'accessing'.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1978
        ] ifTrue:[
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1979
            Transcript showCR:'method ''', methodName , ''' already present'
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1980
        ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1981
    ].
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1982
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1983
    self
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1984
        createAccessMethodsFor:aCollectionOfVarNames 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1985
        in:aClass 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1986
        withChange:withChange 
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1987
        asValueHolder:false
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1988
        readersOnly:true
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1989
        writersOnly:false
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1990
        lazyInitialization:false.
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1991
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1992
    self executeCollectedChangesNamed:('Add Collection Access').
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1993
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1994
    "Created: / 04-02-2007 / 15:52:31 / cg"
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1995
!
d059ea04b8f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7545
diff changeset
  1996
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  1997
createValueHoldersFor:aCollectionOfVarNames in:aClass lazyInitialization:lazyInitialization
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  1998
    "workhorse for creating access methods for instvars."
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  1999
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2000
    |nonMetaClass metaClass classesClassVars generateCommentsForSetters generateCommentsForGetters|
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2001
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2002
    nonMetaClass := aClass theNonMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2003
    metaClass := aClass theMetaclass.
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2004
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2005
    self startCollectChanges.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2006
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2007
    generateCommentsForSetters := userPreferences generateCommentsForSetters.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2008
    generateCommentsForGetters := userPreferences generateCommentsForGetters.
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2009
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2010
    classesClassVars := nonMetaClass allClassVarNames.
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2011
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2012
    aCollectionOfVarNames do:[:name |
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2013
        |source varType methodName holderMethodName defaultMethodName|
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2014
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2015
        holderMethodName := name.
6643
abd4749a00ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6350
diff changeset
  2016
        name isUppercaseFirst ifTrue:[
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2017
            holderMethodName := holderMethodName asLowercaseFirst. 
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2018
        ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2019
        (holderMethodName endsWith:'Holder') ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2020
            methodName := holderMethodName copyWithoutLast:6.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2021
        ] ifFalse:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2022
            methodName := holderMethodName.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2023
            holderMethodName := methodName , 'Holder'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2024
        ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2025
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2026
        methodName notNil ifTrue:[
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2027
            (metaClass includesSelector:(methodName asSymbol)) ifFalse:[
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2028
                source := '%1\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2029
                generateComments ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2030
                    source := source , '    "return the value in ''%2''"\\'. 
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2031
                ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2032
                source := source , '    ^ self %2 value'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2033
                source := (source bindWith:methodName with:holderMethodName) withCRs.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2034
                self compile:source forClass:nonMetaClass inCategory:('accessing').
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2035
            ] ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2036
                Transcript showCR:'method ''', methodName , ''' already present'
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2037
            ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2038
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2039
            (metaClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2040
                source := '%1: newValue\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2041
                generateComments ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2042
                    source := source , '    "set the value in ''%2''"\\'. 
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2043
                ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2044
                source := source , '    self %2 value: newValue'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2045
                source := (source bindWith:methodName with:holderMethodName) withCRs.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2046
                self compile:source forClass:nonMetaClass inCategory:('accessing').
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2047
            ] ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2048
                Transcript showCR:'method ''', methodName , ':'' already present'
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2049
            ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2050
        ].
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2051
        (metaClass includesSelector:(holderMethodName asSymbol)) ifFalse:[
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2052
            source := '%1\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2053
            generateComments ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2054
                source := source , '    "return/create the valueHolder ''%1''"\\'. 
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2055
            ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2056
            source := source , '    %1 isNil ifTrue:[\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2057
            source := source , '        %1 := ValueHolder with:nil "defaultValue here".\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2058
            source := source , '    ].\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2059
            source := source , '    ^ %1\'.
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2060
            source := (source bindWith:holderMethodName) withCRs.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2061
            self compile:source forClass:nonMetaClass inCategory:('accessing').
5763
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2062
        ] ifTrue:[
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2063
            Transcript showCR:'method ''', methodName , ''' already present'
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2064
        ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2065
    ].
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2066
8cce359fd150 add valueHolder
Claus Gittinger <cg@exept.de>
parents: 5759
diff changeset
  2067
    self executeCollectedChangesNamed:('Add ValueHolder').
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2068
! !
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2069
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2070
!CodeGeneratorTool methodsFor:'code generation-individual methods'!
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2071
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2072
createAcceptVisitorMethod:selector in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2074
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
6921
821413de0099 leftover halt.
Claus Gittinger <cg@exept.de>
parents: 6839
diff changeset
  2076
    self assert:( aClass isMeta not ).
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2078
    (aClass includesSelector:#'acceptVisitor:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2080
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
(('acceptVisitor:aVisitor 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2082
    "Double dispatch back to the visitor, passing my type encoded in
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2083
     the selector (visitor pattern)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2084
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
    "stub code automatically generated - please change if required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2086
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
    ^ aVisitor %1self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2088
') bindWith:selector)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2089
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2090
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2091
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2092
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2094
createAcceptVisitorMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2095
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2096
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2097
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2098
    self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
        createAcceptVisitorMethod:('visit' , aClass nameWithoutPrefix , ':') asSymbol
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2100
        in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2101
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2102
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2103
createCopyrightMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2104
    "add copyright method containing your/your companies
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2105
     copyright template but only if not already present.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2106
     this is only added, if specified in the 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2107
     COPYRIGHT_TEMPLATE_FILE resources."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2108
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2109
    |fn copyRightText|
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2110
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
    (aClass includesSelector:#copyright) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2112
        fn := SystemBrowser classResources at:#'COPYRIGHT_TEMPLATE_FILE' default:nil.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2113
        fn notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2114
            fn := fn asFilename.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2115
            fn exists ifTrue:[
8488
bb2810d17bd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8344
diff changeset
  2116
                copyRightText := fn contentsAsString.
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2117
                self createCopyrightMethodFor:copyRightText for:aClass
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2118
            ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2119
        ].
8258
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2120
    ].
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2121
!
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2122
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2123
createCopyrightMethodFor:copyRightText for:aClass
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2124
    "add copyright method containing text,
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2125
     but only if not already present."
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2126
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2127
    |txt|
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2128
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2129
    (aClass includesSelector:#copyright) ifFalse:[
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2130
        copyRightText notNil ifTrue:[
77eecb901a6a copyrights
Claus Gittinger <cg@exept.de>
parents: 7973
diff changeset
  2131
            txt := copyRightText bindWith:(Date today year).
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2132
            self compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
'copyright
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2134
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2135
' , txt , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2136
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
'             forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2138
              inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2140
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2141
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2142
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2143
createDocumentationMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2144
    "add documentation method containing doc template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2145
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2146
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2147
    |metaClass nonMetaClass userName loginName hostName emailAddress code existingComment|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2148
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2149
    metaClass := aClass theMetaclass.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2150
    nonMetaClass := aClass theNonMetaclass.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2151
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2152
    (metaClass includesSelector:#documentation) ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2153
        existingComment := nonMetaClass comment.
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2154
        existingComment isEmptyOrNil ifTrue:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2155
            (nonMetaClass isSubclassOf:HTTPService) ifTrue:[
6159
2707b35f964c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6050
diff changeset
  2156
                existingComment := '    [start Server with:]
7545
df2fc5dbee78 changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents: 7480
diff changeset
  2157
        HTTPServer startServerOnPort:8080
6159
2707b35f964c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6050
diff changeset
  2158
2707b35f964c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6050
diff changeset
  2159
    [start with:]
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2160
        (self new)
7545
df2fc5dbee78 changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents: 7480
diff changeset
  2161
            registerServiceOn:(HTTPServer runningServerOnPort:8080)'.
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2162
            ].
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2163
        ].
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2164
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
        userName := OperatingSystem getFullUserName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2166
        loginName := OperatingSystem getLoginName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2167
        hostName := OperatingSystem getHostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2168
        emailAddress := loginName , '@' , hostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2169
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2170
        "/ ugly; should ask the class for that    
6350
421d6bb17db5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6349
diff changeset
  2171
        metaClass isJavaScriptMetaclass ifTrue:[
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2172
            code :=
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2173
'function documentation() {
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2174
/*
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2175
' , (existingComment ? '    documentation to be added.') , '
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2176
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2177
    [author:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2178
        ' , userName 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2179
          , ' (' , emailAddress , ')' , '
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2180
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2181
    [instance variables:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2182
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2183
    [class variables:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2184
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2185
    [see also:]
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2186
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2187
*/
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2188
}
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2189
'
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2190
        ] ifFalse:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2191
            code:= 
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2192
'documentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
"
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2194
' , (existingComment ? '    documentation to be added.') , '
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
    [author:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2197
        ' , userName 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2198
          , ' (' , emailAddress , ')' , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2200
    [instance variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2201
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
    [class variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2203
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2204
    [see also:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
"
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2207
'
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2208
        ].
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2209
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2210
        self 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2211
            compile:code
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2212
            forClass:metaClass 
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2213
            inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2214
    ].
7545
df2fc5dbee78 changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents: 7480
diff changeset
  2215
df2fc5dbee78 changed #createDocumentationMethodFor:
Claus Gittinger <cg@exept.de>
parents: 7480
diff changeset
  2216
    "Modified: / 24-11-2006 / 15:54:27 / cg"
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2217
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2218
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2219
createExamplesMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2220
    "add examples method containing examples template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2221
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2222
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2223
    |nonMetaclass fragment|
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2224
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2225
    nonMetaclass := aClass theNonMetaclass.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2226
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2227
    (nonMetaclass isSubclassOf:View) ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2228
        self createExamplesMethodForViewClass:aClass.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2229
        ^ self
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2230
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2231
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2232
    (nonMetaclass isSubclassOf:ApplicationModel) ifFalse:[
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2233
        ^ self
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2234
    ].
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2235
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2236
    (aClass includesSelector:#examples) ifFalse:[
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2237
        (nonMetaclass isSubclassOf:ApplicationModel) ifTrue:[
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2238
            fragment := '  Starting the application:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2239
                                                                [exBegin]
6050
300b21c10c71 *** empty log message ***
ca
parents: 5953
diff changeset
  2240
    ' , nonMetaclass name , ' open
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2241
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2242
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2243
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2244
        ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2245
            fragment := ''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2246
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2247
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2248
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2249
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2250
'examples
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2251
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2252
' , fragment , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2253
  more examples to be added:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2254
                                                                [exBegin]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2255
    ... add code fragment for 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2256
    ... executable example here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2257
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2258
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2259
'                   
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2260
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2261
            inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2262
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2263
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2264
3822
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2265
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
  2266
    |imageStoreStream mthd imageKey category|
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2267
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2268
    anImage storeOn: (imageStoreStream := WriteStream on: '').
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2269
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2270
    "/ 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
  2271
    category := 'image specs'.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2272
    (mthd := aClass compiledMethodAt:sel) notNil ifTrue:[
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2273
        category := mthd category.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2274
    ].
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2275
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2276
    imageKey :=  (aClass name, ' ', sel) asSymbol.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2277
    Icon constantNamed: imageKey put:nil.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2278
    aClass
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2279
        compile: ((sel,
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2280
            '\', comment,
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2281
            '\\' , 
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2282
            '    "\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2283
            '     self ' , sel , ' inspect\',
3823
1ed101fe88a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2284
            '     ImageEditor openOnClass:self andSelector:#', sel, '\',
3822
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2285
            '     Icon flushCachedIcons', 
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2286
            '\    "',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2287
            '\\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2288
            '    <resource: #image>',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2289
            '\\',
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2290
            '    ^Icon\') withCRs, 
7967
2560906ca552 use string-key in constantNamed:-icon caching
Claus Gittinger <cg@exept.de>
parents: 7615
diff changeset
  2291
            '        constantNamed:''', imageKey, '''\' withCRs,
3822
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2292
            '        ifAbsentPut:[', imageStoreStream contents, ']')
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2293
       classified: category.
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2294
!
4e9f2f69875f code generation for icons moved from ImageEditor
Claus Gittinger <cg@exept.de>
parents: 3804
diff changeset
  2295
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2296
createInitialHistoryMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2297
    "add history method containing created-entry
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2299
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2300
    |code|
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2301
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
    (aClass includesSelector:#history) ifFalse:[ 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
        HistoryManager notNil ifTrue:[
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2304
            code := HistoryManager codeForInitialHistoryMethodIn:aClass.
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2305
            self
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2306
                compile:code
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2307
                forClass:aClass 
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2308
                inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2309
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2310
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2311
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2312
4512
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2313
createInstanceCreationMethodWithSetupFor:selector category:category in:aMetaClass
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2314
    "add an inst-creation method"
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2315
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2316
    |template|
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2317
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2318
    (aMetaClass includesSelector:selector) ifFalse:[
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2319
        template := Parser methodSpecificationForSelector:selector.
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2320
        self 
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2321
            compile:
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2322
template , '
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2323
    ^ self new ' , template , '
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2324
'                   
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2325
            forClass:aMetaClass 
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2326
            inCategory:category.
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2327
    ].
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2328
!
117fa43d16eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  2329
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2330
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2331
    "create a multi-setter method for instvars."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2332
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2333
    |source|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2334
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2335
    source := ''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2336
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2337
        source := source , (eachVar , ':' , eachVar , 'Arg ').
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2339
    source := source , Character cr.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2340
    (userPreferences generateCommentsForSetters) ifTrue:[
6993
22233dd2489d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6992
diff changeset
  2341
        source := source , ('    "set instance variables"' , Character cr , Character cr).
6992
93d4212a20d5 no comment in multi-setter
Claus Gittinger <cg@exept.de>
parents: 6972
diff changeset
  2342
    ].
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2343
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
        source := source , ('    ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2345
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2346
    self compile:source forClass:aClass inCategory:'accessing'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2348
3800
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2349
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2350
    "add a subclassResponsibility method;
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2351
     but only if not already present."
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2352
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2353
    (aClass includesSelector:aSelector) ifFalse:[
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2354
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2355
        self compile:
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2356
(Method methodDefinitionTemplateForSelector:aSelector) ,
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2357
'
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2358
    "raise an error: must be redefined in concrete subclass(es)"
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2359
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2360
    ^ self subclassResponsibility
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2361
' 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2362
              forClass:aClass 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2363
              inCategory:cat.
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2364
    ].
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2365
!
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  2366
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2367
createUpdateMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2368
    "create an update:with:from:-method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2369
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2370
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2371
    |code|
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2372
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2373
    (aClass includesSelector:#'update:with:from:') ifFalse:[
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2374
        generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2375
            code :=
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2376
'update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2377
    super update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2378
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2379
        ] ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2380
            code :=
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
'update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
    "Invoked when an object that I depend upon sends a change notification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2383
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2384
    "stub code automatically generated - please change as required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2385
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2386
    "/ changedObject == someOfMyValueHolders ifTrue:[
4926
f0ab6bb01771 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4908
diff changeset
  2387
    "/     self doSomethingApropriate.
f0ab6bb01771 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4908
diff changeset
  2388
    "/     ^ self.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2389
    "/ ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2390
    super update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2391
'
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2392
        ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2393
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2394
        self 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2395
            compile:code
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2396
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2397
            inCategory:'change & update'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2398
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2399
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2400
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2401
createVersionMethodFor:aClass
8890
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2402
    <resource: #obsolete>
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2403
    "add version method containing RCS template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2404
     but only if not already present and its not a private class."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2405
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2406
    |code|
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2407
8890
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2408
    self obsoleteMethodWarning.
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2409
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2410
    aClass isPrivate ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2411
        (aClass includesSelector:#version) ifFalse:[
5756
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2412
            "/ ugly; should ask the class for that    
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2413
            aClass isJavaScriptClass ifTrue:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2414
                code:= ('function version() {\    return ("$' , 'Header$");\}') withCRs
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2415
            ] ifFalse:[
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2416
                code:= ('version\    ^ ''$' , 'Header$''') withCRs
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2417
            ].
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2418
            self 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2419
                compile:code
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2420
                forClass:aClass 
66261b5c4659 *** empty log message ***
ca
parents: 5494
diff changeset
  2421
                inCategory:'documentation'.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2422
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2423
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2424
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2425
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2426
!CodeGeneratorTool methodsFor:'code templates'!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2427
8987
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2428
codeFor_classInitialize
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2429
    generateComments ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2430
        ^
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2431
'initialize
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2432
%(INIT_CLASSINSTVARS)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2433
%(INIT_CLASSVARS)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2434
'.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2435
    ].
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2436
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2437
    ^
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2438
'initialize
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2439
    "Invoked at system start or when the class is dynamically loaded."
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2440
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2441
    "/ please change as required (and remove this comment)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2442
%(INIT_CLASSINSTVARS)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2443
%(INIT_CLASSVARS)
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2444
'.
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2445
!
Claus Gittinger <cg@exept.de>
parents: 8890
diff changeset
  2446
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2447
codeFor_closeAccept
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2448
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2449
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2450
'closeAccept
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2451
    ^ super closeAccept
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2452
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2453
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2454
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2455
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2456
'closeAccept
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2457
    "This is a hook method generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2458
     It will be invoked when your dialog-window is closed with OK."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2459
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2460
    "/ add any actions as required here ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2461
    Transcript showCR:''dialog accepted''.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2462
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2463
    "/ do not remove the one below (otherwise, the dialog will not close itself)...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2464
    ^ super closeAccept
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2465
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2466
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2467
    "Created: / 27-10-2006 / 10:03:31 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2468
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2469
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2470
codeFor_closeDownViews
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2471
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2472
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2473
'closeDownViews
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2474
    ^ super closeDownViews
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2475
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2476
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2477
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2478
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2479
'closeDownViews
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2480
    "This is a hook method generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2481
     It will be invoked when your app/dialog-window is really closed.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2482
     See also #closeDownViews, which is invoked before and may suppress the close
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2483
     or ask the user for confirmation."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2484
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2485
    "/ change the code below as required ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2486
    "/ This should cleanup any leftover resources
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2487
    "/ (for example, temporary files)
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2488
    "/ super closeRequest will initiate the closeDown
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2489
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2490
    "/ add your code here
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2491
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2492
    "/ do not remove the one below ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2493
    ^ super closeDownViews
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2494
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2495
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2496
    "Created: / 27-10-2006 / 10:01:32 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2497
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2498
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2499
codeFor_closeRequest
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2500
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2501
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2502
'closeRequest
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2503
    self hasUnsavedChanges ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2504
        (self confirm:(resources string:''Close without saving ?'')) ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2505
            ^ self
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2506
        ]
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2507
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2508
    ^ super closeRequest
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2509
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2510
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2511
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2512
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2513
'closeRequest
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2514
    "This is a hook method generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2515
     It will be invoked when your app/dialog-window is about to be
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2516
     closed (this method has a chance to suppress the close).
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2517
     See also #closeDownViews, which is invoked when the close is really done."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2518
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2519
    "/ change the code below as required ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2520
    "/ Closing can be suppressed, by simply returning.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2521
    "/ The ''super closeRequest'' at the end will initiate the real closeDown
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2522
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2523
    self hasUnsavedChanges ifTrue:[
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2524
        (self confirm:(resources string:''Close without saving ?'')) ifFalse:[
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2525
            ^ self
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2526
        ]
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2527
    ].
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2528
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2529
    ^ super closeRequest
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2530
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2531
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2532
    "Created: / 27-10-2006 / 10:01:06 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2533
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2534
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2535
codeFor_doSaveAs
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2536
    ^ self codeFor_emptyMenuActionCodeFor:#doSaveAs menuItem:'save/saveAs'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2537
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2538
    "Created: / 27-10-2006 / 10:22:06 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2539
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2540
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2541
codeFor_emptyMenuActionCodeFor:selector menuItem:item
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2542
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2543
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2544
selector,'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2545
    self warn:''no action for ''''',item,''''' defined.''.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2546
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2547
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2548
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2549
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2550
selector,'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2551
    "This method was generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2552
     It will be invoked when the menu-item ''',item,''' is selected."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2553
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2554
    "/ change below and add any actions as required here ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2555
    self warn:''no action for ''''',item,''''' defined.''.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2556
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2557
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2558
    "Created: / 27-10-2006 / 10:16:43 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2559
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2560
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2561
codeFor_hasUnsavedChanges
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2562
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2563
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2564
'hasUnsavedChanges
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2565
    ^ false.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2566
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2567
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2568
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2569
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2570
'hasUnsavedChanges
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2571
    "Return true, if any unsaved changes are present 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2572
     (i.e. the contents needs to be saved or else will be lost)"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2573
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2574
    "/ add real code as required (or remove the halt and always return false)...
9053
9e09bbdb81a3 changed: #codeFor_hasUnsavedChanges
Claus Gittinger <cg@exept.de>
parents: 9049
diff changeset
  2575
    "/ self halt:''check this code''.
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2576
    ^ false.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2577
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2578
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2579
    "Created: / 27-10-2006 / 10:00:36 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2580
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2581
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2582
codeFor_menuNew
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2583
    ^ self codeFor_emptyMenuActionCodeFor:#menuNew menuItem:'new'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2584
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2585
    "Created: / 27-10-2006 / 10:17:08 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2586
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2587
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2588
codeFor_menuOpen
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2589
    ^ self codeFor_emptyMenuActionCodeFor:#menuOpen menuItem:'open'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2590
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2591
    "Created: / 27-10-2006 / 10:17:18 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2592
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2593
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2594
codeFor_menuSave
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2595
    ^ self codeFor_emptyMenuActionCodeFor:#menuSave menuItem:'save'
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2596
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2597
    "Created: / 27-10-2006 / 10:17:25 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2598
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2599
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2600
codeFor_menuSaveAs
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2601
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2602
'menuSaveAs
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2603
    "This method was generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2604
     It will be invoked when the menu-item ''saveAs'' is selected."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2605
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2606
    "/ change below as required... (see examples in Dialog class for more options)
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2607
    Dialog
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2608
        requestSaveFileName:(resources string:''Save'') 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2609
        default:''foo.txt'' 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2610
        fromDirectory:nil 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2611
        action:[:fileName | self doSaveAs:fileName] 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2612
        appendAction:nil.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2613
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2614
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2615
    "Created: / 27-10-2006 / 10:01:57 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2616
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2617
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2618
codeFor_openAboutThisApplication
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2619
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2620
'openAboutThisApplication
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2621
    "This method was generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2622
     It will be invoked when the menu-item ''help-about'' is selected."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2623
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2624
    "/ could open a customized aboutBox here ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2625
    super openAboutThisApplication
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2626
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2627
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2628
    "Created: / 27-10-2006 / 10:03:13 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2629
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2630
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2631
codeFor_openDocumentation
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2632
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2633
'openDocumentation
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2634
    "This method was generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2635
     It will be invoked when the menu-item ''help-documentation'' is selected."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2636
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2637
    "/ change below as required ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2638
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2639
    "/ to open an HTML viewer on some document (under ''doc/online/<language>/'' ):
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2640
    HTMLDocumentView openFullOnDocumentationFile:''TOP.html''.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2641
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2642
    "/ add application-specific help files under the ''doc/online/<language>/help/appName''
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2643
    "/ directory, and open a viewer with:
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2644
    "/ HTMLDocumentView openFullOnDocumentationFile:''help/<MyApplication>/TOP.html''.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2645
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2646
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2647
    "Created: / 27-10-2006 / 10:02:55 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2648
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2649
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2650
codeFor_postBuildWith
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2651
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2652
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2653
'postBuildWith:aBuilder
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2654
    ^ super postBuildWith:aBuilder
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2655
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2656
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2657
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2658
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2659
'postBuildWith:aBuilder
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2660
    "This is a hook method generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2661
     It will be invoked during the initialization of your app/dialog,
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2662
     after all of the visual components have been built, 
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2663
     but BEFORE the top window is made visible.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2664
     Add any app-specific actions here (reading files, setting up values etc.)
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2665
     See also #postOpenWith:, which is invoked after opening."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2666
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2667
    "/ add any code here ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2668
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2669
    ^ super postBuildWith:aBuilder
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2670
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2671
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2672
    "Created: / 27-10-2006 / 09:59:33 / cg"
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2673
!
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2674
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2675
codeFor_postOpenWith
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2676
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2677
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2678
'postOpenWith:aBuilder
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2679
    ^ super postOpenWith:aBuilder
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2680
'.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2681
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2682
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2683
    ^
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2684
'postOpenWith:aBuilder
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2685
    "This is a hook method generated by the Browser.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2686
     It will be invoked right after the applications window has been opened.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2687
     Add any app-specific actions here (starting background processes etc.).
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2688
     See also #postBuildWith:, which is invoked before opening."
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2689
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2690
    "/ add any code here ...
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2691
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2692
    ^ super postOpenWith:aBuilder
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2693
'.
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2694
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2695
    "Created: / 27-10-2006 / 09:59:56 / cg"
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2696
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2697
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2698
code_forWidget_buttonPress
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2699
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2700
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2701
'buttonPress:button x:x y:y
8574
8b570032f547 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8573
diff changeset
  2702
    Transcript show:''button: ''; showCR:button.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2703
    super buttonPress:button x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2704
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2705
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2706
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2707
    ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2708
'buttonPress:button x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2709
    "called when a mouse-button is pressed. button is the button-nr (1 for left-button).
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2710
     x/y are the mouse position at the time of the click.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2711
     There are also corresponding buttonRelease and buttonMotion methods which could be
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2712
     redefined...."
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2713
8574
8b570032f547 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8573
diff changeset
  2714
    Transcript show:''button: ''; showCR:button.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2715
    "/ super-code handles middleButtonMenu, if it was assigned (with middleButtonmenu:)
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2716
    super buttonPress:button x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2717
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2718
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2719
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2720
code_forWidget_initialize
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2721
    ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2722
'initialize
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2723
    super initialize "/ to initialize inherited state
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2724
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2725
    "/ add code to initialize private variables,
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2726
    "/ and sub-components as required.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2727
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2728
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2729
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2730
code_forWidget_keyPress
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2731
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2732
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2733
'keyPress:key x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2734
"/    key == #Copy ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2735
"/    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2736
"/    key == #Cut ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2737
"/    ].
8574
8b570032f547 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8573
diff changeset
  2738
    Transcript show:''key: ''; showCR:key.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2739
    super keyPress:key x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2740
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2741
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2742
    ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2743
'keyPress:key x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2744
    "called when a keyboard-key was pressed. key is either a character (for ordinary keys)
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2745
     or a symbol, such as #Copy, #Cut or #Paste.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2746
     x/y are the mouse position at the time of the key-press.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2747
     There is also a corresponding keyRelease method which could be redefined...."
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2748
8574
8b570032f547 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8573
diff changeset
  2749
    Transcript show:''key: ''; showCR:key.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2750
    super keyPress:key x:x y:y
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2751
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2752
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2753
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2754
code_forWidget_redraw
8573
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2755
    |sel comment code|
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2756
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2757
    sel := 'redrawX:x y:y width:w height:h'.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2758
    generateComments ifFalse:[
8573
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2759
        comment := ''.
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2760
    ] ifTrue:[
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2761
        comment := '
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2762
    "called to redraw a part of the widgets area. x/y define the origin, w/h the size of
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2763
     that area. The clipping region has already been set by the caller, so even if the code
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2764
     below draws outside the redraw-area, it will not affect what is on the screen. 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2765
     Therefore, the example below can fill the rectangle in the redraw area, but still draw
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2766
     the cross in the outside regions."
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2767
8573
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2768
'.
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2769
    ].
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2770
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2771
    code := '
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2772
    self paint:Color red.
8573
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2773
    self fillRectangleX:x y:y width:w height:h.
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2774
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2775
    self paint:Color yellow.
8573
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2776
    self displayLineFrom:0@0 to:(width@height).
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2777
    self displayLineFrom:width@0 to:(0@height).
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2778
'.
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2779
aa3caf4e83c7 initial widget code
Claus Gittinger <cg@exept.de>
parents: 8572
diff changeset
  2780
    ^ sel,comment,code
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2781
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2782
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2783
code_forWidget_sizeChanged
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2784
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2785
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2786
'sizeChanged:how
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2787
    self invalidate.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2788
    super sizeChanged:how.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2789
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2790
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2791
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2792
    ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2793
'sizeChanged:how
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2794
    "Invoked whenever the size of the view changes. 
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2795
     Here, we force a full redraw, which might not be needed all the time"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2796
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2797
    self invalidate.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2798
    super sizeChanged:how.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2799
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2800
!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2801
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2802
code_forWidget_update
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2803
    generateComments ifFalse:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2804
        ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2805
'update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2806
    changedObject == model ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2807
        self invalidate.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2808
        ^ self
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2809
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2810
    super update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2811
'
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2812
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2813
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2814
    ^
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2815
'update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2816
    "Invoked when an object that I depend upon sends a change notification."
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2817
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2818
    "stub code automatically generated - please change as required"
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2819
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2820
    changedObject == model ifTrue:[
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2821
        self invalidate.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2822
        ^ self
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2823
    ].
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2824
    super update:something with:aParameter from:changedObject
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2825
'
7480
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2826
! !
33930379ab27 code cleanup; more application code generation
Claus Gittinger <cg@exept.de>
parents: 7470
diff changeset
  2827
6938
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2828
!CodeGeneratorTool methodsFor:'compilation'!
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2829
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2830
compile:theCode forClass:aClass inCategory:cat 
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2831
    "install some code for a class.
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2832
     If refactory browser stuff is avaliable the refactory tools are used to support undo"
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2833
7037
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2834
    self
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2835
        compile:theCode forClass:aClass inCategory:cat 
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2836
        skipIfSame:true
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2837
!
6938
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2838
7037
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2839
compile:theCode forClass:aClass inCategory:cat skipIfSame:skipIfSame 
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2840
    "install some code for a class.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2841
     If refactory browser stuff is avaliable the refactory tools are used to support undo"
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2842
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2843
    |change compiler selector oldMthd isSame|
6938
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2844
7037
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2845
    isSame := false.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2846
    skipIfSame ifTrue:[
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2847
        compiler := aClass compilerClass new.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2848
        compiler parseMethod:theCode in:aClass ignoreErrors:true ignoreWarnings:true.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2849
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2850
        selector := compiler selector.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2851
        selector notNil ifTrue:[
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2852
            oldMthd := aClass compiledMethodAt:selector.
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2853
            isSame := (oldMthd notNil and:[oldMthd source = theCode]).
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2854
            isSame ifTrue:[ ^ self ].
6938
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2855
        ].
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2856
    ].
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2857
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2858
    self canUseRefactoringSupport ifFalse:[
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2859
        "/ compile immediately
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2860
        aClass compile:theCode classified:cat.
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2861
        ^ self.
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2862
    ].
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2863
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2864
    change := InteractiveAddMethodChange compile:(theCode asString) in:aClass classified:cat.
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2865
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2866
    "/ if collecting, add to changes (to be executed as one change at the end,
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2867
    "/ in order to have only one change in the undo-list (instead of many)
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2868
    compositeChangeCollector notNil ifTrue:[
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2869
        compositeChangeCollector addChange:change
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2870
    ] ifFalse:[
7037
ec9705009031 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6993
diff changeset
  2871
        RefactoryChangeManager performChange:change.
6938
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2872
    ]
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2873
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2874
    "Modified: / 21-08-2006 / 18:39:06 / cg"
6cf52649971c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6937
diff changeset
  2875
! !
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2876
8572
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2877
!CodeGeneratorTool methodsFor:'initialization'!
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2878
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2879
initialize
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2880
    userPreferences := UserPreferences current.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2881
    generateComments := userPreferences generateComments.
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2882
! !
beebdd1ee40e initial widget code
Claus Gittinger <cg@exept.de>
parents: 8488
diff changeset
  2883
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2884
!CodeGeneratorTool methodsFor:'private'!
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2885
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2886
canUseRefactoringSupport
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2887
    "check if refactory browser stuff is avaliable"
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2888
5758
8f88193a4a93 collect changes
Claus Gittinger <cg@exept.de>
parents: 5756
diff changeset
  2889
     ^ self class canUseRefactoringSupport
5013
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2890
!
0f2c39fc6e8c comments; allow for comments to be suppressed
Claus Gittinger <cg@exept.de>
parents: 4926
diff changeset
  2891
9027
f2edc1bca4de added: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  2892
codeFor_shouldImplementFor:selector inClass:aClass
9044
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2893
    "used in the 'generate required protocol' to generate a shouldImplement-sending
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2894
     method for each subclassClassresponsibility method above aClass."
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2895
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2896
    |mthd comment implClass methodBodyStream searcher errorMessageString|
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2897
9028
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2898
    (aClass notNil
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2899
    and:[ aClass superclass notNil ]) ifTrue:[
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2900
        implClass := aClass superclass whichClassImplements:selector.
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2901
    ].
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2902
    implClass isNil ifTrue:[
9028
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2903
        ^ ((Method methodDefinitionTemplateForSelector:selector),'\    ^ self shouldImplement\') withCRs
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2904
    ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2905
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2906
    mthd := implClass compiledMethodAt:selector.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2907
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2908
    methodBodyStream := '' writeStream.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2909
    methodBodyStream 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2910
        nextPutAll:mthd methodDefinitionTemplate; cr;
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2911
        nextPutAll:'    "'.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2912
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2913
    "/ include the comment of the subclassResponsibility-sending method
9044
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2914
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2915
    comment := mthd methodComment.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2916
    comment isEmptyOrNil ifTrue:[
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2917
        methodBodyStream 
9028
56eb45cb11f3 changed: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9027
diff changeset
  2918
            nextPutAll:('superclass <1s> says that I am responsible to implement this method'  
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2919
                        expandMacrosWith:implClass name)
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2920
    ] ifFalse:[
9044
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2921
        comment 
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2922
            asStringCollection do:[:eachLine|
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2923
                methodBodyStream nextPutAll:eachLine.
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2924
            ] separatedBy:[
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2925
                methodBodyStream cr; nextPutAll:'     '.
5da7b7815f56 comment/format in: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  2926
            ].
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2927
    ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2928
    methodBodyStream 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2929
        nextPut:$"; cr; cr.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2930
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2931
    "/ include the argument of the subclassResponsibility:-sending method
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2932
    self canUseRefactoringSupport ifTrue:[
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2933
        (mthd sends:#subclassResponsibility:) ifTrue:[
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2934
            searcher := ParseTreeSearcher new.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2935
            searcher
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2936
                    matches: 'self subclassResponsibility: `''.*'''
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2937
                    do:[:node :answer | 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2938
                        errorMessageString := node arguments first value.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2939
                        true.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2940
                    ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2941
            searcher executeTree: (mthd parseTree) initialAnswer: false.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2942
        ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2943
    ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2944
    errorMessageString notEmptyOrNil ifTrue:[
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2945
        methodBodyStream 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2946
            nextPutAll:'    ^ self shouldImplement:'; 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2947
            nextPutLine:(errorMessageString storeString)
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2948
    ] ifFalse:[
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2949
        methodBodyStream 
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2950
            nextPutLine:'    ^ self shouldImplement'.
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2951
    ].
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2952
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2953
    ^ methodBodyStream contents
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2954
!
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2955
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2956
privCreateClassResponsibleProtocolFor:aClass
6791
6559c9ebb561 Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents: 6718
diff changeset
  2957
    "create stubs for the required protocol.
6559c9ebb561 Keep method argument names when generating required methods
Stefan Vogel <sv@exept.de>
parents: 6718
diff changeset
  2958
     aClass may be a a MetaClass or a non-MetaClass"
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2959
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2960
    |requiredProtocol|
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2961
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2962
    requiredProtocol := self class missingRequiredProtocolFor:aClass.
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2963
    requiredProtocol do:[:eachSelector |
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2964
        |code implClass|
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2965
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2966
        implClass := aClass whichClassImplements:eachSelector.
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2967
        implClass == Object ifFalse:[
9027
f2edc1bca4de added: #codeFor_shouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  2968
            code := self codeFor_shouldImplementFor:eachSelector inClass:aClass.
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2969
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2970
            self 
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2971
                compile:code
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2972
                forClass:aClass 
9025
124489bab860 added: #codeForShouldImplementFor:inClass:
Claus Gittinger <cg@exept.de>
parents: 9022
diff changeset
  2973
                inCategory:(implClass compiledMethodAt:eachSelector) category.
9022
676088a17690 added: #missingRequiredProtocolFor:
Claus Gittinger <cg@exept.de>
parents: 8987
diff changeset
  2974
        ]
4108
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2975
    ].
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2976
! !
19af32811dfd Generate minimal protocol classes for metaclass.
Stefan Vogel <sv@exept.de>
parents: 3823
diff changeset
  2977
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2978
!CodeGeneratorTool class methodsFor:'documentation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2979
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2980
version
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  2981
    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.73 2009-10-26 12:54:28 fm Exp $'
8890
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2982
!
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2983
69b74f5776fb changed:
fm
parents: 8773
diff changeset
  2984
version_CVS
9081
d59a59877121 changed: #createStartupCodeFor:forStartOf:
fm
parents: 9054
diff changeset
  2985
    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.73 2009-10-26 12:54:28 fm Exp $'
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2986
! !