Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Background-Process / runNonUIThreadWithFakeContext
Background-Process / runNonUIThreadWithFakeContext [message #112060] Tue, 11 November 2008 10:38 Go to next message
Oliver Koch is currently offline Oliver KochFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,
I try to implement a Runnable, which need to interact with the GUI. In
other Messages i have allready read about the problems to start Threads
which want to interact with the session-based components. To handle this,
i use UICallBack#runNonUIThreadWithFakeContext(display, runnable). But now
i have the problem that i can not longer interact with the GUI, if my
process is running (My process is a Listener with an endless while-Loop).
My Question is, are there other possibilities to uses Threads in RAP, Or
is my solution wrong?

PS: with Job it is the self Problem like with Runnable.
Re: Background-Process / runNonUIThreadWithFakeContext [message #112204 is a reply to message #112060] Tue, 11 November 2008 20:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Oliver,

to interact with the UI (i.e. run code on the UI thread) you can use
Display#asyncExec/syncExec. Is it that what you were looking for?

HTH
Rüdiger


Oliver Koch wrote:
> Hi,
> I try to implement a Runnable, which need to interact with the GUI. In
> other Messages i have allready read about the problems to start Threads
> which want to interact with the session-based components. To handle
> this, i use UICallBack#runNonUIThreadWithFakeContext(display, runnable).
> But now i have the problem that i can not longer interact with the GUI,
> if my process is running (My process is a Listener with an endless
> while-Loop). My Question is, are there other possibilities to uses
> Threads in RAP, Or is my solution wrong?
>
> PS: with Job it is the self Problem like with Runnable.
>
Re: Background-Process / runNonUIThreadWithFakeContext [message #112252 is a reply to message #112204] Wed, 12 November 2008 10:03 Go to previous messageGo to next message
Oliver Koch is currently offline Oliver KochFriend
Messages: 12
Registered: July 2009
Junior Member
Hello Rüdiger,

no, with Display#asyncExec the GUI doesn't even load. I just see the
Background from RAP with the blue stripe at the Top.
I add some Code snippets:

public class WorkbenchWindowAdvisorImpl extends WorkbenchWindowAdvisor {
...
public void postWindowOpen() {
final Shell shell = getWindowConfigurer().getWindow().getShell();
Runnable runnable = new Runnable(){
public void run(){
while(true){
if(Event.waitFor()){
MessageDialog.openInformation(shell,"Titel","Message");
}
}
}
}
shell.getDisplay().asyncExec(runnable);
}
...
}

Mfg Oliver


Rüdiger Herrmann wrote:

> Oliver,

> to interact with the UI (i.e. run code on the UI thread) you can use
> Display#asyncExec/syncExec. Is it that what you were looking for?

> HTH
> Rüdiger


> Oliver Koch wrote:
>> Hi,
>> I try to implement a Runnable, which need to interact with the GUI. In
>> other Messages i have allready read about the problems to start Threads
>> which want to interact with the session-based components. To handle
>> this, i use UICallBack#runNonUIThreadWithFakeContext(display, runnable).
>> But now i have the problem that i can not longer interact with the GUI,
>> if my process is running (My process is a Listener with an endless
>> while-Loop). My Question is, are there other possibilities to uses
>> Threads in RAP, Or is my solution wrong?
>>
>> PS: with Job it is the self Problem like with Runnable.
>>
Re: Background-Process / runNonUIThreadWithFakeContext [message #112290 is a reply to message #112252] Wed, 12 November 2008 14:16 Go to previous messageGo to next message
Oliver Koch is currently offline Oliver KochFriend
Messages: 12
Registered: July 2009
Junior Member
Ok...i found the problem...
I use a CallableStatment from the Oracle JDBC-Driver in the loop. If i
start the thread with #asyncExec(), the Instanc Methode #execute() needs
2-3 Minutes to get through. But without #asyncExec(), it just need <1
Second. (??????) I don't understand this behavior.

Mfg
Oliver


Oliver Koch wrote:

> Hello Rüdiger,

> no, with Display#asyncExec the GUI doesn't even load. I just see the
> Background from RAP with the blue stripe at the Top.
> I add some Code snippets:

> public class WorkbenchWindowAdvisorImpl extends WorkbenchWindowAdvisor {
> ...
> public void postWindowOpen() {
> final Shell shell = getWindowConfigurer().getWindow().getShell();
> Runnable runnable = new Runnable(){
> public void run(){
> while(true){
> if(Event.waitFor()){
> MessageDialog.openInformation(shell,"Titel","Message");
> }
> }
> }
> }
> shell.getDisplay().asyncExec(runnable);
> }
> ...
> }

> Mfg Oliver


> Rüdiger Herrmann wrote:

>> Oliver,

>> to interact with the UI (i.e. run code on the UI thread) you can use
>> Display#asyncExec/syncExec. Is it that what you were looking for?

>> HTH
>> Rüdiger


>> Oliver Koch wrote:
>>> Hi,
>>> I try to implement a Runnable, which need to interact with the GUI. In
>>> other Messages i have allready read about the problems to start Threads
>>> which want to interact with the session-based components. To handle
>>> this, i use UICallBack#runNonUIThreadWithFakeContext(display, runnable).
>>> But now i have the problem that i can not longer interact with the GUI,
>>> if my process is running (My process is a Listener with an endless
>>> while-Loop). My Question is, are there other possibilities to uses
>>> Threads in RAP, Or is my solution wrong?
>>>
>>> PS: with Job it is the self Problem like with Runnable.
>>>
Re: Background-Process / runNonUIThreadWithFakeContext [message #112302 is a reply to message #112290] Wed, 12 November 2008 14:58 Go to previous message
Oliver Koch is currently offline Oliver KochFriend
Messages: 12
Registered: July 2009
Junior Member
Ok,

everything works fine now :)!!
Thanks a lot for the help.

Live Long and Posper
Oliver
Previous Topic:Server-Push/ asyncExec / java.lang.OutOfMemoryError
Next Topic:color of inactive input elements
Goto Forum:
  


Current Time: Sun Jan 29 07:08:52 GMT 2023

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

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

Back to the top