Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsUICallBack mechanism
https://www.eclipse.org/forums/index.php/mv/msg/162119/512533/#msg_512533
// 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?]]>Erdal Karaca2010-02-05T11:53:32-00:00Re: UICallBack mechanism
https://www.eclipse.org/forums/index.php/mv/msg/162119/512880/#msg_512880
> 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...]]>RĂ¼diger Herrmann2010-02-08T04:42:06-00:00