Ary Borenszweig

Ary Borenszweig

Eclipse Plugin to sort proposals by hierarchy

2 min
Mar 16 2009
coding
2 min
Mar 16 2009

Again, Sergio, a friend of mine, came up with a need: to sort Eclipse Java proposals by hierarchy. What that means is that if you have a type C < B < A (where < means subclass of), first C's methods will be shown, then B's methods and finally A's methods.

This is specially useful when writing GUI code with libraries like Swing or SWT, because when you request a ComboBox's members you'd normally want to set or change the items to show, what to do when you select an item, maybe less often what's the size of the component, etc. You'd almost never use methods in bottom-level classes like Object.

So I made a plugin that does exactly that. And better: the proposals are first sort by hierarchy and then by relevance (JDT's default order which takes into account, for example, the type of the expected expression).

You can download a copy for free that comes with the source code. To active it first copy the JAR into your plugins directory. Then open Eclipse and go to Windows -> Preferences -> Java -> Editor -> Content Assist and select "by hierarchy" in the combo "Sort proposals".

Enjoy!