Tools__FullMethodCategoryList.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Jan 2020 21:02:47 +0100
changeset 19422 c6ca1c3e0fd7
parent 10038 0e8e88c0e51c
child 12123 4bde08cebd48
permissions -rw-r--r--
#REFACTORING by exept class: MultiViewToolApplication added: #askForFile:default:forSave:thenDo: changed: #askForFile:default:thenDo: #askForFile:thenDo: #menuSaveAllAs #menuSaveAs

"
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
 Copyright (c) 2009-2010 eXept Software AG

 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
 files (the 'Software'), to deal in the Software without
 restriction, including without limitation the rights to use,
 copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following
 conditions:

 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

MethodCategoryList subclass:#FullMethodCategoryList
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Browsers-New'
!

!FullMethodCategoryList class methodsFor:'documentation'!

copyright
"
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
 Copyright (c) 2009-2010 eXept Software AG

 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
 files (the 'Software'), to deal in the Software without
 restriction, including without limitation the rights to use,
 copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following
 conditions:

 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
"
!

documentation
"
    embeddable application displaying the classes as listed by
    the inputGenerator.
    Provides an outputGenerator, which enumerates the classes and
    their protocols (method-categories) in the selected classes.

    [author:]
	Claus Gittinger (cg@exept.de)
"


! !

!FullMethodCategoryList methodsFor:'generators'!

makeGenerator
    "return a generator which enumerates the methods from the selected protocol;
     that generator generates 4-element elements (includes the class and protocol), 
     in order to make the consumers only depend on one input 
     (i.e. to pass multiple-class and multiple-protocol info
      without a need for another classHolder/protocolHolder in the methodList)."

    ^ Iterator on:[:whatToDo |
                        |protocols all packages theProtocol|

                        protocols := self selectedProtocols value ? #().

                        all := protocols includes:(self class nameListEntryForALL).
                        packages := packageFilter value value.

                        protocols size > 0 ifTrue:[
                            protocols size == 1 ifTrue:[
                                theProtocol := protocols first.
                                Smalltalk allClassesDo:[:eachClass |
                                    eachClass instAndClassSelectorsAndMethodsDo:[:sel :eachMethod |
                                        |cat|

                                        cat := eachMethod category.
                                        (all 
                                        or:[theProtocol = cat]) ifTrue:[
                                            (packages isNil
                                            or:[packages includes:eachMethod package])
                                            ifTrue:[
                                                whatToDo value:eachClass value:cat value:sel value:eachMethod.
                                            ].
                                        ].
                                    ].
                                ]
                            ] ifFalse:[
                                Smalltalk allClassesDo:[:eachClass |
                                    eachClass instAndClassSelectorsAndMethodsDo:[:sel :eachMethod |
                                        |cat|

                                        cat := eachMethod category.
                                        (all 
                                        or:[protocols includes:cat]) ifTrue:[
                                            (packages isNil
                                            or:[packages includes:eachMethod package])
                                            ifTrue:[
                                                whatToDo value:eachClass value:cat value:sel value:eachMethod.
                                            ].
                                        ].
                                    ].
                                ]
                            ]
                        ]
                  ]
! !

!FullMethodCategoryList methodsFor:'private'!

listOfMethodCategories
    |categories|

    categories := Set new.

    categories addAll:MethodCategoryCache new allMethodCategories.    

    categories := categories asOrderedCollection sort.
    categories addFirst:(self class nameListEntryForALL).
    ^ categories
! !

!FullMethodCategoryList class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__FullMethodCategoryList.st,v 1.3 2011-07-03 13:36:22 cg Exp $'
!

version_SVN
    ^ '§Id: Tools__FullMethodCategoryList.st 7796 2011-06-23 16:01:32Z vranyj1 §'
! !