989 listOfAllMethodCategoriesInClass:aClass |
989 listOfAllMethodCategoriesInClass:aClass |
990 "answer a list of all method categories of the argument, aClass" |
990 "answer a list of all method categories of the argument, aClass" |
991 |
991 |
992 |newList| |
992 |newList| |
993 |
993 |
994 newList := OrderedCollection new. |
994 newList := Set new. |
995 aClass methodArray do:[:aMethod | |
995 aClass methodArray do:[:aMethod | |
996 |cat| |
996 |cat| |
997 |
997 |
998 cat := aMethod category. |
998 cat := aMethod category. |
999 cat isNil ifTrue:[ |
999 cat isNil ifTrue:[ |
1000 cat := '* no category *' |
1000 cat := '* no category *' |
1001 ]. |
1001 ]. |
1002 (newList includes:cat) ifFalse:[newList add:cat] |
1002 newList add:cat |
1003 ]. |
1003 ]. |
1004 (newList size == 0) ifTrue:[^ nil]. |
1004 (newList size == 0) ifTrue:[^ nil]. |
1005 newList add:'* all *'. |
1005 newList add:'* all *'. |
1006 ^ newList sort |
1006 ^ newList asOrderedCollection sort |
1007 ! |
1007 ! |
1008 |
1008 |
1009 methodCategorySelection:lineNr |
1009 methodCategorySelection:lineNr |
1010 "user clicked on a method category line - show selectors" |
1010 "user clicked on a method category line - show selectors" |
1011 |
1011 |
1059 and all of its superclasses. |
1059 and all of its superclasses. |
1060 Used with fullProtocol browsing." |
1060 Used with fullProtocol browsing." |
1061 |
1061 |
1062 |newList| |
1062 |newList| |
1063 |
1063 |
1064 newList := OrderedCollection new. |
1064 newList := Set new. |
1065 self classesInFullProtocolHierarchy:aClass do:[:c | |
1065 self classesInFullProtocolHierarchy:aClass do:[:c | |
1066 |cat| |
1066 |cat| |
1067 |
1067 |
1068 c methodArray do:[:aMethod | |
1068 c methodArray do:[:aMethod | |
1069 cat := aMethod category. |
1069 cat := aMethod category. |
1070 cat isNil ifTrue:[ |
1070 cat isNil ifTrue:[ |
1071 cat := '* no category *' |
1071 cat := '* no category *' |
1072 ]. |
1072 ]. |
1073 (newList includes:cat) ifFalse:[newList add:cat] |
1073 newList add:cat |
1074 ] |
1074 ] |
1075 ]. |
1075 ]. |
1076 (newList size == 0) ifTrue:[^ nil]. |
1076 (newList size == 0) ifTrue:[^ nil]. |
1077 newList add:'* all *'. |
1077 newList add:'* all *'. |
1078 ^ newList sort |
1078 ^ newList asOrderedCollection sort |
1079 ! |
1079 ! |
1080 |
1080 |
1081 checkMethodCategorySelected |
1081 checkMethodCategorySelected |
1082 currentMethodCategory isNil ifTrue:[ |
1082 currentMethodCategory isNil ifTrue:[ |
1083 self warn:'select a method category first'. |
1083 self warn:'select a method category first'. |
1245 changedMethod isNil ifTrue:[ |
1245 changedMethod isNil ifTrue:[ |
1246 self warnLabel:'the method shown was removed'. |
1246 self warnLabel:'the method shown was removed'. |
1247 ^ self |
1247 ^ self |
1248 ]. |
1248 ]. |
1249 "compare the source codes" |
1249 "compare the source codes" |
1250 self warnLabel:'the code shown may not up to date'. |
1250 currentMethod notNil ifTrue:[ |
|
1251 changedMethod source = codeView contents ifFalse:[ |
|
1252 self warnLabel:'the code shown may not up to date'. |
|
1253 ] |
|
1254 ]. |
1251 ^ self |
1255 ^ self |
1252 ]. |
1256 ]. |
1253 ^ self |
1257 ^ self |
1254 ] |
1258 ] |
1255 ]. |
1259 ]. |
2021 ! |
2025 ! |
2022 |
2026 |
2023 listOfAllClassesInCategory:aCategory |
2027 listOfAllClassesInCategory:aCategory |
2024 "return a list of all classes in a given category" |
2028 "return a list of all classes in a given category" |
2025 |
2029 |
2026 |newList classList searchCategory string| |
2030 |newList classes searchCategory nm| |
2027 |
2031 |
2028 newList := OrderedCollection new. |
2032 (aCategory = '* hierarchy *') ifTrue:[ |
|
2033 newList := OrderedCollection new. |
|
2034 classes := Set new. |
|
2035 self classHierarchyDo:[:aClass :lvl| |
|
2036 nm := aClass name. |
|
2037 (classes includes:nm) ifFalse:[ |
|
2038 classes add:nm. |
|
2039 newList add:(String new:lvl) , nm |
|
2040 ] |
|
2041 ]. |
|
2042 ^ newList |
|
2043 ]. |
|
2044 |
|
2045 newList := Set new. |
|
2046 |
2029 (aCategory = '* all *') ifTrue:[ |
2047 (aCategory = '* all *') ifTrue:[ |
2030 Smalltalk allBehaviorsDo:[:aClass | |
2048 Smalltalk allBehaviorsDo:[:aClass | |
2031 string := aClass name. |
2049 newList add:aClass name |
2032 newList indexOf:string ifAbsent:[newList add:string] |
|
2033 ] |
2050 ] |
2034 ] ifFalse:[ |
2051 ] ifFalse:[ |
2035 (aCategory = '* hierarchy *') ifTrue:[ |
2052 (aCategory = '* no category *') ifTrue:[ |
2036 classList := OrderedCollection new. |
2053 searchCategory := nil |
2037 self classHierarchyDo:[:aClass :lvl| |
2054 ] ifFalse:[ |
2038 string := aClass name. |
2055 searchCategory := aCategory |
2039 classList indexOf:string ifAbsent:[ |
2056 ]. |
2040 classList add:string. |
2057 Smalltalk allBehaviorsDo:[:aClass | |
2041 newList add:(String new:lvl) , string |
2058 aClass isMeta ifFalse:[ |
|
2059 (aClass category = searchCategory) ifTrue:[ |
|
2060 newList add:aClass name |
2042 ] |
2061 ] |
2043 ]. |
|
2044 ^ newList |
|
2045 ] ifFalse:[ |
|
2046 (aCategory = '* no category *') ifTrue:[ |
|
2047 searchCategory := nil |
|
2048 ] ifFalse:[ |
|
2049 searchCategory := aCategory |
|
2050 ]. |
|
2051 Smalltalk allBehaviorsDo:[:aClass | |
|
2052 aClass isMeta ifFalse:[ |
|
2053 (aClass category = searchCategory) ifTrue:[ |
|
2054 string := aClass name. |
|
2055 newList indexOf:string ifAbsent:[newList add:string] |
|
2056 ] |
|
2057 ] |
|
2058 ] |
2062 ] |
2059 ] |
2063 ] |
2060 ]. |
2064 ]. |
2061 (newList size == 0) ifTrue:[^ nil]. |
2065 (newList size == 0) ifTrue:[^ nil]. |
2062 ^ newList sort |
2066 ^ newList asOrderedCollection sort |
2063 ! |
2067 ! |
2064 |
2068 |
2065 classSelection:lineNr |
2069 classSelection:lineNr |
2066 "user clicked on a class line - show method categories" |
2070 "user clicked on a class line - show method categories" |
2067 |
2071 |
2916 ! |
2920 ! |
2917 |
2921 |
2918 classLoad |
2922 classLoad |
2919 "load an autoloaded class" |
2923 "load an autoloaded class" |
2920 |
2924 |
|
2925 |nm| |
|
2926 |
2921 self checkClassSelected ifFalse:[^ self]. |
2927 self checkClassSelected ifFalse:[^ self]. |
|
2928 nm := currentClass name. |
|
2929 currentClass autoload. |
|
2930 self switchToClassNamed:nm |
|
2931 ! |
|
2932 |
|
2933 classUnload |
|
2934 "unload an autoloaded class" |
|
2935 |
|
2936 |nm| |
|
2937 |
|
2938 self checkClassSelected ifFalse:[^ self]. |
|
2939 nm := currentClass name. |
2922 currentClass unload. |
2940 currentClass unload. |
2923 self switchToClassNamed:currentClass name |
2941 self switchToClassNamed:nm |
2924 ! |
|
2925 |
|
2926 classUnload |
|
2927 "load an autoloaded class" |
|
2928 |
|
2929 self checkClassSelected ifFalse:[^ self]. |
|
2930 currentClass unload. |
|
2931 self switchToClassNamed:currentClass name |
|
2932 ! |
2942 ! |
2933 |
2943 |
2934 classProtocols |
2944 classProtocols |
2935 ^ self |
2945 ^ self |
2936 ! |
2946 ! |
3138 "answer a list of all method categories of the argument, aClass, |
3148 "answer a list of all method categories of the argument, aClass, |
3139 and all of its superclasses" |
3149 and all of its superclasses" |
3140 |
3150 |
3141 |newList cat| |
3151 |newList cat| |
3142 |
3152 |
3143 newList := OrderedCollection new. |
3153 newList := Set new. |
3144 self classesInHierarchy:aClass do:[:c | |
3154 self classesInHierarchy:aClass do:[:c | |
3145 c methodArray do:[:aMethod | |
3155 c methodArray do:[:aMethod | |
3146 cat := aMethod category. |
3156 cat := aMethod category. |
3147 cat isNil ifTrue:[ |
3157 cat isNil ifTrue:[ |
3148 cat := '* no category *' |
3158 cat := '* no category *' |
3149 ]. |
3159 ]. |
3150 (newList includes:cat) ifFalse:[newList add:cat] |
3160 newList add:cat |
3151 ] |
3161 ] |
3152 ]. |
3162 ]. |
3153 (newList size == 0) ifTrue:[^ nil]. |
3163 (newList size == 0) ifTrue:[^ nil]. |
3154 newList add:'* all *'. |
3164 newList add:'* all *'. |
3155 ^ newList sort |
3165 ^ newList asOrderedCollection sort |
3156 |
3166 |
3157 ! ! |
3167 ! ! |
3158 |
3168 |
3159 !BrowserView methodsFor:'class category stuff'! |
3169 !BrowserView methodsFor:'class category stuff'! |
3160 |
3170 |
3161 listOfAllClassCategories |
3171 listOfAllClassCategories |
3162 "return a list of all class categories" |
3172 "return a list of all class categories" |
3163 |
3173 |
3164 |newList cat| |
3174 |newList cat| |
3165 |
3175 |
3166 newList := OrderedCollection with:'* all *' with:'* hierarchy *'. |
3176 newList := Set with:'* all *' with:'* hierarchy *'. |
3167 Smalltalk allBehaviorsDo:[:aClass | |
3177 Smalltalk allBehaviorsDo:[:aClass | |
3168 cat := aClass category. |
3178 cat := aClass category. |
3169 cat isNil ifTrue:[ |
3179 cat isNil ifTrue:[ |
3170 cat := '* no category *' |
3180 cat := '* no category *' |
3171 ]. |
3181 ]. |
3172 newList indexOf:cat ifAbsent:[newList add:cat] |
3182 newList add:cat |
3173 ]. |
3183 ]. |
3174 ^ newList asArray sort. |
3184 ^ newList asOrderedCollection sort. |
3175 ! |
3185 ! |
3176 |
3186 |
3177 classCategorySelectionChanged |
3187 classCategorySelectionChanged |
3178 "class category has changed - update dependent views" |
3188 "class category has changed - update dependent views" |
3179 |
3189 |
3596 box := self enterBoxTitle:'name of new class category:' okText:'create'. |
3606 box := self enterBoxTitle:'name of new class category:' okText:'create'. |
3597 box action:[:aString | |
3607 box action:[:aString | |
3598 |categories| |
3608 |categories| |
3599 |
3609 |
3600 currentClass notNil ifTrue:[ |
3610 currentClass notNil ifTrue:[ |
3601 categories := OrderedCollection new. |
3611 categories := Set new. |
3602 currentClass withAllSuperclasses do:[:aClass | |
3612 currentClass withAllSuperclasses do:[:aClass | |
3603 aClass methodArray do:[:aMethod | |
3613 aClass methodArray do:[:aMethod | |
3604 (categories includes:aMethod category) ifFalse:[ |
3614 categories add:aMethod category |
3605 categories add:aMethod category |
|
3606 ] |
|
3607 ] |
3615 ] |
3608 ]. |
3616 ]. |
|
3617 categories := categories asOrderedCollection |
3609 ]. |
3618 ]. |
3610 categories isNil ifTrue:[ |
3619 categories isNil ifTrue:[ |
3611 categories := classCategoryListView list. |
3620 categories := classCategoryListView list. |
3612 ]. |
3621 ]. |
3613 (categories includes:aString) ifFalse:[ |
3622 (categories includes:aString) ifFalse:[ |