Using the Common Navigator Framework in an RCP Application

The Common Navigator Framework was introduced in Eclipse 3.2 to provide navigators with pluggable content, filters, sorting and much else. It’s a powerful new feature, but for some reason it wasn’t made to work with the RCP. In my opinion. every significant addition to the Eclipse API should be made RCP compatible unless it’s really IDE specific. RCP compatibility shouldn’t just be an afterthought, it should be a core design principle. Ok, I’ll get off my soapbox now.

RCP developers have gone through a lot of pain trying to get the CNF to work, and most of these attempts involve trying to fake out the mechanism that discovers a navigator’s root node. The approach I’ve taken is a bit simpler – just extend it. The core of the CNF is the CommonNavigator class, which is meant to be used as is. My approach is to extend this class and override the getInitialInput method, which is responsible for root node discovery. I’ve done this on a number of projects, and the rest of the CNF works as expected.

Hopefully someday I’ll be able to use the CNF as intended, but this is a small price to pay for now.