Hi,
David R. and I are playing with Glamour, a cool
framework to define
browsers.
:)
Currently, the Moose browser @ Pharo uses OB. Although
it works
fine, it sticks to the Smalltalk way of browsing code, which we find
a bit limited.
I apology in advance for cutting & pasting code here. We defined the
following method:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
mooseFinder
| browser |
browser := GLMFinder new .
browser list
display: [:each | each entities];
when: [:each | "(each isKindOf: MooseAbstractGroup)" each ==
MooseModel root ].
browser list
title: 'Classes';
display: [:each | each allClasses ];
when: [:each | (each isKindOf: MooseAbstractGroup) and: [each
allClasses notEmpty] ].
browser list
title: 'Methods';
display: [:each | each allMethods ];
when: [:each | (each isKindOf: MooseAbstractGroup) and: [each
allMethods notEmpty] ].
browser list
title: 'Superclasses';
display: [:each | each superclassHierarchyGroup ];
when: [:each | (each isKindOf: FAMIXClass) and: [each
superclassHierarchyGroup notEmpty]].
browser list
title: 'Subclasses';
display: [:each | each subclassHierarchy ];
when: [:each | (each isKindOf: FAMIXClass) and: [each
subclassHierarchy notEmpty]].
^ browser
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
It shows up a small MacOSX-like finder that shows classes,
superclasses and subclasses. Very cool!
Few questions now:
- Lists (Classes, Methods, Superclasses, Subclasses) are statically
defined. In Moose however, these are defined with pragmas. How can
we describe the automatic generations of lists?
Just traverse the pragmas and for each you do a "browser list ...
when: [:each | each isKindOf: the-class-where-the-pragma-is...".
- If we want to embed this browser into a bigger one,
how do we
pass the right-most selected element ? Using a
GLMTableLayoutBrowser, one would do a "browser sendTo: #outer ->
#selectedElement from: #element" (modulo names). Here, we need
something like "browser sendTo: #outer -> #lastSelection".
Indeed, this is not done yet.
Just a note. We wanted to release Glamour a while ago, but we got
delayed. At the moment, the development of Glamour is done in VW and
we just port the code 1-to-1 to Squeak. So, if you change the Glamour
code in Squeak, it will probably be overriden the next time we move it
to Squeak.
Right now, the code in Squeak is a bit behind the one in VW.
Cheers,
Doru
--
www.tudorgirba.com
"The coherence of a trip is given by the clearness of the goal."