ClassInitializeChange.st
changeset 3522 1f72f0fbdcf8
child 3532 2491adb43cf2
equal deleted inserted replaced
3521:6e43c118d860 3522:1f72f0fbdcf8
       
     1 "{ Package: 'stx:libbasic3' }"
       
     2 
       
     3 ClassChange subclass:#ClassInitializeChange
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'System-Changes'
       
     8 !
       
     9 
       
    10 !ClassInitializeChange class methodsFor:'documentation'!
       
    11 
       
    12 documentation
       
    13 "
       
    14     Change for class initialization chunk. Unlike DoItChange, 
       
    15     ClassInitializeChange handles namespaces and private classes
       
    16     properly.
       
    17 
       
    18     [author:]
       
    19         Jan Vrany <jan.vrany@fit.cvut.cz>
       
    20 
       
    21     [instance variables:]
       
    22 
       
    23     [class variables:]
       
    24 
       
    25     [see also:]
       
    26 
       
    27 "
       
    28 ! !
       
    29 
       
    30 !ClassInitializeChange methodsFor:'accessing'!
       
    31 
       
    32 source
       
    33     "return the source of the change"
       
    34 
       
    35     source isNil ifTrue:[
       
    36         ^ String streamContents:[ :s | 
       
    37             (nameSpaceName notNil and:[ nameSpaceName ~= 'Smalltalk' ]) ifTrue:[ 
       
    38                 s nextPutAll: '"{ NameSpace: '; nextPutAll: nameSpaceName; nextPutAll: ' }"'; cr; cr.
       
    39                 s nextPutAll: self className; nextPutAll: ' initialize!!'; cr.   
       
    40             ].
       
    41         ]
       
    42     ].
       
    43     ^ source
       
    44 
       
    45     "Created: / 21-03-2014 / 17:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    46 ! !
       
    47 
       
    48 !ClassInitializeChange methodsFor:'applying'!
       
    49 
       
    50 apply
       
    51     "apply the change"
       
    52 
       
    53     | class |
       
    54 
       
    55     class := self changeClass.
       
    56     class isNil ifTrue:[ 
       
    57         self error:('Class %1 does not (yet?) exists' bindWith: self fullClassName).
       
    58         ^ self.
       
    59     ].
       
    60     class initialize.
       
    61 
       
    62     "Created: / 21-03-2014 / 17:38:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    63 ! !
       
    64 
       
    65 !ClassInitializeChange class methodsFor:'documentation'!
       
    66 
       
    67 version
       
    68     ^ '$Header: /cvs/stx/stx/libbasic3/ClassInitializeChange.st,v 1.1 2014-03-21 18:32:07 vrany Exp $'
       
    69 !
       
    70 
       
    71 version_CVS
       
    72     ^ '$Header: /cvs/stx/stx/libbasic3/ClassInitializeChange.st,v 1.1 2014-03-21 18:32:07 vrany Exp $'
       
    73 ! !
       
    74