CustomManager.st
author Jakub Nesveda <jakubnesveda@seznam.cz>
Tue, 28 Oct 2014 09:39:46 +0100
changeset 711 605ab7fc9cd1
parent 506 b611cc119554
child 789 9349044a65e8
permissions -rw-r--r--
return whole source code when selected interval is empty retrieve selector from method when none selector is specified

"{ Package: 'jn:refactoring_custom' }"

Object subclass:#CustomManager
	instanceVariableNames:''
	classVariableNames:'Current'
	poolDictionaries:''
	category:'Interface-Refactoring-Custom'
!


!CustomManager class methodsFor:'initialization'!

initialize
    "Invoked at system start or when the class is dynamically loaded."

    Current := self new

    "/ please change as required (and remove this comment)

    "Modified: / 25-01-2014 / 14:54:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CustomManager class methodsFor:'instance creation'!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!CustomManager class methodsFor:'accessing'!

current
    ^ Current

    "Created: / 25-01-2014 / 14:55:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CustomManager methodsFor:'accessing'!

generatorsAndRefactorings
    "Returns all installed generators and refactorings"

    ^ OrderedCollection streamContents:[ :s |
        self generatorsAndRefactoringsDo: [ :each |
            s nextPut: each .
        ]  
    ]

    "Created: / 25-01-2014 / 15:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generatorsAndRefactoringsForContext: aCustomContext
    "Returns all installed generators and refactorings"

    ^ OrderedCollection streamContents:[ :s |
        self generatorsAndRefactoringsForContext: aCustomContext do: [ :each |
            s nextPut: each .
        ]  
    ]

    "Created: / 25-01-2014 / 15:06:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generatorsAndRefactoringsForPerspective: aCustomPerspective
    "Returns all installed generators and refactorings"

    ^ OrderedCollection streamContents:[ :s |
        self generatorsAndRefactoringsForPerspective: aCustomPerspective do: [ :each |
            s nextPut: each .
        ]  
    ]

    "Created: / 26-01-2014 / 13:18:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 26-01-2014 / 23:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CustomManager methodsFor:'enumerating'!

generatorsAndRefactoringsDo: aBlock
    "Evaluates a block on all installed generator and refactoring classes.
     NOTE: the block gets the generator/refactoring class. not an instance."

    CustomCodeGeneratorOrRefactoring allSubclassesDo:[ :each |
        each isAbstract ifFalse:[
            aBlock value: each 
        ].
    ]

    "Created: / 25-01-2014 / 15:01:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 26-01-2014 / 13:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generatorsAndRefactoringsForContext: aCustomContext do: aBlock

    self generatorsAndRefactoringsDo: [ :each |
        (each availableInContext: aCustomContext) ifTrue:[ 
            aBlock value: each 
        ].
    ]

    "Created: / 25-01-2014 / 15:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generatorsAndRefactoringsForPerspective: aCustomPerspective do: aBlock

    self generatorsAndRefactoringsDo: [ :each |
        (each availableInPerspective: aCustomPerspective) ifTrue:[ 
            aBlock value: each 
        ].
    ]

    "Created: / 26-01-2014 / 13:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CustomManager class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !


CustomManager initialize!