In this new Eclipse Corner article, “Eclipse Workbench: Using the Selection Service“, author Marc R. Hoffmann describes (oddly enough) the selection service provided by the Eclipse workbench, how it is used by Eclipse and how you can use it in your own plug-ins and RCP applications.
I used Marc’s article to aid my own understanding of the selection service and have used that understanding to build numerous plug-ins that are very tightly integrated with each other through the selection service, but are loosely coupled. In my eBay RCP example, I use the selection service to communicate between views; the “categories” view produces a selection (the selected category), and the “items” view consumes it (displaying the items in the selected category). Both views know about the auction object models, but neither view knows anything about the other. I also used the selection service in my image viewer example. This service, an example of the observer pattern, provides a lot of power.
If you’re building plug-ins for Eclipse or RCP applications, this article is a must-read.