9425 ! ! |
9442 ! ! |
9426 |
9443 |
9427 !BrowserView methodsFor:'private'! |
9444 !BrowserView methodsFor:'private'! |
9428 |
9445 |
9429 askAndBrowseMethodCategory:title action:aBlock |
9446 askAndBrowseMethodCategory:title action:aBlock |
9430 "convenient method: setup enterBox with initial being current method category" |
9447 "convenient helper method: setup enterBox with initial being current method category" |
9431 |
9448 |
9432 |sel box| |
9449 |sel box| |
9433 |
9450 |
9434 box := self |
9451 box := self |
9435 enterBoxTitle:title |
9452 enterBoxTitle:title |
9436 okText:'browse' |
9453 okText:'browse' |
9437 label:'browse category'. |
9454 label:'browse category'. |
9438 |
9455 |
9439 sel := codeView selection. |
9456 sel := codeView selection. |
9440 sel isNil ifTrue:[ |
9457 sel isNil ifTrue:[ |
9441 currentMethodCategory notNil ifTrue:[ |
9458 currentMethodCategory notNil ifTrue:[ |
9442 sel := currentMethodCategory |
9459 sel := currentMethodCategory |
9443 ] |
9460 ] |
9444 ]. |
9461 ]. |
9445 sel notNil ifTrue:[ |
9462 sel notNil ifTrue:[ |
9446 box initialText:(sel asString withoutSpaces) |
9463 box initialText:(sel asString withoutSpaces) |
9447 ]. |
9464 ]. |
9448 box action:[:aString | self withBusyCursorDo:[aBlock value:aString]]. |
9465 box action:[:aString | self withBusyCursorDo:[aBlock value:aString]]. |
9449 box showAtPointer |
9466 box showAtPointer |
9450 |
9467 |
9451 "Modified: 18.8.1997 / 15:42:07 / cg" |
9468 "Modified: / 18.6.1998 / 16:40:46 / cg" |
9452 ! |
9469 ! |
9453 |
9470 |
9454 askForMethodCategory |
9471 askForMethodCategory |
|
9472 "convenient helper method: setup a box asking for a method category" |
|
9473 |
9455 |someCategories box txt retVal| |
9474 |someCategories box txt retVal| |
9456 |
9475 |
9457 someCategories := actualClass categories sort. |
9476 someCategories := actualClass categories sort. |
9458 box := self listBoxTitle:'accept in which method category ?' okText:'accept' list:someCategories. |
9477 box := self listBoxTitle:'accept in which method category ?' okText:'accept' list:someCategories. |
9459 |
9478 |
9460 lastMethodCategory isNil ifTrue:[ |
9479 lastMethodCategory isNil ifTrue:[ |
9461 txt := 'new methods' |
9480 txt := 'new methods' |
9462 ] ifFalse:[ |
9481 ] ifFalse:[ |
9463 txt := lastMethodCategory |
9482 txt := lastMethodCategory |
9464 ]. |
9483 ]. |
9465 box initialText:txt. |
9484 box initialText:txt. |
9466 box action:[:aString | aString notEmpty ifTrue:[retVal := aString] ]. |
9485 box action:[:aString | aString notEmpty ifTrue:[retVal := aString] ]. |
9467 box showAtPointer. |
9486 box showAtPointer. |
9468 ^ retVal |
9487 ^ retVal |
9469 |
9488 |
9470 "Modified: 27.3.1996 / 15:33:46 / cg" |
9489 "Modified: / 18.6.1998 / 16:41:03 / cg" |
9471 ! |
9490 ! |
9472 |
9491 |
9473 askForSearchSelectorTitle:title openWith:aSelector |
9492 askForSearchSelectorTitle:title openWith:aSelector |
9474 "convenient method: setup enterBox with text from codeView or selected |
9493 "convenient helper method: setup enterBox with text from codeView or selected |
9475 method for browsing based on a selector. Set action and launch box" |
9494 method for browsing based on a selector. Set action and launch box" |
9476 |
9495 |
9477 ^ self |
9496 ^ self |
9478 askForSearchTitle:title |
9497 askForSearchTitle:title |
9479 openWith:aSelector |
9498 openWith:aSelector |
9480 isSelector:true |
9499 isSelector:true |
9481 |
9500 |
9482 "Modified: 11.11.1996 / 12:43:24 / cg" |
9501 "Modified: / 18.6.1998 / 16:40:39 / cg" |
9483 ! |
9502 ! |
9484 |
9503 |
9485 askForSearchTitle:title openWith:aSelector isSelector:isSelector |
9504 askForSearchTitle:title openWith:aSelector isSelector:isSelector |
9486 "convenient method: setup enterBox with text from codeView or selected |
9505 "convenient helper method: setup enterBox with text from codeView or selected |
9487 method for browsing based on a selector. Set action and launch box" |
9506 method for browsing based on a selector. Set action and launch box" |
9488 |
9507 |
9489 ^ self |
9508 ^ self |
9490 askForSearchTitle:title |
9509 askForSearchTitle:title |
9491 openWith:aSelector |
9510 openWith:aSelector |
9492 isSelector:isSelector |
9511 isSelector:isSelector |
9493 searchArea:#everywhere |
9512 searchArea:#everywhere |
9494 |
9513 |
9495 "Modified: 11.11.1996 / 12:42:46 / cg" |
9514 "Modified: / 18.6.1998 / 16:40:35 / cg" |
9496 ! |
9515 ! |
9497 |
9516 |
9498 askForSearchTitle:title openWith:aSelector isSelector:isSelector searchArea:whereDefault |
9517 askForSearchTitle:title openWith:aSelector isSelector:isSelector searchArea:whereDefault |
9499 "convenient method: setup enterBox with text from codeView or selected |
9518 "convenient helper method: setup enterBox with text from codeView or selected |
9500 method for browsing based on a selector. Set action and launch box. |
9519 method for browsing based on a selector. Set action and launch box. |
9501 SearchArea may be one of #everywhere, #classCategory, #class, #classWithPrivateClasses, |
9520 SearchArea may be one of #everywhere, #classCategory, #class, #classWithPrivateClasses, |
9502 #classHierarchy or #classHierarchyWithPrivateClasses" |
9521 #classHierarchy or #classHierarchyWithPrivateClasses" |
9503 |
9522 |
9504 |box grp panel selectorHolder where whereChannel |
9523 ^ self |
|
9524 askForSearchTitle:title |
|
9525 openWith:aSelector |
|
9526 isSelector:isSelector |
|
9527 searchArea:whereDefault |
|
9528 withCaseIgnore:false |
|
9529 |
|
9530 "Modified: / 18.6.1998 / 16:40:26 / cg" |
|
9531 ! |
|
9532 |
|
9533 askForSearchTitle:title openWith:aSelector isSelector:isSelector searchArea:whereDefault withCaseIgnore:withCaseIgnore |
|
9534 "convenient helper method: setup enterBox with text from codeView or selected |
|
9535 method for browsing based on a selector. Set action and launch box. |
|
9536 SearchArea may be one of #everywhere, #classCategory, #class, #classWithPrivateClasses, |
|
9537 #classHierarchy or #classHierarchyWithPrivateClasses" |
|
9538 |
|
9539 |box grp panel selectorHolder where whereChannel caseHolder |
9505 b sel classes areas toSearch cls privates inputField| |
9540 b sel classes areas toSearch cls privates inputField| |
9506 |
9541 |
9507 areas := #(everywhere |
9542 areas := #(everywhere |
9508 classCategory |
9543 classCategory |
9509 class |
9544 class |
9510 classHierarchy |
9545 classHierarchy |
9511 classWithPrivateClasses |
9546 classWithPrivateClasses |
9512 classHierarchyWithPrivateClasses). |
9547 classHierarchyWithPrivateClasses). |
9513 |
9548 |
9514 isSelector ifTrue:[ |
9549 isSelector ifTrue:[ |
9515 sel := self selectorToSearchFor. |
9550 sel := self selectorToSearchFor. |
9516 ] ifFalse:[ |
9551 ] ifFalse:[ |
9517 sel := self stringToSearchFor. |
9552 sel := self stringToSearchFor. |
9518 ]. |
9553 ]. |
9519 selectorHolder := sel asValue. |
9554 selectorHolder := sel asValue. |
9520 |
9555 |
9521 box := Dialog new. |
9556 box := Dialog new. |
9522 (box addTextLabel:(resources string:title)) adjust:#left. |
9557 (box addTextLabel:(resources string:title)) adjust:#left. |
9523 |
9558 |
9524 inputField := box addInputFieldOn:selectorHolder tabable:true. |
9559 inputField := box addInputFieldOn:selectorHolder tabable:true. |
9525 inputField selectAll. |
9560 inputField selectAll. |
9526 inputField entryCompletionBlock:[:contents | |
9561 inputField entryCompletionBlock:[:contents | |
9527 |s what m| |
9562 |s what m| |
9528 |
9563 |
9529 s := contents withoutSpaces. |
9564 s := contents withoutSpaces. |
9530 box topView withWaitCursorDo:[ |
9565 box topView withWaitCursorDo:[ |
9531 what := Smalltalk selectorCompletion:s. |
9566 what := Smalltalk selectorCompletion:s. |
9532 inputField contents:what first. |
9567 inputField contents:what first. |
9533 (what at:2) size ~~ 1 ifTrue:[ |
9568 (what at:2) size ~~ 1 ifTrue:[ |
9534 self beep |
9569 self beep |
9535 ] |
9570 ] |
9536 ] |
9571 ] |
|
9572 ]. |
|
9573 |
|
9574 withCaseIgnore ifTrue:[ |
|
9575 "/ box addVerticalSpace. |
|
9576 box addCheckBox:(resources string:'ignore case') on:(caseHolder := false asValue). |
|
9577 "/ box addVerticalSpace. |
9537 ]. |
9578 ]. |
9538 |
9579 |
9539 (currentClassCategory notNil or:[currentClass notNil]) ifTrue:[ |
9580 (currentClassCategory notNil or:[currentClass notNil]) ifTrue:[ |
9540 box addHorizontalLine. |
9581 box addHorizontalLine. |
9541 box addVerticalSpace. |
9582 box addVerticalSpace. |
9542 |
9583 |
9543 (box addTextLabel:(resources string:'search in:')) adjust:#left. |
9584 (box addTextLabel:(resources string:'search in:')) adjust:#left. |
9544 |
9585 |
9545 panel := VerticalPanelView "HorizontalPanelView" new. |
9586 panel := VerticalPanelView "HorizontalPanelView" new. |
9546 panel horizontalLayout:#fitSpace. |
9587 panel horizontalLayout:#fitSpace. |
9547 |
9588 |
9548 grp := RadioButtonGroup new. |
9589 grp := RadioButtonGroup new. |
9549 b := CheckBox "RadioButton" label:(resources string:'everywhere'). |
9590 b := CheckBox "RadioButton" label:(resources string:'everywhere'). |
9550 panel add:b. grp add:b. |
9591 panel add:b. grp add:b. |
9551 box makeTabable:b. |
9592 box makeTabable:b. |
9552 |
9593 |
9553 currentClassCategory notNil ifTrue:[ |
9594 currentClassCategory notNil ifTrue:[ |
9554 b := CheckBox "RadioButton" label:(resources string:'class category'). |
9595 b := CheckBox "RadioButton" label:(resources string:'class category'). |
9555 panel add:b. grp add:b. |
9596 panel add:b. grp add:b. |
9556 box makeTabable:b. |
9597 box makeTabable:b. |
9557 ]. |
9598 ]. |
9558 |
9599 |
9559 currentClass notNil ifTrue:[ |
9600 currentClass notNil ifTrue:[ |
9560 b := CheckBox "RadioButton" label:(resources string:'class'). |
9601 b := CheckBox "RadioButton" label:(resources string:'class'). |
9561 panel add:b.grp add:b. |
9602 panel add:b.grp add:b. |
9562 box makeTabable:b. |
9603 box makeTabable:b. |
9563 |
9604 |
9564 b := CheckBox "RadioButton" label:(resources string:'class & subclasses'). |
9605 b := CheckBox "RadioButton" label:(resources string:'class & subclasses'). |
9565 panel add:b. grp add:b. |
9606 panel add:b. grp add:b. |
9566 box makeTabable:b. |
9607 box makeTabable:b. |
9567 |
9608 |
9568 currentClass subclasses size == 0 ifTrue:[ |
9609 currentClass subclasses size == 0 ifTrue:[ |
9569 b disable. |
9610 b disable. |
9570 ]. |
9611 ]. |
9571 |
9612 |
9572 b := CheckBox "RadioButton" label:(resources string:'class & private classes'). |
9613 b := CheckBox "RadioButton" label:(resources string:'class & private classes'). |
9573 panel add:b.grp add:b. |
9614 panel add:b.grp add:b. |
9574 box makeTabable:b. |
9615 box makeTabable:b. |
9575 |
9616 |
9576 currentClass privateClasses size == 0 ifTrue:[ |
9617 currentClass privateClasses size == 0 ifTrue:[ |
9577 b disable |
9618 b disable |
9578 ]. |
9619 ]. |
9579 |
9620 |
9580 b := CheckBox "RadioButton" label:(resources string:'class & subclasses & all private classes'). |
9621 b := CheckBox "RadioButton" label:(resources string:'class & subclasses & all private classes'). |
9581 panel add:b. grp add:b. |
9622 panel add:b. grp add:b. |
9582 box makeTabable:b. |
9623 box makeTabable:b. |
9583 |
9624 |
9584 currentClass subclasses size == 0 ifTrue:[ |
9625 currentClass subclasses size == 0 ifTrue:[ |
9585 b disable. |
9626 b disable. |
9586 ] ifFalse:[ |
9627 ] ifFalse:[ |
9587 "/ this takes too long ... |
9628 "/ this takes too long ... |
9588 "/ toSearch := IdentitySet new. |
9629 "/ toSearch := IdentitySet new. |
9589 "/ currentClass withAllSubclasses do:[:cls | toSearch add:cls privateClasses]. |
9630 "/ currentClass withAllSubclasses do:[:cls | toSearch add:cls privateClasses]. |
9590 "/ toSearch size == 0 ifTrue:[ |
9631 "/ toSearch size == 0 ifTrue:[ |
9591 "/ b disable |
9632 "/ b disable |
9592 "/ ] |
9633 "/ ] |
9593 ] |
9634 ] |
9594 ]. |
9635 ]. |
9595 whereDefault notNil ifTrue:[ |
9636 whereDefault notNil ifTrue:[ |
9596 where := areas indexOf:whereDefault. |
9637 where := areas indexOf:whereDefault. |
9597 where == 0 ifTrue:[where := 1]. |
9638 where == 0 ifTrue:[where := 1]. |
9598 ] ifFalse:[ |
9639 ] ifFalse:[ |
9599 where := 1. |
9640 where := 1. |
9600 ]. |
9641 ]. |
9601 grp value:where. |
9642 grp value:where. |
9602 whereChannel := grp. |
9643 whereChannel := grp. |
9603 box addComponent:panel indent:0. "/ panel has its own idea of indenting |
9644 box addComponent:panel indent:0. "/ panel has its own idea of indenting |
9604 |
9645 |
9605 box addVerticalSpace. |
9646 box addVerticalSpace. |
9606 box addHorizontalLine. |
9647 box addHorizontalLine. |
9607 ] ifFalse:[ |
9648 ] ifFalse:[ |
9608 whereChannel := 1 asValue. |
9649 whereChannel := 1 asValue. |
9609 ]. |
9650 ]. |
9610 |
9651 |
9611 box addAbortButton. |
9652 box addAbortButton. |
9612 box addOkButtonLabelled:(resources string:'browse'). |
9653 box addOkButtonLabelled:(resources string:'browse'). |
9613 |
9654 |
9614 box label:(resources string:'search'). |
9655 box label:(resources string:'search'). |
9615 box open. |
9656 box open. |
9616 |
9657 |
9617 box accepted ifTrue:[ |
9658 box accepted ifTrue:[ |
9618 sel := selectorHolder value. |
9659 sel := selectorHolder value. |
9619 where := whereChannel value. |
9660 where := whereChannel value. |
9620 |
9661 |
9621 sel isEmpty ifTrue:[ |
9662 sel isEmpty ifTrue:[ |
9622 self warn:'nothing entered for search'. |
9663 self warn:'nothing entered for search'. |
9623 ^ self. |
9664 ^ self. |
9624 ]. |
9665 ]. |
9625 where isNil ifTrue:[ |
9666 where isNil ifTrue:[ |
9626 self warn:'no class(es) for search'. |
9667 self warn:'no class(es) for search'. |
9627 ^ self. |
9668 ^ self. |
9628 ]. |
9669 ]. |
9629 |
9670 |
9630 where := areas at:where ifAbsent:#class. |
9671 where := areas at:where ifAbsent:#class. |
9631 |
9672 |
9632 where == #everywhere ifTrue:[ |
9673 where == #everywhere ifTrue:[ |
9633 classes := Smalltalk allClasses. |
9674 classes := Smalltalk allClasses. |
9634 ] ifFalse:[ |
9675 ] ifFalse:[ |
9635 where == #classCategory ifTrue:[ |
9676 where == #classCategory ifTrue:[ |
9636 classes := Smalltalk allClassesInCategory:currentClassCategory |
9677 classes := Smalltalk allClassesInCategory:currentClassCategory |
9637 ] ifFalse:[ |
9678 ] ifFalse:[ |
9638 (where == #class or:[where == #classWithPrivateClasses]) ifTrue:[ |
9679 (where == #class or:[where == #classWithPrivateClasses]) ifTrue:[ |
9639 currentClass isNil ifTrue:[ |
9680 currentClass isNil ifTrue:[ |
9640 classes := #() |
9681 classes := #() |
9641 ] ifFalse:[ |
9682 ] ifFalse:[ |
9642 classes := Array with:currentClass |
9683 classes := Array with:currentClass |
9643 ] |
9684 ] |
9644 ] ifFalse:[ |
9685 ] ifFalse:[ |
9645 (where == #classHierarchy or:[where == #classHierarchyWithPrivateClasses]) ifTrue:[ |
9686 (where == #classHierarchy or:[where == #classHierarchyWithPrivateClasses]) ifTrue:[ |
9646 classes := currentClass withAllSubclasses |
9687 classes := currentClass withAllSubclasses |
9647 ] |
9688 ] |
9648 ] |
9689 ] |
9649 ] |
9690 ] |
9650 ]. |
9691 ]. |
9651 (where == #classWithPrivateClasses or:[where == #classHierarchyWithPrivateClasses]) ifTrue:[ |
9692 (where == #classWithPrivateClasses or:[where == #classHierarchyWithPrivateClasses]) ifTrue:[ |
9652 toSearch := IdentitySet withAll:classes. |
9693 toSearch := IdentitySet withAll:classes. |
9653 classes := IdentitySet withAll:toSearch. |
9694 classes := IdentitySet withAll:toSearch. |
9654 |
9695 |
9655 [toSearch notEmpty] whileTrue:[ |
9696 [toSearch notEmpty] whileTrue:[ |
9656 cls := toSearch removeFirst. |
9697 cls := toSearch removeFirst. |
9657 privates := cls privateClasses. |
9698 privates := cls privateClasses. |
9658 privates notNil ifTrue:[ |
9699 privates notNil ifTrue:[ |
9659 toSearch addAll:cls privateClasses. |
9700 toSearch addAll:cls privateClasses. |
9660 classes addAll:cls privateClasses. |
9701 classes addAll:cls privateClasses. |
9661 ] |
9702 ] |
9662 ]. |
9703 ]. |
9663 classes := classes asOrderedCollection. |
9704 classes := classes asOrderedCollection. |
9664 ]. |
9705 ]. |
9665 |
9706 |
9666 classes isEmpty ifTrue:[ |
9707 classes isEmpty ifTrue:[ |
9667 self warn:'no class(es) given for search'. |
9708 self warn:'no class(es) given for search'. |
9668 ] ifFalse:[ |
9709 ] ifFalse:[ |
9669 self withSearchCursorDo:[ |
9710 self withSearchCursorDo:[ |
9670 SystemBrowser perform:aSelector with:sel with:classes |
9711 withCaseIgnore ifTrue:[ |
9671 ] |
9712 SystemBrowser perform:aSelector with:sel with:classes with:caseHolder value |
9672 ] |
9713 ] ifFalse:[ |
|
9714 SystemBrowser perform:aSelector with:sel with:classes |
|
9715 ] |
|
9716 ] |
|
9717 ] |
9673 ] |
9718 ] |
9674 |
9719 |
9675 "Created: 11.11.1996 / 12:42:14 / cg" |
9720 "Created: / 18.6.1998 / 16:39:44 / cg" |
9676 "Modified: 28.7.1997 / 18:04:04 / cg" |
9721 "Modified: / 18.6.1998 / 16:40:30 / cg" |
9677 ! |
9722 ! |
9678 |
9723 |
9679 busyLabel:what with:someArgument |
9724 busyLabel:what with:someArgument |
9680 "set the title for some warning" |
9725 "set the title for some warning" |
9681 |
9726 |