views:

1151

answers:

2

I have multiple views in an eclipse RCP application:

1) map view with push pin icons 2) list view of all push pins 3) a view displaying the push pin properties

I also have a model object with a get/setActivePushPin acessor methods.

How do I properly coordinate the push pin selection?

When I select a push pin on either the map or list view, the active push pin should change and the other view should be notified.

I realize each view needs to have a ISelectionListener, but it seems that the listeners should be hooking into a common ISelectionProvider specifically for push pin selection events rather than explicitly hooking into a particular view.

A: 

You need to use global Selection Service, which coordinates selection for entire workbench. See article describing "Selection Service" and its usage: http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html

Peter Štibraný
+1  A: 

This developerWorks article "Make your Eclipse applications richer with view linking" describes almost exactly your example. It is especially good as it describes two 'pardigms' to the same problem -

  • selection provider-selection listener paradigm
  • property change listener paradigm

A more detailed article on how the selection service works comes from this eclipse.org article: "Eclipse Workbench: Using the Selection Service".

jamesh