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