3298 !BrowserView methodsFor:'class-method stuff'! |
3298 !BrowserView methodsFor:'class-method stuff'! |
3299 |
3299 |
3300 classFromClassMethodString:aString |
3300 classFromClassMethodString:aString |
3301 "helper for classMethod-list - extract class name from the string" |
3301 "helper for classMethod-list - extract class name from the string" |
3302 |
3302 |
3303 |pos| |
3303 |pos words s| |
3304 |
3304 |
3305 pos := aString lastIndexOf:(Character space). |
3305 (aString endsWith:')') ifTrue:[ |
3306 ^ aString copyTo:(pos - 1) |
3306 s := aString copyTo:(aString lastIndexOf:$()-1. |
|
3307 s := s withoutSpaces. |
|
3308 ] ifFalse:[ |
|
3309 s := aString |
|
3310 ]. |
|
3311 pos := s lastIndexOf:(Character space). |
|
3312 ^ s copyTo:(pos - 1) |
3307 |
3313 |
3308 "Modified: 17.6.1996 / 17:06:59 / stefan" |
3314 "Modified: 17.6.1996 / 17:06:59 / stefan" |
|
3315 "Modified: 15.7.1996 / 11:33:37 / cg" |
3309 ! |
3316 ! |
3310 |
3317 |
3311 classMethodSelection:lineNr |
3318 classMethodSelection:lineNr |
3312 "user clicked on a class/method line - show code" |
3319 "user clicked on a class/method line - show code" |
3313 |
3320 |
3314 |cls string classString selectorString meta| |
3321 |cls string classString selectorString meta| |
3315 |
3322 |
3316 string := classMethodListView selectionValue. |
3323 string := classMethodListView selectionValue string. |
3317 classString := self classFromClassMethodString:string. |
3324 classString := self classFromClassMethodString:string. |
3318 selectorString := self selectorFromClassMethodString:string. |
3325 selectorString := self selectorFromClassMethodString:string. |
|
3326 |
3319 ((classString ~= 'Metaclass') and:[classString endsWith:' class']) ifTrue:[ |
3327 ((classString ~= 'Metaclass') and:[classString endsWith:' class']) ifTrue:[ |
3320 classString := classString copyWithoutLast:6 "copyTo:(classString size - 5)". |
3328 classString := classString copyWithoutLast:6 "copyTo:(classString size - 5)". |
3321 meta := true. |
3329 meta := true. |
3322 ] ifFalse:[ |
3330 ] ifFalse:[ |
3323 meta := false. |
3331 meta := false. |
3343 |
3351 |
3344 self setDoitActionForClass |
3352 self setDoitActionForClass |
3345 |
3353 |
3346 "Modified: 31.8.1995 / 11:56:02 / claus" |
3354 "Modified: 31.8.1995 / 11:56:02 / claus" |
3347 "Modified: 17.6.1996 / 16:51:28 / stefan" |
3355 "Modified: 17.6.1996 / 16:51:28 / stefan" |
|
3356 "Modified: 15.7.1996 / 11:44:38 / cg" |
3348 ! |
3357 ! |
3349 |
3358 |
3350 selectorFromClassMethodString:aString |
3359 selectorFromClassMethodString:aString |
3351 "helper for classMethod-list - extract selector from the string" |
3360 "helper for classMethod-list - extract selector from the string" |
3352 |
3361 |
3353 |pos| |
3362 |pos s| |
3354 |
3363 |
3355 pos := aString lastIndexOf:(Character space). |
3364 (aString endsWith:')') ifTrue:[ |
3356 ^ aString copyFrom:(pos + 1) |
3365 s := aString copyTo:(aString lastIndexOf:$()-1. |
|
3366 s := s withoutSpaces. |
|
3367 ] ifFalse:[ |
|
3368 s := aString |
|
3369 ]. |
|
3370 pos := s lastIndexOf:(Character space). |
|
3371 ^ s copyFrom:(pos + 1) |
3357 |
3372 |
3358 "Modified: 17.6.1996 / 17:04:38 / stefan" |
3373 "Modified: 17.6.1996 / 17:04:38 / stefan" |
|
3374 "Modified: 15.7.1996 / 11:33:41 / cg" |
3359 ! ! |
3375 ! ! |
3360 |
3376 |
3361 !BrowserView methodsFor:'event handling'! |
3377 !BrowserView methodsFor:'event handling'! |
3362 |
3378 |
3363 handlesKeyPress:key inView:view |
3379 handlesKeyPress:key inView:view |
4908 self checkMethodSelected ifFalse:[^ self]. |
4924 self checkMethodSelected ifFalse:[^ self]. |
4909 currentMethod inspect. |
4925 currentMethod inspect. |
4910 "/ (actualClass compiledMethodAt:currentSelector) inspect. |
4926 "/ (actualClass compiledMethodAt:currentSelector) inspect. |
4911 |
4927 |
4912 "Modified: 4.6.1996 / 22:47:27 / cg" |
4928 "Modified: 4.6.1996 / 22:47:27 / cg" |
4913 ! ! |
4929 ! |
4914 |
|
4915 !BrowserView ignoredMethodsFor:'method list menu'! |
|
4916 |
|
4917 methodLocalAproposSearch |
|
4918 "launch an enterBox for a local keyword search" |
|
4919 |
|
4920 self askForSelectorTitle:'keyword to search for:' |
|
4921 openWith:#aproposSearch:in: |
|
4922 and:(currentClass withAllSubclasses) |
|
4923 ! |
|
4924 |
|
4925 methodLocalImplementors |
|
4926 "launch an enterBox for selector to search for" |
|
4927 |
|
4928 self checkClassSelected ifFalse:[^ self]. |
|
4929 self askForSelectorTitle:'selector to browse local implementors of:' |
|
4930 openWith:#browseImplementorsOf:under: |
|
4931 and:currentClass |
|
4932 ! |
|
4933 |
|
4934 methodLocalSenders |
|
4935 "launch an enterBox for selector to search for in current class & subclasses" |
|
4936 |
|
4937 self checkClassSelected ifFalse:[^ self]. |
|
4938 self askForSelectorTitle:'selector to browse local senders of:' |
|
4939 openWith:#browseCallsOn:under: |
|
4940 and:currentClass |
|
4941 ! |
|
4942 |
|
4943 methodLocalStringSearch |
|
4944 "launch an enterBox for string to search for" |
|
4945 |
|
4946 self checkClassSelected ifFalse:[^ self]. |
|
4947 self askForSelectorTitle:'string to search for in local methods:' |
|
4948 openWith:#browseForString:in: |
|
4949 and:(currentClass withAllSubclasses) |
|
4950 ! ! |
|
4951 |
|
4952 !BrowserView methodsFor:'method list menu'! |
|
4953 |
4930 |
4954 methodLocalSuperSends |
4931 methodLocalSuperSends |
4955 "launch a browser showing super sends in current class & subclasses" |
4932 "launch a browser showing super sends in current class & subclasses" |
4956 |
4933 |
4957 self checkClassSelected ifFalse:[^ self]. |
4934 self checkClassSelected ifFalse:[^ self]. |
5888 |
5865 |
5889 switchToMethodNamed:matchString |
5866 switchToMethodNamed:matchString |
5890 "switch (in the current class) to a method named matchString. |
5867 "switch (in the current class) to a method named matchString. |
5891 If there are more than one matches, switch to the first." |
5868 If there are more than one matches, switch to the first." |
5892 |
5869 |
5893 |aSelector method cat classToSearch dict| |
5870 |aSelector method cat classToSearch dict m idx| |
5894 |
5871 |
5895 currentClass notNil ifTrue:[ |
5872 currentClass notNil ifTrue:[ |
5896 classToSearch := actualClass. |
5873 classToSearch := actualClass. |
5897 dict := classToSearch methodDictionary. |
5874 dict := classToSearch methodDictionary. |
5898 |
5875 |
5914 self updateMethodCategoryListWithScroll:false. |
5891 self updateMethodCategoryListWithScroll:false. |
5915 self methodCategorySelectionChanged. |
5892 self methodCategorySelectionChanged. |
5916 |
5893 |
5917 currentMethod := method. |
5894 currentMethod := method. |
5918 currentSelector := aSelector. |
5895 currentSelector := aSelector. |
5919 methodListView setSelectElement:aSelector. |
5896 |
|
5897 m := aSelector , '*(*)'. |
|
5898 idx := methodListView list findFirst:[:line | |
|
5899 line = aSelector |
|
5900 or:[m match:line]]. |
|
5901 |
|
5902 methodListView setSelection:idx. "/ setSelectElement:aSelector. |
5920 self methodSelectionChanged. |
5903 self methodSelectionChanged. |
5921 ^ self |
5904 ^ self |
5922 ] |
5905 ] |
5923 ]. |
5906 ]. |
5924 self beep. |
5907 self beep. |
5925 |
5908 |
5926 "Modified: 28.5.1996 / 16:54:49 / cg" |
|
5927 "Modified: 28.6.1996 / 20:28:56 / stefan" |
5909 "Modified: 28.6.1996 / 20:28:56 / stefan" |
|
5910 "Modified: 15.7.1996 / 11:44:11 / cg" |
5928 ! |
5911 ! |
5929 |
5912 |
5930 updateMethodList |
5913 updateMethodList |
5931 self updateMethodListWithScroll:true keepSelection:false |
5914 self updateMethodListWithScroll:true keepSelection:false |
5932 ! |
5915 ! |
6241 ] |
6224 ] |
6242 ] |
6225 ] |
6243 |
6226 |
6244 "Created: 10.7.1996 / 10:31:29 / cg" |
6227 "Created: 10.7.1996 / 10:31:29 / cg" |
6245 "Modified: 10.7.1996 / 12:50:25 / cg" |
6228 "Modified: 10.7.1996 / 12:50:25 / cg" |
6246 ! ! |
6229 ! |
6247 |
|
6248 !BrowserView ignoredMethodsFor:'private'! |
|
6249 |
|
6250 askForSelectorTitle:title |
|
6251 "convenient method: setup enterBox with text from codeView or selected |
|
6252 method for browsing based on a selector. Set action and launch box" |
|
6253 |
|
6254 |box grp panel retVal selectorHolder where b| |
|
6255 |
|
6256 selectorHolder := (self selectorToSearchFor) asValue. |
|
6257 |
|
6258 box := Dialog new. |
|
6259 (box addTextLabel:title) adjust:#left. |
|
6260 |
|
6261 box addInputFieldOn:(selectorHolder) tabable:true. |
|
6262 |
|
6263 (box addTextLabel:'search in:') adjust:#left. |
|
6264 |
|
6265 panel := HorizontalPanelView new. |
|
6266 panel horizontalLayout:#fitSpace. |
|
6267 |
|
6268 grp := RadioButtonGroup new. |
|
6269 b := RadioButton label:'everywhere' action:[where := #everywhere]. |
|
6270 panel add:b. grp add:b. |
|
6271 box makeTabable:b. |
|
6272 |
|
6273 b := RadioButton label:'class category' action:[where := #classcategory.]. |
|
6274 panel add:b. grp add:b. |
|
6275 box makeTabable:b. |
|
6276 |
|
6277 b := RadioButton label:'class' action:[where := #class.]. |
|
6278 panel add:b.grp add:b. |
|
6279 box makeTabable:b. |
|
6280 |
|
6281 b := RadioButton label:'class & subclasses' action:[where := #classhierarchy.]. |
|
6282 panel add:b. grp add:b. |
|
6283 box makeTabable:b. |
|
6284 |
|
6285 grp value:1. |
|
6286 |
|
6287 box addComponent:panel indent:0. "/ panel has its own idea of indenting |
|
6288 |
|
6289 box addAbortButton. |
|
6290 box addOkButton. |
|
6291 |
|
6292 box open. |
|
6293 |
|
6294 |
|
6295 box := self enterBoxTitle:title okText:'browse'. |
|
6296 box initialText:(self selectorToSearchFor). |
|
6297 box action:[:aString | aString notEmpty ifTrue:[retVal := aString]]. |
|
6298 box showAtPointer. |
|
6299 ^ retVal |
|
6300 |
|
6301 "Modified: 10.7.1996 / 10:13:28 / cg" |
|
6302 ! |
|
6303 |
|
6304 askForSelectorTitle:title openWith:selector |
|
6305 "convenient method: setup enterBox with text from codeView or selected |
|
6306 method for browsing based on a selector. Set action and launch box" |
|
6307 |
|
6308 |string| |
|
6309 |
|
6310 string := self askForSelectorTitle:title. |
|
6311 string notNil ifTrue:[ |
|
6312 self withSearchCursorDo:[ |
|
6313 SystemBrowser perform:selector with:string |
|
6314 ] |
|
6315 ]. |
|
6316 |
|
6317 "Created: 23.11.1995 / 14:11:34 / cg" |
|
6318 ! |
|
6319 |
|
6320 askForSelectorTitle:title openWith:selector and:arg |
|
6321 "convenient method: setup enterBox with text from codeView or selected |
|
6322 method for browsing based on a selector. Set action and launch box" |
|
6323 |
|
6324 |string| |
|
6325 |
|
6326 string := self askForSelectorTitle:title. |
|
6327 string notNil ifTrue:[ |
|
6328 self withSearchCursorDo:[ |
|
6329 SystemBrowser perform:selector with:string with:arg |
|
6330 ] |
|
6331 ]. |
|
6332 |
|
6333 "Created: 23.11.1995 / 14:11:38 / cg" |
|
6334 ! ! |
|
6335 |
|
6336 !BrowserView methodsFor:'private'! |
|
6337 |
6230 |
6338 busyLabel:what with:someArgument |
6231 busyLabel:what with:someArgument |
6339 "set the title for some warning" |
6232 "set the title for some warning" |
6340 |
6233 |
6341 self label:('System Browser - ' , (resources string:what with:someArgument)) |
6234 self label:('System Browser - ' , (resources string:what with:someArgument)) |