When I try to use just a Thread.sleep, the progress dialog shows. If I call the actual long running operation, the progress dialog either doesn't show, either shows after a few seconds, at the end of the long running operation.
I really have no idea where this behavior is coming from. Could anyone please help me?
Code:
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();
Alexandra.