Why doesn't Job show the progress dialog? [message #632298] |
Tue, 12 October 2010 13:39 |
Alexandra Niculai Messages: 84 Registered: July 2009 |
Member |
|
|
Hi
I've been struggling with this for some time.
I want to use jobs for my long actions.
I read in the documentation and in a lot of examples that running a job should show a progress dialog with an option to run in the background. Also, the job would not block the interface.
In my case, none of these happen.
If I try to run a job with only a sleep action inside, I get the progress dialog and my app remains responsive.
But as soon as I replace the sleep with a real method, the progress dialog doesn't show at all(or it shows for 0.25 seconds at the end, even if the job does take quite some time) and the UI isn't responsive anymore.
Here's also a snippet:
Job job = new Job("Cancelling edition") {
@Override
public IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Cancelling edition...",
IProgressMonitor.UNKNOWN);
IStatus status = Status.OK_STATUS;
try {
protocol.cancelEdition();
} catch (Exception e) {
status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "",
e);
Status failStatus = new Status(IStatus.ERROR,
Activator.PLUGIN_ID, "", e);
StatusManager.getManager().handle(failStatus,
StatusManager.LOG);
} finally {
monitor.done();
}
return status;
}
};
job.setUser(true);
job.schedule();
I also noticed that the application remains responsive if I don't set the job as user job.
Please help!
Thank you!
Alexandra.
[Updated on: Thu, 14 October 2010 09:07] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Why doesn't Job show the progress dialog? [message #634616 is a reply to message #634221] |
Fri, 22 October 2010 12:54 |
Alexandra Niculai Messages: 84 Registered: July 2009 |
Member |
|
|
Hi,
Asked my colleague about the function and it's not returning until it's done.
This function is actually called on a CORBA object.
If I call anything that's not on the server, the interface reacts as expected.
Could this be the reason for the strange behavior of the interface?
If I run a debug with breakpoint exactly on that method, the progress dialog appears and the interface doesn't freeze, so debugging doesn't seem to help much now.
So I added a before the method and the progress dialog appeared, but the interface still freezes if I try to click on something while the job is being executed.
The dialog doesn't show if I put the Thread to sleep for less then 1000 millis.
Alexandra.
[Updated on: Fri, 22 October 2010 13:06] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03745 seconds