5379 self updateMenuItems |
5379 self updateMenuItems |
5380 |
5380 |
5381 "Modified: / 17.11.2001 / 22:12:16 / cg" |
5381 "Modified: / 17.11.2001 / 22:12:16 / cg" |
5382 ! |
5382 ! |
5383 |
5383 |
|
5384 hideStackInspector |
|
5385 stackInspector notNil ifTrue:[ |
|
5386 stackInspector destroy. |
|
5387 stackInspector := nil. |
|
5388 receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0. |
|
5389 contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0) |
|
5390 ] |
|
5391 ! |
|
5392 |
5384 processEvent:anEvent |
5393 processEvent:anEvent |
5385 "filter keyboard events for popUp variable value display" |
5394 "filter keyboard events for popUp variable value display" |
5386 |
5395 |
5387 |evView focusView key rawKey inCodeView| |
5396 |evView focusView key rawKey inCodeView| |
5388 |
5397 |
5454 s nextPutLine:'****'. |
5463 s nextPutLine:'****'. |
5455 con := ex suspendedContext. |
5464 con := ex suspendedContext. |
5456 s nextPutAll: '**** '; nextPutLine:(con printString). |
5465 s nextPutAll: '**** '; nextPutLine:(con printString). |
5457 con := con sender. |
5466 con := con sender. |
5458 [con notNil] whileTrue:[ |
5467 [con notNil] whileTrue:[ |
5459 Error catch:[:ex | |
5468 Error catch:[:ex | |
5460 s nextPutAll: '**** '; nextPutLine:(con printString). |
5469 s nextPutAll: '**** '; nextPutLine:(con printString). |
5461 ]. |
5470 ]. |
5462 |
5471 |
5463 con receiver == self ifTrue:[ |
5472 con receiver == self ifTrue:[ |
5464 con := nil |
5473 con := nil |
5465 ] ifFalse:[ |
5474 ] ifFalse:[ |
5466 con := con sender. |
5475 con := con sender. |
5471 ] do:[ |
5480 ] do:[ |
5472 self doShowSelection:lineNr |
5481 self doShowSelection:lineNr |
5473 ] |
5482 ] |
5474 |
5483 |
5475 "Modified: / 18.11.2001 / 00:02:32 / cg" |
5484 "Modified: / 18.11.2001 / 00:02:32 / cg" |
|
5485 ! |
|
5486 |
|
5487 showStackInspectorFor:con |
|
5488 stackInspector isNil ifTrue:[ |
|
5489 receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0. |
|
5490 contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0). |
|
5491 stackInspector := InspectorView |
|
5492 origin:(0.6 @ 0.0) |
|
5493 corner:(1.0 @ 1.0) |
|
5494 in:contextInspector superView. |
|
5495 stackInspector realize. |
|
5496 stackInspector fieldListLabel:'Stack'. |
|
5497 stackInspector hideReceiver:true |
|
5498 ]. |
|
5499 stackInspector inspect:(con stackFrame asArray). |
|
5500 stackInspector showLast |
5476 ! |
5501 ! |
5477 |
5502 |
5478 updateForContext:lineNr |
5503 updateForContext:lineNr |
5479 "show selected code for lineNr in contextList in textView. |
5504 "show selected code for lineNr in contextList in textView. |
5480 Also used to autoselect an interesting context on entry." |
5505 Also used to autoselect an interesting context on entry." |
5532 "/ ]. |
5557 "/ ]. |
5533 |
5558 |
5534 "/ show a stack inspector sometimes |
5559 "/ show a stack inspector sometimes |
5535 |
5560 |
5536 con hasStackToShow ifTrue:[ |
5561 con hasStackToShow ifTrue:[ |
5537 stackInspector isNil ifTrue:[ |
5562 self showStackInspectorFor:con |
5538 receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0. |
|
5539 contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0). |
|
5540 |
|
5541 stackInspector := InspectorView |
|
5542 origin:(0.6 @ 0.0) corner:(1.0 @ 1.0) |
|
5543 in:contextInspector superView. |
|
5544 stackInspector realize. |
|
5545 stackInspector fieldListLabel:'Stack'. |
|
5546 stackInspector hideReceiver:true. |
|
5547 ]. |
|
5548 stackInspector inspect:(con stackFrame asArray). |
|
5549 stackInspector showLast. |
|
5550 ] ifFalse:[ |
5563 ] ifFalse:[ |
5551 stackInspector notNil ifTrue:[ |
5564 self hideStackInspector |
5552 stackInspector destroy. |
|
5553 stackInspector := nil. |
|
5554 receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0. |
|
5555 contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0). |
|
5556 ] |
|
5557 ]. |
5565 ]. |
5558 |
5566 |
5559 " |
5567 " |
5560 get the home context |
5568 get the home context |
5561 " |
5569 " |
5562 con isBlockContext ifTrue:[ |
5570 con isBlockContext ifTrue:[ |
5563 homeContext := con methodHome |
5571 homeContext := con methodHome. |
5564 ] ifFalse:[ |
5572 ] ifFalse:[ |
5565 homeContext := con |
5573 homeContext := con |
5566 ]. |
5574 ]. |
5567 con canReturn ifTrue:[ |
5575 con canReturn ifTrue:[ |
5568 returnButton enable. restartButton enable. |
5576 returnButton enable. restartButton enable. |
5577 homeContext isNil ifTrue:[ |
5585 homeContext isNil ifTrue:[ |
5578 " |
5586 " |
5579 mhmh - an optimized block |
5587 mhmh - an optimized block |
5580 should get the block here, and get the method from |
5588 should get the block here, and get the method from |
5581 that one ... |
5589 that one ... |
5582 But in 2.10.x, there is no easy way to get to the block |
5590 But in the current version, there is no easy way to get to the block |
5583 since that one is not in the context. |
5591 since that one is not in the context. |
5584 Starting with 2.11, the new block calling scheme will fix this. |
5592 A future new block calling scheme will fix this |
|
5593 (passing the block instead of the home as block argument). |
5585 " |
5594 " |
5586 |
5595 |
5587 "temporary kludge - peek into the sender context. |
5596 "temporary kludge - peek into the sender context. |
5588 If its a do-like method and there is a single block variable |
5597 If its a do-like method and there is a single block variable |
5589 in the args or temporaries, that must be the one. |
5598 in the args or temporaries, that must be the one. |
5602 possibleBlocks size == 1 ifTrue:[ |
5611 possibleBlocks size == 1 ifTrue:[ |
5603 method := possibleBlocks first method. |
5612 method := possibleBlocks first method. |
5604 ]. |
5613 ]. |
5605 ] |
5614 ] |
5606 ]. |
5615 ]. |
5607 |
|
5608 ] ifFalse:[ |
5616 ] ifFalse:[ |
5609 "fetch rec here - so we wont need context in doItAction" |
5617 "fetch rec here - so we wont need context in doItAction" |
5610 rec := homeContext receiver. |
5618 rec := homeContext receiver. |
5611 |
|
5612 sel := homeContext selector. |
5619 sel := homeContext selector. |
5613 sel notNil ifTrue:[ |
5620 sel notNil ifTrue:[ |
5614 canAccept := true. |
5621 canAccept := true. |
5615 |
5622 |
5616 implementorClass := homeContext methodClass. |
5623 implementorClass := homeContext methodClass. |
5629 " |
5636 " |
5630 special: look if this context was created by |
5637 special: look if this context was created by |
5631 valueWithReceiver kind of method invocation; |
5638 valueWithReceiver kind of method invocation; |
5632 if so, grab the method from the sender and show it |
5639 if so, grab the method from the sender and show it |
5633 " |
5640 " |
|
5641 |
5634 ((sender := homeContext sender) notNil |
5642 ((sender := homeContext sender) notNil |
5635 and:[(sender selector startsWith:'valueWithReceiver:') |
5643 and:[(sender selector startsWith:'valueWithReceiver:') |
5636 and:[sender receiver isMethod]]) ifTrue:[ |
5644 and:[sender receiver isMethod]]) ifTrue:[ |
5637 method := sender receiver. |
5645 method := sender receiver. |
5638 self sensor shiftDown ifTrue:[ |
5646 self sensor shiftDown ifTrue:[ |
5658 ] |
5666 ] |
5659 ]. |
5667 ]. |
5660 |
5668 |
5661 code isNil ifTrue:[ |
5669 code isNil ifTrue:[ |
5662 errMsg := nil. |
5670 errMsg := nil. |
|
5671 method isNil ifTrue:[ |
|
5672 "/ fall back heuristics |
|
5673 con isBlockContext ifTrue:[ |
|
5674 ((sender := con sender) notNil |
|
5675 and:[(sender selector startsWith:'value') |
|
5676 and:[sender receiver isBlock]]) ifTrue:[ |
|
5677 code := sender receiver source. |
|
5678 ] |
|
5679 ]. |
|
5680 ]. |
5663 method notNil ifTrue:[ |
5681 method notNil ifTrue:[ |
5664 Error handle:[:ex | |
5682 Error handle:[:ex | |
5665 ex signal isControlInterrupt ifTrue:[ |
5683 ex signal isControlInterrupt ifTrue:[ |
5666 ex proceed. |
5684 ex proceed. |
5667 ]. |
5685 ]. |