> I have some students who want to build a browser with only two panes.
> The pane on the left would be a tree-view that displays the package/
> class/protocol/method selected, while the pane on the right would be a
> code view.
>
> Does anybody have hints about how we would go about this? I recall
> seeing a tree-view in omnibrowser a few weeks back, but can't find it
> now.
In the package OB-Enhancements there is an OBTreeColumn, using OBPluggableTreeMorph
and OBPluggableTreeItemWithParentNode. By default, this tree shows packages as root
elements and class cats as children, but it could also show the whole code hierarchy
down to methods.
You can specify in the metamodel which transitions should be navigated in the tree.
I suggest to look at OBPackageBrowser class >> defaultMetaNode
> Suppose we made a new class of panes. How would we tell that browser
> that we wanted to use it?
The two panes could be modelled using an OBColumnPanel. As a first column, you pass
the tree, as a second the definition panel.
Each browser (OBSystemBrowser, OBPackageBrowse, etc.) has on the class side a method
#panels defining the panels it shows.
In your example you'd just use a single panel, let's call it navigation panel, which
is an instance of the column panel class you implement, ie. a subclass of OBColumnPanel.
Eventually you probably just need to implement your own browser and column panel
class. The other main components you can base on existing classes.
Cheers,
David
Probably a better option would be to have a horizontal panel group
containing an OBColumnPanel on the left and your definition panel on the
right. In your browser class, override #panels (class side) to answer
column panel and definition panel. On the instance side, override
#buildOn: with something like this:
buildOn: aBuilder
^ aBuilder window: self with:
[aBuilder horizontalGroupWith:
[panels do: [:each | each buildOn: aBuilder]]]
HTH,
Colin
The OmniBrowser inspector does exactly that, if you want to have a
look at a running example.
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
Load OB-Tools from http://source.lukas-renggli.ch/omnibrowser/. The
class is named OTInspector IIRC
--
Damien Cassou
http://damiencassou.seasidehosting.st