CodeGeneratorTool.st
author Claus Gittinger <cg@exept.de>
Thu, 15 Aug 2002 13:09:05 +0200
changeset 3800 a5c75c369855
parent 3719 d7f6eb94a693
child 3804 d2bc07d678f3
permissions -rw-r--r--
added generateSubclassResponsibility
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'stx:libtool' }"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
Object subclass:#CodeGeneratorTool
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	instanceVariableNames:''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	classVariableNames:''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	poolDictionaries:''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	category:'Interface-Browsers'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
3719
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    10
!CodeGeneratorTool class methodsFor:'documentation'!
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    11
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    12
documentation
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    13
"
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    14
    extracted code generation stuff from old and newBrowser.
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    15
    There is probably more to gome...
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    16
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    17
    [author:]
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    18
        Claus Gittiner
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    19
"
d7f6eb94a693 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3716
diff changeset
    20
! !
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!CodeGeneratorTool class methodsFor:'code generation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
    "workhorse for creating access methods for instvars."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
    |classesClassVars|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
    classesClassVars := aClass theNonMetaclass allClassVarNames.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
    aCollectionOfVarNames do:[:name |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
        |source varType methodName|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
        varType := (classesClassVars includes:name) 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
                        ifTrue:['static'] 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
                        ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
                            (aClass isMeta ifTrue:['classInstVar'] ifFalse:['instance'])].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
        methodName := name.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
        name first isUppercase ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
            methodName := methodName asLowercaseFirst. 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
        writersOnly ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
            "check, if method is not already present"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
            (aClass includesSelector:(methodName asSymbol)) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
                asValueHolder ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
                    source := methodName
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
                               , '\    "return/create the ''%2'' value holder (automatically generated)"\\' 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
                               , '    %2 isNil ifTrue:[\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
                               , '        %2 := ValueHolder new.\'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
                    withChange ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
                    source := source
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
                               , '        %2 addDependent:self.\'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
                    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
                    source := source
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
                               , '    ].\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
                               , '    ^ %2'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
                ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
                    source := methodName
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
                               , '\    "return the value of the %1 variable ''%2'' (automatically generated)"\\' 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
                               , '    ^ %2'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
                ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
                source := (source bindWith:varType with:name) withCRs.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
                self compile:source forClass:aClass inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
            ] ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
                Transcript showCR:'method ''', methodName , ''' already present'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
            ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
        readersOnly ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
            (aClass includesSelector:((methodName , ':') asSymbol)) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
                asValueHolder ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
                    source := methodName
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
                              , ':something\    "set the ''%2'' value holder'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
                    withChange ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
                        source := source
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
                                  , ' (automatically generated)"\\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
                                  , '    |oldValue newValue|\\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
                                  , '    %2 notNil ifTrue:[\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
                                  , '        oldValue := %2 value.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
                                  , '        %2 removeDependent:self.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
                                  , '    ].\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
                                  , '    %2 := something.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
                                  , '    %2 notNil ifTrue:[\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
                                  , '        %2 addDependent:self.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
                                  , '    ].\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
                                  , '    newValue := %2 value.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
                                  , '    oldValue ~~ newValue ifTrue:[\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
                                  , '        self update:#value with:newValue from:%2.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
                                  , '    ].\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
                    ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
                        source := source 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
                                  , ' (automatically generated)"\\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
                                  , '    %2 := something.'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
                    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
                ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
                    source := methodName
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
                              , ':something\    "set the value of the %1 variable ''%2'''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
                    withChange ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
                        source := source
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
                                  , ' and send a change notification (automatically generated)"\\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
                                  , '    (%2 ~~ something) ifTrue:[\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
                                  , '        %2 := something.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
                                  , '        self changed:#%2.\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
                                  , '     ].\'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
                    ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
                        source := source 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
                                  , ' (automatically generated)"\\'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
                                  , '    %2 := something.'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
                    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
                ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
                source := (source bindWith:varType with:name) withCRs.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
                self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
                    compile:source 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
                    forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
                    inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
            ] ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
                Transcript showCR:'method ''', methodName , ':'' already present'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
            ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
createApplicationCodeFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    "create an empty application framework"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    |nonMetaClass metaClass className txt isDialog|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    nonMetaClass := aClass theNonMetaclass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    metaClass := aClass theMetaclass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    className := nonMetaClass name.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    isDialog := (nonMetaClass isSubclassOf:SimpleDialog).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "/ add a windowSpec method for an empty applicationWindow,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    "/ with a menuPanel.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    (metaClass includesSelector:#windowSpec) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
        isDialog ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
            txt := self initialWindowSpecMethodSourceForDialogs.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
        ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
            txt := self initialWindowSpecMethodSourceForApplications.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
            compile:(txt bindWith:className)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
            forClass:metaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
            inCategory:'interface specs'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
        "/ add a topMenu method 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
        (metaClass includesSelector:#mainMenu) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
            txt := self initialMenuSpecMethodSourceForApplications.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
                compile:(txt bindWith:className)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
                forClass:metaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
                inCategory:'menu specs'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    (metaClass includesSelector:#postBuildWith:) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
        txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
'postBuildWith:aBuilder
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    "This is a hook method generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
     It will be invoked during the initialization of your app/dialog,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
     after all of the visual components have been built, 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
     but BEFORE the top window is made visible.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
     Add any app-specific actions here (reading files, setting up values etc.)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
     See also #postOpenWith:, which is invoked after opening."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "/ add any code here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    ^ super postBuildWith:aBuilder
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
            compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
            forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
            inCategory:'initialization & release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    (metaClass includesSelector:#postOpenWith:) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
        txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
'postOpenWith:aBuilder
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    "This is a hook method generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
     It will be invoked right after the applications window has been opened.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
     Add any app-specific actions here (starting background processes etc.).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
     See also #postBuildWith:, which is invoked before opening."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "/ add any code here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    ^ super postOpenWith:aBuilder
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
            compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
            forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
            inCategory:'initialization & release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
        (metaClass includesSelector:#closeRequest) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
'closeRequest
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    "This is a hook method generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
     It will be invoked when your app/dialog-window is about to be
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
     closed (this method has a chance to suppress the close).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
     See also #closeDownViews, which is invoked when the close is really done."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    "/ change the code below as required ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    "/ Closing can be suppressed, by simply returning.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    "/ The ''super closeRequest'' at the end will initiate the real closeDown
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    ("self hasUnsavedChanges" true) ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
        (self confirm:(resources string:''Close without saving ?'')) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
            ^ self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
        ]
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
    ^ super closeRequest
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
                inCategory:'initialization & release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
        (metaClass includesSelector:#closeDownViews) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
'closeDownViews
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "This is a hook method generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
     It will be invoked when your app/dialog-window is really closed.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
     See also #closeDownViews, which is invoked before and may suppress the close
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
     or ask the user for confirmation."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    "/ change the code below as required ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    "/ This should cleanup any leftover resources
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    "/ (for example, temporary files)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    "/ super closeRequest will initiate the closeDown
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "/ add your code here
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    "/ do not remove the one below ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    ^ super closeDownViews
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
                inCategory:'initialization & release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    isDialog ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
        (metaClass includesSelector:#accept) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
'closeAccept
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    "This is a hook method generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
     It will be invoked when your dialog-window is closed with OK."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "/ add any actions as required here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
    Transcript showCR:''dialog accepted''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    "/ do not remove the one below ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    ^ super closeAccept
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
                inCategory:'user actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
        (metaClass includesSelector:#menuNew) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
'menuNew
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
     It will be invoked when the menu-item ''new'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    "/ change below and add any actions as required here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
    self warn:''no action for ''''new'''' available.''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
        (metaClass includesSelector:#menuOpen) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
'menuOpen
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
     It will be invoked when the menu-item ''open'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
    "/ change below and add any actions as required here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
    self warn:''no action for ''''open'''' available.''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
        (metaClass includesSelector:#menuSave) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
'menuSave
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
     It will be invoked when the menu-item ''save'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
    "/ change below and add any actions as required here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    self warn:''no action for ''''save'''' available.''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
        (metaClass includesSelector:#menuSaveAs) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
'menuSaveAs
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
     It will be invoked when the menu-item ''saveAs'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
    "/ change below and add any actions as required here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    self warn:''no action for ''''saveAs'''' available.''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
        (metaClass includesSelector:#openDocumentation) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
'openDocumentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
     It will be invoked when the menu-item ''help-documentation'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
    "/ change below as required ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
    "/ to open an HTML viewer on some document (under ''doc/online/<language>/'' ):
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
    HTMLDocumentView openFullOnDocumentationFile:''TOP.html''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
    "/ add application-specific help files under the ''doc/online/<language>/help/appName''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    "/ directory, and open a viewer with:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
    "/ HTMLDocumentView openFullOnDocumentationFile:''help/<MyApplication>/TOP.html''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    isDialog ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
        (metaClass includesSelector:#openAboutThisApplication) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
            txt :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
'openAboutThisApplication
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    "This method was generated by the Browser.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
     It will be invoked when the menu-item ''help-about'' is selected."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    "/ could open a customized aboutBox here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
    super openAboutThisApplication
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
            self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
                compile:txt
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
                forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
                inCategory:'menu actions'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
    "Modified: / 1.2.1998 / 16:10:03 / cg"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
createDocumentationMethodsFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
    "create empty documentation methods"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
    |cls|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
    cls := aClass theMetaclass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
    self createVersionMethodFor:cls.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    self createCopyrightMethodFor:aClass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
    self createDocumentationMethodFor:aClass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
    self createInitialHistoryMethodFor:aClass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
createStandardInitializationMethodsIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    "create a #new and #initialize methods
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
    |code initializer m|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
    (aClass includesSelector:#'initialize') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
        code :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
'initialize
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
    "Invoked when a new instance is created."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
    super initialize.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    "/ please change as required (and remove this comment)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
        m := aClass responseTo:#initialize.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
        m notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
            m messagesSent size == 0 ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
                "/ inherits an empty initialize.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
                code :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
'initialize
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
    "Invoked when a new instance is created."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
    "/ please change as required (and remove this comment)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
    "/ super initialize.   -- commented since inherited method does nothing
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
            ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        aClass instVarNames do:[:eachInstVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
            initializer := 'nil'. "/ need more intelligence here (try to guess class from messages sent to it) ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
            code := code , ('    ' , eachInstVar , ' := ' , initializer , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
            compile:code
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
            inCategory:'initialization'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
    (aClass class includesSelector:#'new') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
        m := aClass class responseTo:#new.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
        m notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
            (m sends:#initialize) ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
                (self confirm:'The inherited #new method already seems to invoke #initialize. Redefine ?')
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
                ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
                    ^ self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
                ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
            ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
        code :=
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
'new
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
    ^ self basicNew initialize.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
            compile:code
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
            forClass:aClass class 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
            inCategory:'instance creation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
    "Created: / 11.10.2001 / 22:18:55 / cg"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
createTestCaseSampleCodeFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
    "create an empty testCase"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
    |nonMetaClass metaClass|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
    nonMetaClass := aClass theNonMetaclass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
    metaClass := aClass theMetaclass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    "/ className := nonMetaClass name.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    ( nonMetaClass includesSelector:#test1 ) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
'test1
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
    "Just a demonstration testCase.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
     Double click on the TestCase class or open a TestRunner to see me checking...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
     - please add more methods like this..."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
    |o|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    o := Array new:2.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
    self assert: ( o size == 2 ).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    self should: [ o at:0 ] raise:Error.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    self shouldnt: [ o at:1 ] raise:Error.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
     self run:#test1
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
            forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
            inCategory:'tests'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    ( nonMetaClass includesSelector:#setUp ) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
'setUp
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
    "common setup - invoked before testing"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    super setUp
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
            forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
            inCategory:'initialize / release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
    ( nonMetaClass includesSelector:#tearDown ) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
        self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
'tearDown
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
    "common cleanup - invoked after testing"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
    super tearDown
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
            forClass:nonMetaClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
            inCategory:'initialize / release'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
createVisitorMethodsIn:visitedClass andVisitorClass:visitorClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
    "create acceptVisitor: in visitedClass and acceptXXX in visitorClass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
    |sel|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
    visitedClass isMeta ifTrue:[self halt].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    visitorClass isMeta ifTrue:[self halt].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
    sel := ('visit' , visitedClass nameWithoutPrefix , ':').
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
    self createAcceptVisitorMethod:sel in:visitedClass.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    (visitorClass includesSelector:sel) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
(('%1anObject 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    "dispatched back from the visited %2-object (visitor pattern)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
    "fall back to general object-case - please change as required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    ^ self visitObject:anObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
') bindWith:sel with:visitedClass nameWithoutPrefix asLowercaseFirst)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
            forClass:visitorClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    (visitorClass includesSelector:#'visitObject:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
('visitObject:anObject 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
    "dispatched back from the visited objects (visitor pattern)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
    "general fallBack - please change as required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
    self halt:''not yet implemented''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
')
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
            forClass:visitorClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
    (visitorClass includesSelector:#'visit:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
('visit:anObject 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
    "visit anObject (visitor pattern).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
     The object should call back one of my visitXXXX methods."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    ^ anObject acceptVisitor:self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
')
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
            forClass:visitorClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
initialMenuSpecMethodSourceForApplications
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
'mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
     the MenuEditor may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
     MenuEditor new openOnClass:%1 andSelector:#mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
    <resource: #menu>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
    ^ #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
           #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
                #label: ''File''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
                          #label: ''New''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
                          #value: #menuNew
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
                          #label: ''Open...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
                          #value: #menuOpen
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
                          #label: ''Save''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
                          #value: #menuSave
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
                          #label: ''Save As...''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
                          #value: #menuSaveAs
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
                          #label: ''Exit''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
                          #value: #closeRequest
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
             #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
                #label: ''Help''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
                #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
                #startGroup: #right
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
                #submenu: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
                 #(#Menu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
                     #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
                          #label: ''Documentation''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
                          #value: #openDocumentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
                          #label: ''-''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
                       #(#MenuItem
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
                          #label: ''About this Application''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
                          #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
                          #value: #openAboutThisApplication
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
                      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
                    ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
                    nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
            )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
          ) nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
          nil
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
initialWindowSpecMethodSourceForApplications
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    ^ #(#FullSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
          #window: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
           #(#WindowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
              #name: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
              #layout: #(#LayoutFrame 204 0 162 0 503 0 461 0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
              #label: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
              #min: #(#Point 10 10)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
              #max: #(#Point 1024 768)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
              #bounds: #(#Rectangle 204 162 504 462)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
              #menu: #mainMenu
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
              #usePreferredExtent: false
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
          #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
           #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
              #collection: #()
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
initialWindowSpecMethodSourceForDialogs
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
'windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
    "This resource specification was automatically generated by the CodeGeneratorTool."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
    "Do not manually edit this!! If it is corrupted,
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
     the UIPainter may not be able to read the specification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
     UIPainter new openOnClass:%1 andSelector:#windowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
    "
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
    <resource: #canvas>
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
    ^
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
       #(#FullSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
          #window: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
           #(#WindowSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
              #name: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
              #layout: #(#LayoutFrame 221 0 118 0 520 0 417 0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
              #level: 0
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
              #label: ''%1''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
              #min: #(#Point 10 10)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
              #max: #(#Point 1024 768)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
              #bounds: #(#Rectangle 221 118 521 418)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
              #usePreferredExtent: false
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
          #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
           #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
              #collection: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
               #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
                 #(#HorizontalPanelViewSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
                    #name: ''buttonPanel''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
                    #layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 0 1.0)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
                    #component: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
                     #(#SpecCollection
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
                        #collection: 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
                         #(
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
                          #(#ActionButtonSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
                             #name: ''cancelButton''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
                             #label: ''Cancel''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
                             #tabable: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
                             #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
                             #model: #cancel
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
                             #extent: #(#Point 125 22)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
                           )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
                           #(#ActionButtonSpec
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
                              #name: ''okButton''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
                              #label: ''OK''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
                              #tabable: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
                              #translateLabel: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
                              #isDefault: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
                              #model: #accept
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
                              #extent: #(#Point 125 22)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
                          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
                        )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
                    )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
                    #reverseOrderIfOKAtLeft: true
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
                    #horizontalLayout: #spreadSpaceMax
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
                    #verticalLayout: #center
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
                    #horizontalSpace: 3
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
                    #verticalSpace: 3
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
                )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
              )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
          )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
      )
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
!CodeGeneratorTool class methodsFor:'code generation - individual methods'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
createAcceptVisitorMethod:selector in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
    aClass isMeta ifTrue:[self halt].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
    (aClass includesSelector:#'acceptVisitor:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
(('acceptVisitor:aVisitor 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
    "Double dispatch back to the visitor, passing my type encoded in
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
     the selector (visitor pattern)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
    "stub code automatically generated - please change if required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
    ^ aVisitor %1self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
') bindWith:selector)
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
            inCategory:'visiting'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
createAcceptVisitorMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
    "create an acceptVisitor: method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
    self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
        createAcceptVisitorMethod:('visit' , aClass nameWithoutPrefix , ':') asSymbol
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
        in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
createCopyrightMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
    "add copyright method containing your/your companies
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
     copyright template but only if not already present.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
     this is only added, if specified in the 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
     COPYRIGHT_TEMPLATE_FILE resources."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
    |fn txt|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    (aClass includesSelector:#copyright) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
        fn := SystemBrowser classResources at:#'COPYRIGHT_TEMPLATE_FILE' default:nil.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
        fn notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
            fn := fn asFilename.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
            fn exists ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
                txt := fn contents asString
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
            ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
        txt notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
            txt := txt bindWith:(Date today year).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
            self compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
'copyright
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
' , txt , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
'             forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
              inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
createDocumentationMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
    "add documentation method containing doc template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
    |userName loginName hostName emailAddress|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
    (aClass includesSelector:#documentation) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
        userName := OperatingSystem getFullUserName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
        loginName := OperatingSystem getLoginName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
        hostName := OperatingSystem getHostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
        emailAddress := loginName , '@' , hostName.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
        self compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
'documentation
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
    documentation to be added.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    [author:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
        ' , userName 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
          , ' (' , emailAddress , ')' , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
    [instance variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
    [class variables:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
    [see also:]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
'             forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
              inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
createExamplesMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
    "add examples method containing examples template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
    |fragment|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
    (aClass includesSelector:#examples) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
        (aClass theNonMetaclass isSubclassOf:ApplicationModel) ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
            fragment := '  Starting the application:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
                                                                [exBegin]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
    ' , aClass theNonMetaclass name , ' open
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
        ] ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
            fragment := ''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
'examples
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
' , fragment , '
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
  more examples to be added:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
                                                                [exBegin]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
    ... add code fragment for 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
    ... executable example here ...
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
                                                                [exEnd]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
'                   
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
            inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
createInitialHistoryMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
    "add history method containing created-entry
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
     but only if not already present."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
    (aClass includesSelector:#history) ifFalse:[ 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
        HistoryManager notNil ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
            HistoryManager createInitialHistoryMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
        ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
createMultiSetterMethodFor:aCollectionOfVarNames in:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
    "create a multi-setter method for instvars."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
    |source|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
    source := ''.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
        source := source , (eachVar , ':' , eachVar , 'Arg ').
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
    source := source , Character cr.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
    source := source , ('    "set instance variables (automatically generated)"' , Character cr , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
    aCollectionOfVarNames do:[:eachVar |
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
        source := source , ('    ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr).
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
    self compile:source forClass:aClass inCategory:'accessing'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
3800
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   928
createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   929
    "add a subclassResponsibility method;
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   930
     but only if not already present."
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   931
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   932
    (aClass includesSelector:aSelector) ifFalse:[
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   933
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   934
        self compile:
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   935
(Method methodDefinitionTemplateForSelector:aSelector) ,
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   936
'
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   937
    "raise an error: must be redefined in concrete subclass(es)"
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   938
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   939
    ^ self subclassResponsibility
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   940
' 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   941
              forClass:aClass 
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   942
              inCategory:cat.
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   943
    ].
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   944
!
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
   945
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
createUpdateMethodIn:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
    "create an update:with:from:-method
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
     (I'm tired of typing)"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
    (aClass includesSelector:#'update:with:from:') ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
        self 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
            compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
'update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
    "Invoked when an object that I depend upon sends a change notification."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
    "stub code automatically generated - please change as required"
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
    "/ changedObject == someOfMyValueHolders ifTrue:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
    "/     self doSomethingApropriate
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
    "/     ^ self
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
    "/ ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
    super update:something with:aParameter from:changedObject
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
'
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
            forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
            inCategory:'change & update'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
    ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   968
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
createVersionMethodFor:aClass
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
    "add version method containing RCS template
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
     but only if not already present and its not a private class."
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   973
    aClass isPrivate ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   974
        (aClass includesSelector:#version) ifFalse:[
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   975
            self compile:
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   976
'version
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   977
    ^ ''$' , 'Header$''
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
' 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
                  forClass:aClass 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
                  inCategory:'documentation'.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
        ]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
!CodeGeneratorTool class methodsFor:'compilation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
canUseRefactoringSupport
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
     ^ RefactoryChangeManager notNil and:[RefactoryChangeManager isLoaded]
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
compile:theCode forClass:aClass inCategory:cat 
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
    |change|
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
    self canUseRefactoringSupport ifFalse:[
3716
cbaffbf250f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   995
        aClass compile:theCode classified:cat.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
        ^ self.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
    ].
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   998
3716
cbaffbf250f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   999
    change := InteractiveAddMethodChange compile:(theCode asString) in:aClass classified:cat.
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
    RefactoryChangeManager instance performChange:change.
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
! !
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
!CodeGeneratorTool class methodsFor:'documentation'!
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
version
3800
a5c75c369855 added generateSubclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 3719
diff changeset
  1006
    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.4 2002-08-15 11:09:05 cg Exp $'
3712
293c44b3c910 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
! !