Tools_FullMethodCategoryList.st
changeset 5591 273637686948
child 5592 d9730a8d7c52
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tools_FullMethodCategoryList.st	Thu Feb 26 19:57:02 2004 +0100
@@ -0,0 +1,106 @@
+"{ Package: 'stx:__NoProject__' }"
+
+"{ NameSpace: Tools }"
+
+MethodCategoryList subclass:#FullMethodCategoryList
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Browsers-New'
+!
+
+!FullMethodCategoryList class methodsFor:'documentation'!
+
+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:eachMethod mclass 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:eachMethod mclass value:cat value:sel value:eachMethod.
+					    ].
+					].
+				    ].
+				]
+			    ]
+			]
+		  ]
+! !
+
+!FullMethodCategoryList methodsFor:'private'!
+
+listOfMethodCategories
+    |categories|
+
+    categories := Set new.
+
+    "return all existing categories"
+    Method allInstancesDo:[:eachMethod |
+	categories add:eachMethod category    
+    ].
+    categories := categories asOrderedCollection sort.
+    categories addFirst:(self class nameListEntryForALL).
+    ^ categories
+
+
+! !
+
+!FullMethodCategoryList class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_FullMethodCategoryList.st,v 1.1 2004-02-26 18:56:25 cg Exp $'
+! !