About OmniBrowser code :)

stéphane ducasse ducasse at iam.unibe.ch
Wed Dec 8 15:38:17 UTC 2004


On 8 déc. 04, at 16:23, Jon Hylands wrote:

> On Tue, 7 Dec 2004 20:27:06 -0500, Colin Putney <cputney at wiresong.ca>
> wrote:
>
>> Ok, you caught me. This isn't implemented yet. I hardly ever use
>> hierarchy browsers, so this one fell through the cracks. I'll put one
>> in the next release.
>
> Colin,
>
> One thing that I would really like to see, and it would make 
> OmniBrowser
> become my number one choice for a browser, would be if you could have 
> an
> option to list the classes in the class pane in hierarchical order.
>
> Among classes, alphabetical order means nothing, except to make binary
> search faster. Having the "structure" of the classes you are looking at
> apparent in the browser is exceptionally nice.
>
> Cincom finally did this in VisualWorks a few versions ago, and Anthony
> Lander and I put it into the browser that we built at The Object People
> back in the early nineties.
>
> I did a quick paintbrush job on the System Browser in one of my 
> images, and
> you can see it in the following two pictures. The first is the standard
> browser with an alpha class listing, the second is the same browser 
> with a
> hierarchical class listing.

Indeed this is really cool.
BTW what are the fonts you use?

>
> http://www.huv.com/Browser-1.jpg
> http://www.huv.com/Browser-2.jpg
>
> Basically, you get more useful information in the browser when the 
> classes
> are listed this way.
>
> Here's the code from that browser, modified to work in Squeak. It 
> takes a
> collection of classes that are visible in the class list, and indents 
> them
> and puts them in hierarchical order... Its a nice recursive method, 
> and it
> is fast as well. I'm not sure if it will fit into how you do things in 
> OB,
> but it works pretty well.
>
> Later,
> Jon
>
> ----------------------------------
>
> hierarchyOfClasses: classes
>
> 	| classSet hierarchy |
> 	classes isEmpty
> 		ifTrue: [^classes].
> 	classSet := classes asSet.
>
> 	Cursor execute showWhile: [
> 		hierarchy := OrderedCollection new: classes size.
> 		self
> 			putHierarchyFrom: (Array with: ProtoObject)
> 			with: classSet
> 			into: hierarchy
> 			withIndent: ''].
>
> 	^hierarchy
>
> putHierarchyFrom: rootCollection with: visibleClasses into: hierarchy
> withIndent: indentString
>
> 	rootCollection do: [:each |
> 		| subclasses |
> 		subclasses := each subclasses asSortedCollection: [:a :b |
> 			a name <= b name].
> 		(visibleClasses includes: each)
> 			ifTrue: [
> 				hierarchy add: indentString, each name.
> 				self
> 					putHierarchyFrom: subclasses
> 					with: visibleClasses
> 					into: hierarchy
> 					withIndent: indentString, '  ']
> 			ifFalse: [
> 				self
> 					putHierarchyFrom: subclasses
> 					with: visibleClasses
> 					into: hierarchy
> 					withIndent: indentString]].
>
>
> --------------------------------------------------------------
>    Jon Hylands      Jon at huv.com      http://www.huv.com/jon
>
>   Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
>            http://www.huv.com
>
>




More information about the Squeak-dev mailing list