Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » JFace Action and Thread -> QUID ? Why no GUI refresh ???
JFace Action and Thread -> QUID ? Why no GUI refresh ??? [message #463698] Sat, 12 November 2005 21:14 Go to next message
jmi is currently offline jmiFriend
Messages: 84
Registered: July 2009
Member
Hi,

I create an SWT application with JFace Action. I have a problem of thread synchronization i think.
When a process a search with the action defined here after (view code), the GUI is not refresh before the end of the Thread.

What can i do to solve this ?

Thanks

JMi


import org.eclipse.jface.action.Action;
...

public class MyAction extends Action {

...

/**
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
try {
runBusy();
} catch (final MyException argE) {
// TODO - faire traitement
// throw argE;
} catch (final Exception argE) {
// TODO - faire traitement
LOG.error(argE.getMessage(), argE);
// throw new MyException(argE);
}
}
});
}

protected void runBusy() throws MyException {
try {
<b>// MY PROBLEM : Reset all the fields -> set all the fields to "blank"
// Unfortunatelly, it is done after the thread finished...
// Do i have to call another thread ????</b>
viewer.refreshWithEmptyData();<b>// This is done after the thread finished ???????</b>

String cd = viewer.getCd(false);

if (bo == null) {
bo = new MyBO(dateFormat);
}

// Get data from the server
MyDataTO data = bo.findByCd(cd);

if (data != null) {
// Display the data
viewer.setData(data);
}
// set focus
viewer.setFocus();
} catch (final MyException argE) {
viewer.unsetData(false);
throw argE;
} catch (final Exception argE) {
LOG.error(argE.getMessage(), argE);
viewer.unsetData(false);
throw new MyException(argE);
}
}

...
Re: JFace Action and Thread -> QUID ? Why no GUI refresh ??? [message #463701 is a reply to message #463698] Sat, 12 November 2005 22:44 Go to previous message
me is currently offline meFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Jmi,

jmi schrieb:
> Hi,
>
> I create an SWT application with JFace Action. I have a problem of thread synchronization i think.
> When a process a search with the action defined here after (view code), the GUI is not refresh before the end of the Thread.
>
> What can i do to solve this ?

I think you should use the "Job"-API

There is an article on eclipse.org wich describe how to use them.

http://www.eclipse.org/articles/Article-Concurrency/jobs-api .

marc
Previous Topic:SWT Layout and Widget Question
Next Topic:data input verifying
Goto Forum:
  


Current Time: Thu Apr 25 06:52:54 GMT 2024

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

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

Back to the top