Friday, October 26, 2007

Communication between Views using eventLoopIdle

I have been working on an application that is now up to 3 swing components embedded in my Eclipse RCP / SWT application. This has become problematic having these 3rd party components to communicate properly with each other. While it is easy to communicate with these other components embedded in other views I was having a problem with RCP not properly repainting the screen. So I have come up with a work around that works for me and I thought I would share it with any other Eclipse Rich Client Platform developer out there that may be struggling.

If you open up ApplicationWorkbenchAdvisor.java - there is a function in there called public void eventLoopIdle(Display display). In this function I put my calls. I used my Application Singleton class to facilitate communication. By adding a semaphore type variable I can see if other views need to go and update their screen. In my specific case a user has a view of a PDF and when they click on an action object this needs to send the file information to a chart window that then opens the file clicked on in the PDF view, parse it and display the chart with the give options defined by the PDF link.

If you have any questions on this just email or leave me a comment. Good luck!

2 comments:

Heliodor Jalba said...
This comment has been removed by the author.
Heliodor Jalba said...

You can also do it with a part listener. Take a look at http://heliodorj.blogspot.com/2008/08/communication-between-views-in-eclipse.html