[comp.lang.smalltalk] goody for st/v - sender, implementor from selected string

ott@piyopiyo.hatori.t.u-tokyo.ac.jp (Max Ott) (10/15/90)

Friends and Countrymen,

Haven't seen much traffic on small goodies for st/V. So here is
one. 

I just started the horrible task of documenting my own programs
(@#$!!@&&*) and got frustrated by the missing support when trying to
search through this jungle of methods. So I just added "implementors"
and "senders" to the normal text menu. This commands now work on the
selected string in the text pane.

If you install it you can either make this extensions the default for
all text menus (see Texteditor class>>menu) or change the menu
call in your application to "TextEditor extMenu".

Hope there will be no problems, I didn't test it on a virgin image,
but it is small anyway.

Enjoy,

max

p.s. If you read this far, could you just drop me a short line, I am
never really sure how far our messages go.


------------------------------------------------------------------------------
Max Ott			     e-mail:  !*!*!*  USE BELOW ADDRESS
Hatori Laboratory             ott@piyopiyo.hatori.t.u-tokyo.ac.jp
Dept. of E.E.; U of Tokyo             I am not a tourist, I live here, but
+(81)-(03) 812 2111 Ext. 6761         would not mind being one.


"****************************
 *   Sep  9, 1990  05:59:55
 *
 *   Project: infoTool
 *

    (Disk file: 'infoTool.cls') fileIn; close.
"!

ScrollDispatcher subclass: #TextEditor
  instanceVariableNames: 
    'modified priorSelection priorText newSelection '
  classVariableNames: 
    'PriorCommand StandardEditMenu CopyBuffer ExtEditMenu '
  poolDictionaries: 
    'FunctionKeys CharacterConstants '!

TextEditor class comment: 
nil.

 !


!TextPane methodsInCategory: 'infoService'!

implementors
        "Private - Pop-up a window with the
         implementors of the selected method."
    | aString |
    aString := (textHolder stringIn: selection).
    Smalltalk implementorsOf: aString asSymbol!

senders
        "Private - Pop-up a window with the
         senders of the selected method."
    | aString |
    aString := (textHolder stringIn: selection).
    Smalltalk sendersOf: aString asSymbol! !


!TextEditor class methodsInCategory: 'etc'!

extMenu
        "Answer the standard edit menu."
    ^ExtEditMenu!

initialize
        "Private - Initialize the standard edit menu."
    StandardEditMenu := Menu
        labels: 'restore\copy\cut\paste\show it\do it\save\next menu' withCrs
        lines: #(1 4 7)
        selectors: #(cancel copySelection cutSelection
                     pasteSelection printIt doIt accept misc).
    ExtEditMenu := Menu
        labels: 'restore\copy\cut\paste\show it\do it\save\senders\implementors\next menu' withCrs
        lines: #(1 4 9)
        selectors: #(cancel copySelection cutSelection
                     pasteSelection printIt doIt accept
                     showSenders showImplementors misc)!

menu
        "Answer the standard edit menu.
Only use when you want to make the extended menu the default one."
    ^ExtEditMenu! !


!TextEditor methodsInCategory: 'infoService'!

showImplementors
        "Private - Pop-up a window with the
         implementors of the selected method."
    pane implementors!

showSenders
        "Private - Pop-up a window with the
         senders of the selected method."
    pane senders! !