UICallBack mechanism [message #512533] |
Fri, 05 February 2010 06:53  |
Eclipse User |
|
|
|
I tried UICallBack.activate/deactivate, but that does not seem to work in this case:
// in a background job:
{
doSomething();
notifyListeners(display)
}
// the listener:
{
display.asyncExec( new Runnable() {
public void run() {
String uuid = UUID.randomUUID().toString();
UICallBack.activate(uuid);
updateUI();
UICallBack.deactivate(uuid);
}
}
}
A background job must notify its listeners that it has finished. Now, in the listener I want to update the ui. When using activate/deactivate, I have this problem: ui is not refreshed until I click somewhere.
Am I right, that I have to call UICallBack.activate before the background job starts and UICallBack.deactive when it has finished?
How to do this if I do not know where the background job is started or if the background job is started somewhere I have no access to?
|
|
|
Re: UICallBack mechanism [message #512880 is a reply to message #512533] |
Sun, 07 February 2010 23:42  |
Eclipse User |
|
|
|
On 05.02.2010 12:53, Erdal Karaca wrote:
> I tried UICallBack.activate/deactivate, but that does not seem to work
> in this case:
>
> // in a background job:
> {
> doSomething();
> notifyListeners(display)
> }
>
> // the listener:
> {
> display.asyncExec( new Runnable() {
> public void run() {
> String uuid = UUID.randomUUID().toString();
> UICallBack.activate(uuid);
> updateUI();
> UICallBack.deactivate(uuid);
> }
> }
> }
>
> A background job must notify its listeners that it has finished. Now, in
> the listener I want to update the ui. When using activate/deactivate, I
> have this problem: ui is not refreshed until I click somewhere.
>
> Am I right, that I have to call UICallBack.activate before the
> background job starts and UICallBack.deactive when it has finished?
You are right, the UICallback must be activated from within the
UI-Thread (i.e. while a "normal" request is running) *before* the
background thread needs to update the UI.
> How to do this if I do not know where the background job is started or
> if the background job is started somewhere I have no access to?
You could start the UICallback "well ahead" (e.g. at session startup) at
the cost of having an extra request that is blocked at the server while
the UICallback is active.
Another approach could be to write some custom Javascript that polls the
server for updates.
Depending on your actual use case there might be other options - feel
free to share...
|
|
|
Powered by
FUDForum. Page generated in 0.03875 seconds