I have multiple views in an eclipse RCP application:
我在eclipse RCP应用程序中有多个视图:
1) map view with push pin icons 2) list view of all push pins 3) a view displaying the push pin properties
1)使用推针图标的地图视图2)所有推针的列表视图3)显示推针属性的视图
I also have a model object with a get/setActivePushPin acessor methods.
我还有一个带有get / setActivePushPin acessor方法的模型对象。
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.
我意识到每个视图都需要有一个ISelectionListener,但似乎侦听器应该专门针对推针选择事件挂钩到一个常见的ISelectionProvider,而不是显式挂钩到特定的视图。
2 个解决方案
#1
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 -
这篇developerWorks文章“使您的Eclipse应用程序更富有视图链接”几乎完全描述了您的示例。它特别好,因为它描述了同一问题的两个'pardigms' -
- 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".
有关选择服务如何工作的更详细的文章来自这篇eclipse.org文章:“Eclipse Workbench:使用选择服务”。
#2
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
您需要使用全局选择服务,该服务协调整个工作台的选择。请参阅描述“选择服务”及其用法的文章:http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html
#1
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 -
这篇developerWorks文章“使您的Eclipse应用程序更富有视图链接”几乎完全描述了您的示例。它特别好,因为它描述了同一问题的两个'pardigms' -
- 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".
有关选择服务如何工作的更详细的文章来自这篇eclipse.org文章:“Eclipse Workbench:使用选择服务”。
#2
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
您需要使用全局选择服务,该服务协调整个工作台的选择。请参阅描述“选择服务”及其用法的文章:http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html