Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:35 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 12:46 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 13:53 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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 19:00 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
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 22:39 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
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: Sat Nov 27 18:39:09 GMT 2021

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

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

Back to the top