Need reference to Display in RAP app [message #665751] |
Fri, 15 April 2011 13:58  |
Eclipse User |
|
|
|
I understand that when I need to touch UI objects from a non-UI thread, I need to wrap the call in a runnable provided as an argument to UICallBack.runNonUIThreadWithFakeContext().
However, that method also requires a reference to the Display. I can't call the static methods I would in an RCP app (e.g. PlatformUI.getDisplay()) because this call itself would need to be made through UICallBack.
So how do I get a reference to the Display? The only thing I found that works is to create a static accessor to it in my entry point bundle, where the Display is created and then used to create the workbench. But this gives me a dependency on my entry point from my application code, which I don't want. Besides the general opinion that this is a bad design, I can't create the war file with this dependency present. Equinox complains that it's an unsatisfied dependency even though the entry point plug-in is present and has an entry in config.ini.
So is there a way to get a reference to the workbench Display object from any of the user sessions? Is there in fact only one Display created for the application, or does one get created for each user session?
|
|
|
|
Re: Need reference to Display in RAP app [message #666086 is a reply to message #666059] |
Mon, 18 April 2011 23:51  |
Eclipse User |
|
|
|
Thanks for setting me straight on that, Ralf. Display#asycExec() takes care of what I'm doing currently. I can get the Display from the Control I'm working with, but I don't see a way to get a Display from the Workbench. When I tried it, it threw the same IllegalStateException that led me to UICallback in the first place.
I thought I needed a reference to Display in a class that had no references to UI objects. It seemed I was getting an IllegalStateException while calling DeferredTreeContentManager#startFetchingDeferredChildren(). But I just re-ran the code without using UICallback or Display#asyncExec, and it ran fine. So I must have been mistaken about the source of that Exception.
My code is working properly now, without the static reference to Display. But I don't think I can get a reference to a Display in RAP where I don't have a reference to a UI object. And I see now that UICallback is how I would get access to session state.
|
|
|
Powered by
FUDForum. Page generated in 0.30217 seconds