ClassInitializeChange.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 15:23:29 +0200
changeset 4456 df14ee79655a
parent 4432 6d0966d3ccf2
permissions -rw-r--r--
#TUNING by exept class: SourceCodeManagerUtilities changed: #validateConsistencyOfPackage:doClasses:doExtensions:

"{ Encoding: utf8 }"

"{ Package: 'stx:libbasic3' }"

"{ NameSpace: Smalltalk }"

ClassChange subclass:#ClassInitializeChange
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'System-Changes'
!

!ClassInitializeChange class methodsFor:'documentation'!

documentation
"
    Change for class initialization chunk. Unlike DoItChange, 
    ClassInitializeChange handles namespaces and private classes
    properly.

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!ClassInitializeChange methodsFor:'accessing'!

source
    "return the source of the change"

    source isNil ifTrue:[
        ^ String streamContents:[ :s | 
            (nameSpaceName notNil and:[ nameSpaceName ~= 'Smalltalk' ]) ifTrue:[ 
                s nextPutAll: '"{ NameSpace: '; nextPutAll: nameSpaceName; nextPutAll: ' }"'; cr; cr.
                s nextPutAll: self className; nextPutAll: ' initialize!!'; cr.   
            ].
        ]
    ].
    ^ source

    "Created: / 21-03-2014 / 17:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ClassInitializeChange methodsFor:'applying'!

apply
    "apply the change"

    | class |

    class := self changeClass.
    class isNil ifTrue:[ 
        self error:('Class %1 does not (yet?) exist' bindWith: self fullClassName).
        ^ self.
    ].
    class initialize.

    "Created: / 21-03-2014 / 17:38:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 28-05-2019 / 07:34:43 / Claus Gittinger"
! !

!ClassInitializeChange methodsFor:'comparing'!

sameAs:changeB
    "return true, if the given change represents the same change as the receiver."

    ^ (changeB isKindOf: self class) 
        and:[ self fullClassName  = changeB fullClassName ]

    "Created: / 26-03-2014 / 17:41:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ClassInitializeChange methodsFor:'printing & storing'!

printOn:aStream
    aStream nextPutAll:self source
! !

!ClassInitializeChange methodsFor:'testing'!

isClassInitializeChange
    ^ true
! !

!ClassInitializeChange class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !