Project: Eclipse_Platform_UI
Bug 271530 [Wizards] Wizard progress label not cleared between runnables
Reported: 2009-04-07 17:53:20 | Status: verified fixed

I have a wizard that has multiple p2 IUs in a list, and when the user selects one I need to call p2 to get a provisioning plan (a semi-long-running operation) to determine if Finish should be disabled. To do this, I call WizardPage.getContainer().run() and fork an IRunnableWithProgress to call a p2 method with a progress monitor. I noticed several times that when I made a selection in the list the progress monitor label would flash before progress would start to appear. I clicked quickly several times and was able to read that the label was actually an error message from p2. I then set a breakpoint, and found that the error is visible *before* entry into my IRunnableWithProgress. It was actually a failure from the last time that p2 was called, i.e. in a separate runnable the last time I clicked. I tried to narrow this down, but the best I could find is that the wizard dialog never calls through to ProgressMonitorPart.updateLabel() before running - so when a new runnable starts, the monitor will display text from the previous monitor before calling the new one. If the new monitor isn't updated immediately, the old text will appear until the new monitor does something. You can reproduce with the following code. The second time you call it, the progress label will say "Testing!" immediately even though the monitor hasn't been called yet. getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { Thread.sleep(5000); } catch (Exception e) { // ignore } monitor.beginTask("Testing!", 100); } });

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/ProgressMonitorPart.java bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardProgressMonitorTest.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/wizards/WizardTestSuite.java