Sunday, January 10, 2010

TreeMorph based package browser

In this tutorial you will learn how to display packages / class / messages tree in a TreeMorph and use the Selected callbalk to display source code of selected item in a TextMorph.

Download screencast (800x600): .mpeg, 22.4 MB, .mov, 41.1 MB



Load the source code:
Gofer new
     squeaksource: 'Pharocasts';
     package: 'TreeMorphBasedPackageBrowser';
     load.

Code samples:
aTreeMorph := PluggableTreeMorph new.
 
items := PackageOrganizer default packages collect: [:aPackageInfo|
   PackageInfoListItemWrapper with: aPackageInfo.
].
aTreeMorph list: items.
aTreeMorph 
   model: self;
   setSelectedSelector: #onItemWrapperClick:.

In PackageInfoListItemWrapper:
contents
   ^ item classes collect: [:aClass | ClassDescriptionListItemWrapper with: aClass].

1 comment: