ClassInitializeChange.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Aug 2018 10:11:25 +0200
changeset 4346 6604af2f1554
parent 3681 026411d4acce
child 3850 461c0b054a4f
child 4432 6d0966d3ccf2
permissions -rw-r--r--
#OTHER by cg class: FileBasedSourceCodeManager class removed: #version_FileRepository

"{ Package: 'stx:libbasic3' }"

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?) exists' bindWith: self fullClassName).
        ^ self.
    ].
    class initialize.

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

!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: /cvs/stx/stx/libbasic3/ClassInitializeChange.st,v 1.3 2014-12-11 20:47:09 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic3/ClassInitializeChange.st,v 1.3 2014-12-11 20:47:09 cg Exp $'
! !