Eclipse RCP: how to register an ISourceProviderListener
today i tried the following:
I have:
- a View with a form (FormView)
- a
AbstractSourceProvider
(Provider) to provide changes in 开发者_如何学JAVAFormView to the world - a View (ConsumerView) that should consume information from Provider it implements
ISourceProviderListener
FormView updates the Provider, which fires the fireSourceChanged
. But how can I register the ConsumerView so that it listens for changes in the Provider?
This answer here on stackoverflow, did not really explain how to do it: How to communicate between views in Eclipse RCP?
Also Lars Vogels tutorials on RCP Commands are mentioned frequently, but I don't get it from there.
Thanks for your help in advance!
From within your ConsumerView createPartControl(..)
method:
ISourceProviderService service = (ISourceProviderService)getSite().getService(ISourceProviderService.class);
ISourceProvider yourProvider = service.getSourceProvider("yourSourceProviderName");
yourProvider.addSourceProviderListener(this);
精彩评论