Why doesn't Job show the progress dialog? [message #632298] |
Tue, 12 October 2010 09:39  |
Eclipse User |
|
|
|
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 05:07] by Moderator
|
|
|
|
|
|
|
|
|
Re: Why doesn't Job show the progress dialog? [message #634624 is a reply to message #634616] |
Fri, 22 October 2010 09:13  |
Eclipse User |
|
|
|
Hi.
There shouldn`t be any problem calling any method outside your server. If your method returs quickly, obviously, the popup won't show up, or it will for a few seconds. When you are adding Thread.sleep(xxx) you are making it long more time.
But in both cases, it shouldn't freeze you UI.
|
|
|
Powered by
FUDForum. Page generated in 0.85756 seconds