Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.sprintlink.net!noc.netcom.net!netcom.com!kcooper
From: kcooper@netcom.com (Ken Cooper)
Subject: Re: Adding "browse" to system menus
Message-ID: <kcooperD9J6Cq.EIA@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <233463696@to.mobil.com>
Date: Fri, 2 Jun 1995 05:38:50 GMT
Lines: 80
Sender: kcooper@netcom12.netcom.com

In article <233463696@to.mobil.com>,
Curt Welch - RDR <curt@to.mobil.com> wrote:
>Some time ago, I enhanced some of the menus in my development
>tools (VW1.0) by adding a "browse" entry along with the "do it"
>"print it" and "inspect".  I've gotten to the point that I can't live
>without the feature and thought others might like it also, so I'm posting
>this messages to let people know about it.

That's a great idea, Kurt.  Hope you don't mind if I swipe it for an edIt
extension (I'll credit you).  For those of you using edIt, I've posted the
code below. I've also been putting these on the Smalltalk archive at
st.cs.uiuc.edu, as well as in Digitalk's Compuserve Third Party library.

Ken Cooper
Cooper & Peters, Inc.

------------------------ CUT HERE ---------------------------

"This filein contains an edIt extension that provides functionality
similar to the Show It command.  Instead of printing the result of
the selected expression, Browse It brings up a ClassHierarchyBrowser
on the class of the result.

Kudos to Curt Welch for providing the idea (he wrote similar functionality
for VisualWorks 1.0).

Category: Code Execution
Key Binding: Ctrl-Y+Ctrl-B
Author: Ken Cooper (71571.407@compuserve.com)
Methods:
  CPBaseEdIt>>browseIt
  CPEdIt>>browseIt
  Object>>browsableClass
  Class>>browsableClass
  MetaClass>>browsableClass
"!

!CPBaseEdIt methods!
browseIt

     | result |

     self selectionEmpty ifTrue: [
         self selectCurrentLine
     ].

     CursorManager execute changeFor: [
         result := (self evaluate: self selectionString ifError: [ ^self ]) browsableClass.
     ].

    ClassHierarchyBrowser new openSelecting: result.! !

!CPEdIt methods!
browseIt

    self mainEditor browseIt.! !

!Object methods!
browsableClass

    #addedByCnP.
    ^self class! !

!Class methods!
browsableClass

    #addedByCnP.
    ^self! !

!MetaClass methods!
browsableClass

    #addedByCnP.
    ^self instanceClass! !

CPCategoryManager current addMethod: #browseIt inClass: #CPEdIt toCategory: 'Code Execution'.
CPKeyBindingsSet current bindKey: 'Ctrl-Y+Ctrl-B' toSelector: #browseIt inClass: #CPEdIt.!



