Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In Eclipse RCP, I am creating views for the Perspective using IPageLayout.addView(...)

But this way I don't have a reference to the view. Therefore I don't know how I can tell ViewA to update ViewB.

What's the best pattern to use here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
137 views
Welcome To Ask or Share your Answers For Others

1 Answer

Besides what VonC has mentioned above, you can also use ISourceProviderListener if the changes you need are not triggered by selection.

  • Have ViewB implements ISourceProviderListener
  • Create an implementation of ISourceProvider and register it in the services
  • Have ViewA get the ISourceProvider and update it to trigger the changes in ViewB

Read the documentation on those interfaces along with IServiceLocator and ISourceProviderService to get better idea how it all plays out.

You can also see this Lars Vogel's tutorial which has some example how to use the ISourceProvider


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...