Hi, this is my first question on stackoverflow (sorry about my english). I'll try to explain the problem as well I can.
I have an swt application with a foreground jade application in which I have a progress bar to inform the duration of the application. To refresh this progress bar I use:
if(Display.getCurrent() != null) {
progress.run();
}
else {
sShell.getDisplay().syncExec(progress);
}
Progress is:
Runnable progress = new Runnable() {
public void run () {
if (progressBar.isDisposed ())
return;
int percentage= (numStep*100)/maxSteps;
progressBar.setSelection(percentage);
if (numStep >= maxSteps){
label1.setText("The simulation has been completed.");
button.setEnabled(true);
}
}
};
I try to analyze the time that this Runnable takes and it is constant, but when I analyze this line sSehll.getDisplay().syncExec(progress)
takes different times (from 0ms to XXXXms)
I have read this
syncExec(Runnable runnable) causes the current thread (if it is different than the user interface thread of the display) to wait for the runnable to finish.
But the Runnable is time constant...
Can someone guide me? I don't understand why sometimes takes 3 minutes and some other time.
Thanks