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
#withAllSubclasses TextMorphForFieldView withAllSuperclasses reversed collect: [ :cls | cls -> {cls instVarNames . cls methods }]. Best regards, Henrik -----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Esteban A. Maringolo Sent: Tuesday, March 8, 2016 8:50 PM To: Pharo users <pharo-users@lists.pharo.org> 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
Hi Henrik, 2016-03-08 16:57 GMT-03:00 Henrik Nergaard <henrik.nergaard@uia.no>:
#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
From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Esteban A. Maringolo Sent: Tuesday, March 8, 2016 9:03 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] View a class with inherited variables/methods
Hi Henrik,
2016-03-08 16:57 GMT-03:00 Henrik Nergaard <henrik.nergaard@uia.no>:
#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
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
participants (3)
-
Cyril Ferlicot D. -
Esteban A. Maringolo -
Henrik Nergaard