Background-Process / runNonUIThreadWithFakeContext [message #112060] |
Tue, 11 November 2008 05:38  |
Eclipse User |
|
|
|
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 05:03   |
Eclipse User |
|
|
|
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 09:16   |
Eclipse User |
|
|
|
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.
>>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.41952 seconds