Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Display#asynExec since 1.3.0-M7
Display#asynExec since 1.3.0-M7 [message #659262] Fri, 11 March 2011 11:35 Go to next message
Eclipse UserFriend
Hi RAP Team,

Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
however this seems to break my unit test. Currently we have code
similliar below:

Button button = ....

SelectionAdapter adapter = new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event)
{
doSomething();
}
};
button.addSelectionListener(adapter);

void doSomething()
{
Display.getCurrent().asynExec
(
new Runnable()
{
public void run()
{
}
}
)
}

I can run my application as usual just fine, but in unit tests in which
I call method 'doSomething' directly the Runnable's run won't get
invoked at all.


Any help would be greatly appreciated.

Thanks & Regards,

Setya
Re: Display#asynExec since 1.3.0-M7 [message #659334 is a reply to message #659262] Sat, 12 March 2011 07:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

After debugging I found that the following code :

while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
}

had been removed from RWTLifeCycle#afterPhaseExecution.

And there was a comment stating that by removing the code
asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
would not be processed in the same request.

Any workaround on this ?

Thanks & Regards,

Setya

> Hi RAP Team,
>
> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
> however this seems to break my unit test. Currently we have code
> similliar below:
>
> Button button = ....
>
> SelectionAdapter adapter = new SelectionAdapter()
> {
> public void widgetSelected(SelectionEvent event)
> {
> doSomething();
> }
> };
> button.addSelectionListener(adapter);
>
> void doSomething()
> {
> Display.getCurrent().asynExec
> (
> new Runnable()
> {
> public void run()
> {
> }
> }
> )
> }
>
> I can run my application as usual just fine, but in unit tests in which
> I call method 'doSomething' directly the Runnable's run won't get
> invoked at all.
>
>
> Any help would be greatly appreciated.
>
> Thanks & Regards,
>
> Setya
>
>
Re: Display#asynExec since 1.3.0-M7 [message #659342 is a reply to message #659334] Sat, 12 March 2011 08:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

My workaround so far is:

while (Display.getCurrent().readAndDispatch()){}

Any better workarounds are welcome.


Thanks & Regards,

Setya

> Hi all,
>
> After debugging I found that the following code :
>
> while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
> }
>
> had been removed from RWTLifeCycle#afterPhaseExecution.
>
> And there was a comment stating that by removing the code
> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
> would not be processed in the same request.
>
> Any workaround on this ?
>
> Thanks & Regards,
>
> Setya
>
>> Hi RAP Team,
>>
>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>> however this seems to break my unit test. Currently we have code
>> similliar below:
>>
>> Button button = ....
>>
>> SelectionAdapter adapter = new SelectionAdapter()
>> {
>> public void widgetSelected(SelectionEvent event)
>> {
>> doSomething();
>> }
>> };
>> button.addSelectionListener(adapter);
>>
>> void doSomething()
>> {
>> Display.getCurrent().asynExec
>> (
>> new Runnable()
>> {
>> public void run()
>> {
>> }
>> }
>> )
>> }
>>
>> I can run my application as usual just fine, but in unit tests in which
>> I call method 'doSomething' directly the Runnable's run won't get
>> invoked at all.
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>
>
Re: Display#asynExec since 1.3.0-M7 [message #659617 is a reply to message #659342] Mon, 14 March 2011 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Setya,

your 'workaround' is actually the proper solution to the problem. You
need to spin the event loop to get messages processed. This includes
(a)sync runnables. This behavior now also aligns with how SWT processes
runnables.
Sorry for the late response and the inconvenience.

Regards,
Rüdiger

On 12.03.2011 14:53, Setya wrote:
> Hi all,
>
> My workaround so far is:
>
> while (Display.getCurrent().readAndDispatch()){}
>
> Any better workarounds are welcome.
>
>
> Thanks & Regards,
>
> Setya
>
>> Hi all,
>>
>> After debugging I found that the following code :
>>
>> while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
>> }
>>
>> had been removed from RWTLifeCycle#afterPhaseExecution.
>>
>> And there was a comment stating that by removing the code
>> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
>> would not be processed in the same request.
>>
>> Any workaround on this ?
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>> Hi RAP Team,
>>>
>>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>>> however this seems to break my unit test. Currently we have code
>>> similliar below:
>>>
>>> Button button = ....
>>>
>>> SelectionAdapter adapter = new SelectionAdapter()
>>> {
>>> public void widgetSelected(SelectionEvent event)
>>> {
>>> doSomething();
>>> }
>>> };
>>> button.addSelectionListener(adapter);
>>>
>>> void doSomething()
>>> {
>>> Display.getCurrent().asynExec
>>> (
>>> new Runnable()
>>> {
>>> public void run()
>>> {
>>> }
>>> }
>>> )
>>> }
>>>
>>> I can run my application as usual just fine, but in unit tests in which
>>> I call method 'doSomething' directly the Runnable's run won't get
>>> invoked at all.
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks & Regards,
>>>
>>> Setya
>>>
>>>
>>
>
Re: Display#asynExec since 1.3.0-M7 [message #659894 is a reply to message #659617] Tue, 15 March 2011 18:39 Go to previous message
Eclipse UserFriend
Rudiger,

Thank you for your clarification. Glad to know that I don't have to hack
anything.


Thanks & Regards,

Setya

> Setya,
>
> your 'workaround' is actually the proper solution to the problem. You
> need to spin the event loop to get messages processed. This includes
> (a)sync runnables. This behavior now also aligns with how SWT processes
> runnables.
> Sorry for the late response and the inconvenience.
>
> Regards,
> Rüdiger
>
> On 12.03.2011 14:53, Setya wrote:
>> Hi all,
>>
>> My workaround so far is:
>>
>> while (Display.getCurrent().readAndDispatch()){}
>>
>> Any better workarounds are welcome.
>>
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>> Hi all,
>>>
>>> After debugging I found that the following code :
>>>
>>> while(
>>> UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
>>> }
>>>
>>> had been removed from RWTLifeCycle#afterPhaseExecution.
>>>
>>> And there was a comment stating that by removing the code
>>> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
>>> would not be processed in the same request.
>>>
>>> Any workaround on this ?
>>>
>>> Thanks & Regards,
>>>
>>> Setya
>>>
>>>> Hi RAP Team,
>>>>
>>>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>>>> however this seems to break my unit test. Currently we have code
>>>> similliar below:
>>>>
>>>> Button button = ....
>>>>
>>>> SelectionAdapter adapter = new SelectionAdapter()
>>>> {
>>>> public void widgetSelected(SelectionEvent event)
>>>> {
>>>> doSomething();
>>>> }
>>>> };
>>>> button.addSelectionListener(adapter);
>>>>
>>>> void doSomething()
>>>> {
>>>> Display.getCurrent().asynExec
>>>> (
>>>> new Runnable()
>>>> {
>>>> public void run()
>>>> {
>>>> }
>>>> }
>>>> )
>>>> }
>>>>
>>>> I can run my application as usual just fine, but in unit tests in which
>>>> I call method 'doSomething' directly the Runnable's run won't get
>>>> invoked at all.
>>>>
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks & Regards,
>>>>
>>>> Setya
>>>>
>>>>
>>>
>>
Previous Topic:[ANN] IMPORTANT: Platform filters in RAP
Next Topic:Setting up a standalone RWT Eclipse development environment
Goto Forum:
  


Current Time: Tue Jul 08 08:14:26 EDT 2025

Powered by FUDForum. Page generated in 0.05333 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top