View a class with inherited variables/methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

View a class with inherited variables/methods

Esteban A. Maringolo
Is there a way to view a class with all the inherited instance
variables and/or methods?

I'm trying to understand some code, and because the inheritance tree
is not shallow, I'd like to see all the variables it has (both own and
inherited).

Regards!

Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: View a class with inherited variables/methods

Henrik Nergaard
#withAllSubclasses

TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls |  cls -> {cls instVarNames  . cls methods }].

Best regards,
Henrik

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Esteban A. Maringolo
Sent: Tuesday, March 8, 2016 8:50 PM
To: Pharo users <[hidden email]>
Subject: [Pharo-users] View a class with inherited variables/methods

Is there a way to view a class with all the inherited instance variables and/or methods?

I'm trying to understand some code, and because the inheritance tree is not shallow, I'd like to see all the variables it has (both own and inherited).

Regards!

Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: View a class with inherited variables/methods

CyrilFerlicot
In reply to this post by Esteban A. Maringolo
Le 08/03/2016 20:50, Esteban A. Maringolo a écrit :

> Is there a way to view a class with all the inherited instance
> variables and/or methods?
>
> I'm trying to understand some code, and because the inheritance tree
> is not shallow, I'd like to see all the variables it has (both own and
> inherited).
>
> Regards!
>
> Esteban A. Maringolo
>
You can at least get the variables by clicking on the little button c/i
(class variable and instance variable) in Nautilus (Pharo 4) on the
button Variables in Nautilus (Pharo 5).

--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France

PharoScreenshot.png (9K) Download Attachment
signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: View a class with inherited variables/methods

Esteban A. Maringolo
In reply to this post by Henrik Nergaard
Hi Henrik,

2016-03-08 16:57 GMT-03:00 Henrik Nergaard <[hidden email]>:
> #withAllSubclasses
>
> TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls |  cls -> {cls instVarNames  . cls methods }].

I was doing something similar like:
MyClass withAllSuperclasses reversed flatCollect: [ :cls |  cls instVarNames ].

But I was asking if there was a tool that already provides that.

Thank you!


Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: View a class with inherited variables/methods

Henrik Nergaard
>From: Pharo-users [mailto:[hidden email]] On Behalf Of Esteban A. Maringolo
>Sent: Tuesday, March 8, 2016 9:03 PM
>To: Any question about pharo is welcome <[hidden email]>
>Subject: Re: [Pharo-users] View a class with inherited variables/methods

>Hi Henrik,

>2016-03-08 16:57 GMT-03:00 Henrik Nergaard <[hidden email]>:
>> #withAllSubclasses

>> TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls |  cls -> {cls instVarNames  . cls methods }].

>I was doing something similar like:
>MyClass withAllSuperclasses reversed flatCollect: [ :cls |  cls instVarNames ].

>But I was asking if there was a tool that already provides that.

Ah, so Something like this then?
----------------------------------------------------------------------
| classToView browser list nav |

classToView := TextMorphForFieldView.

nav := SystemNavigation new
                        browsedEnvironment: RBBrowserEnvironment new;
                        yourself.

browser := MessageBrowser new
        title: 'aTitle';
        autoSelect: classToView name;
        messages: #();
        yourself.

list := FTEasyListMorph new
        hResizing: #spaceFill;
        vResizing: #spaceFill;
        elements: (classToView  withAllSuperclasses reversed flatCollect: [ :cls | cls instVarNames ]);
        beSingleSelection;
        yourself.

list onAnnouncement: FTSelectionChanged do: [ :ann | | ivar |
        ivar := [ list dataSource elementAt: ann newSelectedRowIndexes anyOne ] ifError: [ nil ].
        ivar ifNotNil: [ browser messages: (nav allAccessesTo: ivar from: classToView )
        ]
].

(AlignmentMorph new
        setAsRow;
        addMorph: browser buildWithSpec;
        addMorph: list;
        layoutChanged;
        fullBounds;
        openInWindowLabeled: 'Stuff')
        position: 20@20;
        extent: 900@620.
       
---------------------------------------------------------------

 Best regards,
Henrik


>Thank you!


>Esteban A. Maringolo