347 |
347 |
348 (changedObject isMethod) ifTrue:[ |
348 (changedObject isMethod) ifTrue:[ |
349 ] |
349 ] |
350 |
350 |
351 "Created: 4.1.1997 / 13:54:00 / cg" |
351 "Created: 4.1.1997 / 13:54:00 / cg" |
352 "Modified: 8.1.1997 / 23:20:44 / cg" |
352 "Modified: 3.3.1997 / 15:04:21 / cg" |
353 ! |
353 ! |
354 |
354 |
355 refetchClass |
355 refetchClass |
356 "after a class definition change in another browser, |
356 "after a class definition change in another browser, |
357 this is sent to update (otherwise, we'd still refer to the obsolete class)" |
357 this is sent to update (otherwise, we'd still refer to the obsolete class)" |
4430 self withWaitCursorDo:[ |
4430 self withWaitCursorDo:[ |
4431 list := classMethodListView list. |
4431 list := classMethodListView list. |
4432 list do:[:line | |
4432 list do:[:line | |
4433 self busyLabel:'writing: ' with:line. |
4433 self busyLabel:'writing: ' with:line. |
4434 |
4434 |
4435 classString := self classFromClassMethodString:line. |
4435 classString := self classNameFromClassMethodString:line. |
4436 selectorString := self selectorFromClassMethodString:line. |
4436 selectorString := self selectorFromClassMethodString:line. |
4437 |
4437 |
4438 cls := self findClassNamed:classString. |
4438 cls := self findClassNamed:classString. |
4439 cls isNil ifTrue:[ |
4439 cls isNil ifTrue:[ |
4440 self warn:'oops class %1 is gone' with:classString |
4440 self warn:'oops class %1 is gone' with:classString |
4464 self normalLabel. |
4464 self normalLabel. |
4465 ] |
4465 ] |
4466 ] |
4466 ] |
4467 |
4467 |
4468 "Modified: 17.6.1996 / 16:51:11 / stefan" |
4468 "Modified: 17.6.1996 / 16:51:11 / stefan" |
4469 "Modified: 7.1.1997 / 23:02:28 / cg" |
4469 "Modified: 3.3.1997 / 15:11:20 / cg" |
4470 ! |
4470 ! |
4471 |
4471 |
4472 classMethodMenu |
4472 classMethodMenu |
4473 <resource: #keyboard ( #Cmds #Cmdi #Cmdg ) > |
4473 <resource: #keyboard ( #Cmds #Cmdi #Cmdg ) > |
4474 |
4474 |
4475 |labels selectors shorties| |
4475 |labels selectors shorties specialMenu| |
|
4476 |
|
4477 (currentMethod notNil |
|
4478 and:[currentMethod isWrapped]) ifTrue:[ |
|
4479 labels := #( |
|
4480 'inspect method' |
|
4481 '-' |
|
4482 'remove break/trace' |
|
4483 ). |
|
4484 |
|
4485 selectors := #( |
|
4486 methodInspect |
|
4487 nil |
|
4488 methodRemoveBreakOrTrace |
|
4489 ). |
|
4490 ] ifFalse:[ |
|
4491 labels := #( |
|
4492 'inspect method' |
|
4493 '-' |
|
4494 'breakpoint' |
|
4495 'breakpoint in ...' |
|
4496 '-' |
|
4497 'trace' |
|
4498 'trace sender' |
|
4499 'trace full walkback' |
|
4500 '-' |
|
4501 'start timing' |
|
4502 'start counting' |
|
4503 'start mem usage' |
|
4504 ). |
|
4505 |
|
4506 selectors := #( |
|
4507 methodInspect |
|
4508 nil |
|
4509 methodBreakPoint |
|
4510 methodBreakPointInProcess |
|
4511 nil |
|
4512 methodTrace |
|
4513 methodTraceSender |
|
4514 methodTraceFull |
|
4515 nil |
|
4516 methodStartTiming |
|
4517 methodStartCounting |
|
4518 methodStartMemoryUsage |
|
4519 ). |
|
4520 ]. |
|
4521 specialMenu := PopUpMenu |
|
4522 labels:(resources array:labels) |
|
4523 selectors:selectors. |
|
4524 |
|
4525 device ctrlDown ifTrue:[ |
|
4526 currentMethod isNil ifTrue:[ |
|
4527 classMethodListView flash. |
|
4528 ^ nil |
|
4529 ]. |
|
4530 |
|
4531 ^ specialMenu |
|
4532 ]. |
4476 |
4533 |
4477 labels := #( |
4534 labels := #( |
4478 'fileOut' |
4535 'fileOut' |
4479 'fileOut all' |
4536 'fileOut all' |
4480 'printOut' |
4537 'printOut' |
4543 ^ PopUpMenu |
4600 ^ PopUpMenu |
4544 labels:(resources array:labels) |
4601 labels:(resources array:labels) |
4545 selectors:selectors |
4602 selectors:selectors |
4546 accelerators:shorties |
4603 accelerators:shorties |
4547 |
4604 |
4548 "Modified: 10.7.1996 / 12:46:07 / cg" |
4605 "Modified: 3.3.1997 / 14:53:36 / cg" |
4549 ! ! |
4606 ! ! |
4550 |
4607 |
4551 !BrowserView methodsFor:'class-method stuff'! |
4608 !BrowserView methodsFor:'class-method stuff'! |
4552 |
4609 |
4553 classFromClassMethodString:aString |
4610 classFromClassMethodString:aString |
4554 "helper for classMethod-list - extract class name from the string" |
4611 "helper for classMethod-list - extract class name from the string" |
4555 |
4612 |
4556 |pos s| |
4613 |classString| |
4557 |
4614 |
4558 s := aString string withoutSpaces. |
4615 classString := self classNameFromClassMethodString:aString. |
4559 (s endsWith:' !!') ifTrue:[ |
4616 ^ self findClassNamed:classString. |
4560 s := s copyWithoutLast:2 |
4617 |
4561 ]. |
4618 "Created: 3.3.1997 / 15:12:59 / cg" |
4562 (s endsWith:')') ifTrue:[ |
|
4563 s := aString copyTo:(aString lastIndexOf:$()-1. |
|
4564 s := s withoutSpaces. |
|
4565 ]. |
|
4566 (s endsWith:' !!') ifTrue:[ |
|
4567 s := s copyWithoutLast:2 |
|
4568 ]. |
|
4569 pos := s lastIndexOf:(Character space). |
|
4570 ^ s copyTo:(pos - 1) |
|
4571 |
|
4572 "Modified: 17.6.1996 / 17:06:59 / stefan" |
|
4573 "Modified: 4.11.1996 / 23:56:52 / cg" |
|
4574 ! |
4619 ! |
4575 |
4620 |
4576 classMethodSelection:lineNr |
4621 classMethodSelection:lineNr |
4577 "user clicked on a class/method line - show code" |
4622 "user clicked on a class/method line - show code" |
4578 |
4623 |
4579 |cls string classString selectorString meta| |
4624 |cls string classString selectorString meta| |
4580 |
4625 |
4581 string := classMethodListView selectionValue string. |
4626 string := classMethodListView selectionValue string. |
4582 classString := self classFromClassMethodString:string. |
4627 classString := self classNameFromClassMethodString:string. |
4583 selectorString := self selectorFromClassMethodString:string. |
4628 selectorString := self selectorFromClassMethodString:string. |
4584 |
4629 |
4585 ((classString ~= 'Metaclass') and:[classString endsWith:' class']) ifTrue:[ |
4630 ((classString ~= 'Metaclass') and:[classString endsWith:' class']) ifTrue:[ |
4586 classString := classString copyWithoutLast:6 "copyTo:(classString size - 5)". |
4631 classString := classString copyWithoutLast:6 "copyTo:(classString size - 5)". |
4587 meta := true. |
4632 meta := true. |
4609 |
4654 |
4610 self setDoitActionForClass |
4655 self setDoitActionForClass |
4611 |
4656 |
4612 "Modified: 31.8.1995 / 11:56:02 / claus" |
4657 "Modified: 31.8.1995 / 11:56:02 / claus" |
4613 "Modified: 17.6.1996 / 16:51:28 / stefan" |
4658 "Modified: 17.6.1996 / 16:51:28 / stefan" |
4614 "Modified: 20.12.1996 / 15:40:29 / cg" |
4659 "Modified: 3.3.1997 / 15:11:44 / cg" |
|
4660 ! |
|
4661 |
|
4662 classNameFromClassMethodString:aString |
|
4663 "helper for classMethod-list - extract class name from the string" |
|
4664 |
|
4665 |pos s| |
|
4666 |
|
4667 s := aString string withoutSpaces. |
|
4668 (s endsWith:' !!') ifTrue:[ |
|
4669 s := s copyWithoutLast:2 |
|
4670 ]. |
|
4671 (s endsWith:')') ifTrue:[ |
|
4672 s := aString copyTo:(aString lastIndexOf:$()-1. |
|
4673 s := s withoutSpaces. |
|
4674 ]. |
|
4675 (s endsWith:' !!') ifTrue:[ |
|
4676 s := s copyWithoutLast:2 |
|
4677 ]. |
|
4678 pos := s lastIndexOf:(Character space). |
|
4679 ^ s copyTo:(pos - 1) |
|
4680 |
|
4681 "Modified: 17.6.1996 / 17:06:59 / stefan" |
|
4682 "Modified: 4.11.1996 / 23:56:52 / cg" |
|
4683 "Created: 3.3.1997 / 15:11:30 / cg" |
4615 ! |
4684 ! |
4616 |
4685 |
4617 selectorFromClassMethodString:aString |
4686 selectorFromClassMethodString:aString |
4618 "helper for classMethod-list - extract selector from the string" |
4687 "helper for classMethod-list - extract selector from the string" |
4619 |
4688 |
6189 !BrowserView methodsFor:'method list menu'! |
6258 !BrowserView methodsFor:'method list menu'! |
6190 |
6259 |
6191 commonTraceHelperWith:aSelector |
6260 commonTraceHelperWith:aSelector |
6192 "install a break/trace or countPoint for the current method" |
6261 "install a break/trace or countPoint for the current method" |
6193 |
6262 |
|
6263 "/ not for unbound methods (i.e. obsolete) |
|
6264 |
|
6265 currentMethod isNil ifTrue:[^ self]. |
|
6266 currentMethod who isNil ifTrue:[ |
|
6267 self warn:'method is no longer valid'. |
|
6268 ^ self |
|
6269 ]. |
|
6270 |
6194 currentMethod := MessageTracer perform:aSelector with:currentMethod. |
6271 currentMethod := MessageTracer perform:aSelector with:currentMethod. |
6195 Class withoutUpdatingChangesDo:[ |
6272 Class withoutUpdatingChangesDo:[ |
6196 currentClass changed:#methodTrap with:currentSelector. |
6273 currentClass changed:#methodTrap with:currentSelector. |
6197 ] |
6274 ] |
|
6275 |
|
6276 "Modified: 3.3.1997 / 15:17:15 / cg" |
6198 ! |
6277 ! |
6199 |
6278 |
6200 commonTraceHelperWith:aSelector with:argument |
6279 commonTraceHelperWith:aSelector with:argument |
6201 "install a break/trace or countPoint for the current method" |
6280 "install a break/trace or countPoint for the current method" |
6202 |
6281 |
7002 |
7081 |
7003 |s sel selSymbol clsName clsSymbol cls isMeta w| |
7082 |s sel selSymbol clsName clsSymbol cls isMeta w| |
7004 |
7083 |
7005 classMethodListView notNil ifTrue:[ |
7084 classMethodListView notNil ifTrue:[ |
7006 s := classMethodListView selectionValue string. |
7085 s := classMethodListView selectionValue string. |
7007 clsName := self classFromClassMethodString:s. |
7086 clsName := self classNameFromClassMethodString:s. |
7008 sel := self selectorFromClassMethodString:s. |
7087 sel := self selectorFromClassMethodString:s. |
7009 isMeta := false |
7088 isMeta := false |
7010 ]. |
7089 ]. |
7011 |
7090 |
7012 self extractClassAndSelectorFromSelectionInto:[:c :s :m | |
7091 self extractClassAndSelectorFromSelectionInto:[:c :s :m | |
7059 self withWaitCursorDo:[ |
7138 self withWaitCursorDo:[ |
7060 w := currentMethod who. |
7139 w := currentMethod who. |
7061 SystemBrowser browseClass:(w methodClass) selector:(w methodSelector) |
7140 SystemBrowser browseClass:(w methodClass) selector:(w methodSelector) |
7062 ] |
7141 ] |
7063 |
7142 |
7064 "Modified: 1.11.1996 / 16:20:29 / cg" |
7143 "Modified: 3.3.1997 / 15:11:51 / cg" |
7065 ! |
7144 ! |
7066 |
7145 |
7067 methodStartCounting |
7146 methodStartCounting |
7068 "set a countpoint on the current method" |
7147 "set a countpoint on the current method" |
7069 |
7148 |
7503 |
7582 |
7504 "Modified: 28.6.1996 / 20:28:56 / stefan" |
7583 "Modified: 28.6.1996 / 20:28:56 / stefan" |
7505 "Modified: 15.7.1996 / 11:44:11 / cg" |
7584 "Modified: 15.7.1996 / 11:44:11 / cg" |
7506 ! |
7585 ! |
7507 |
7586 |
|
7587 updateClassMethodListWithScroll:scroll keepSelection:keep |
|
7588 |newList selection| |
|
7589 |
|
7590 |
|
7591 newList := OrderedCollection new. |
|
7592 selection := classMethodListView selection. |
|
7593 |
|
7594 "/ update the list, caring for traps. |
|
7595 classMethodListView list do:[:entry | |
|
7596 |cls sel mthd s icn| |
|
7597 |
|
7598 cls := self classFromClassMethodString:entry string. |
|
7599 sel := self selectorFromClassMethodString:entry string. |
|
7600 mthd := cls compiledMethodAt:(sel asSymbol). |
|
7601 mthd isNil ifTrue:[ |
|
7602 newList add:cls name , ' ' , sel , ' ?' |
|
7603 ] ifFalse:[ |
|
7604 s := cls name , ' ' , (mthd printStringForBrowserWithSelector:sel). |
|
7605 mthd isWrapped ifTrue:[ |
|
7606 (s endsWith:' !!') ifTrue:[ |
|
7607 s := s copyWithoutLast:2 |
|
7608 ]. |
|
7609 (s endsWith:' !!') ifTrue:[ |
|
7610 s := s copyWithoutLast:2 |
|
7611 ]. |
|
7612 (MessageTracer isTrapped:mthd) ifTrue:[ |
|
7613 icn := self stopIcon |
|
7614 ] ifFalse:[ |
|
7615 icn := self traceIcon |
|
7616 ]. |
|
7617 newList add:(LabelAndIcon icon:icn string:s) |
|
7618 ] ifFalse:[ |
|
7619 newList add:s |
|
7620 ]. |
|
7621 ]. |
|
7622 classMethodListView setList:newList. |
|
7623 ]. |
|
7624 |
|
7625 classMethodListView setSelection:selection. |
|
7626 |
|
7627 "Modified: 18.12.1995 / 22:54:04 / stefan" |
|
7628 "Created: 3.3.1997 / 15:10:15 / cg" |
|
7629 "Modified: 3.3.1997 / 15:14:55 / cg" |
|
7630 ! |
|
7631 |
7508 updateMethodList |
7632 updateMethodList |
7509 self updateMethodListWithScroll:true keepSelection:false |
7633 self updateMethodListWithScroll:true keepSelection:false |
7510 ! |
7634 ! |
7511 |
7635 |
7512 updateMethodListWithScroll:scroll |
7636 updateMethodListWithScroll:scroll |
7549 self hilightMethodsInMethodList. |
7673 self hilightMethodsInMethodList. |
7550 ]. |
7674 ]. |
7551 |
7675 |
7552 keep ifTrue:[ |
7676 keep ifTrue:[ |
7553 methodListView setSelection:selection. |
7677 methodListView setSelection:selection. |
7554 ] |
7678 ]. |
7555 ] |
7679 ^ self |
|
7680 ]. |
|
7681 |
|
7682 classMethodListView notNil ifTrue:[ |
|
7683 self updateClassMethodListWithScroll:scroll keepSelection:keep |
|
7684 ]. |
7556 |
7685 |
7557 "Modified: 18.12.1995 / 22:54:04 / stefan" |
7686 "Modified: 18.12.1995 / 22:54:04 / stefan" |
7558 "Modified: 23.10.1996 / 21:00:52 / cg" |
7687 "Modified: 3.3.1997 / 15:10:42 / cg" |
7559 ! ! |
7688 ! ! |
7560 |
7689 |
7561 !BrowserView methodsFor:'misc'! |
7690 !BrowserView methodsFor:'misc'! |
7562 |
7691 |
7563 instanceProtocol:aBoolean |
7692 instanceProtocol:aBoolean |
8064 SystemBrowser perform:aSelector with:sel with:classes |
8193 SystemBrowser perform:aSelector with:sel with:classes |
8065 ] |
8194 ] |
8066 ] |
8195 ] |
8067 |
8196 |
8068 "Created: 11.11.1996 / 12:42:14 / cg" |
8197 "Created: 11.11.1996 / 12:42:14 / cg" |
8069 "Modified: 1.3.1997 / 13:26:50 / cg" |
8198 "Modified: 3.3.1997 / 14:47:16 / cg" |
8070 ! |
8199 ! |
8071 |
8200 |
8072 busyLabel:what with:someArgument |
8201 busyLabel:what with:someArgument |
8073 "set the title for some warning" |
8202 "set the title for some warning" |
8074 |
8203 |