WizardDialog waitCursor null when #stopped called [message #1121285] |
Mon, 30 September 2013 09:08  |
Eclipse User |
|
|
|
We've made minor changes to WizardProjectImportPage (Import existing projects into workspace) and I'm getting an error but only when running as an SWTBot Test, i.e. it works manually. I'm not sure if it's the changes I've made or a bug in SWTBot.
WizardProjectImportPage#createProjects creates a new WorkspaceModifyOperation (implements IRunnableWithProgress) and passes it to WizardDialog to run and use it's progress monitor via:
getContainer().run(true, true, op);
...then in WiardDialog.run():
...
ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
lockedUI=false;
}
finally
{
...
stopped(state);
...then when WizardDialog#stopped is called I'm getting a NullPointerException when it does:
I've tried debugging with no success. It seems that SWTBot has messed with the cursor somehow.
Any ideas?
Craig
[Updated on: Mon, 30 September 2013 15:33] by Moderator
|
|
|
|
|
|
|
|
Re: WizardDialog waitCursor null when #stopped called [message #1122563 is a reply to message #1122375] |
Tue, 01 October 2013 14:04  |
Eclipse User |
|
|
|
Yes, sorry, I'm using SWTBot-2.1.0, not 2.10. I see 2.1.1 is out; I looked at its release notes but didn't see anything related to this.
I do use waitWhile and waitUntil a lot. I've been using SWTBot for awhile now and really like the API. Throwing in a Condition now and again is pretty simple and usually makes sense. In this case I get the Finish button and invoke its click() then I have a condition that waits until the dialog closes before progressing (I get all the shells and cycle through their titles to be sure). The problem is that it never gets to its close{}. Upon performFinish() several RunnableWithProgress classes are run, updating the dialog's ProgressMonitor, writing to disk, and cycling through waitCursors. Then, when all are done, the waitCursor is again disposed and nulled but this dispose() causes the NPE. I don't see how but I think maybe not running in the UI thread is interfering with the waitCursor such that it gets nulled (or not even created) before the last RunnableWithProgress completes. I tried wrapping the finishButton.click() in a UIThreadRunnable but got the same result. Of course running the whole test in UI thread won't work because dialogs can't then be closed.
Interestingly, running the same test without checking the "Copy project into workspace" radio button works fine. It does only half the work and uses fewer RunnableWithProgress classes as when copying though so that may account for it somehow.
Testing the stock wizard is pretty straightforward. I can't imagine tests can be written that vary very much that might reveal a path that completes. So I'm convinced its not testable as is. Not sure who's at fault, eclipse or SWTBot, but probably neither. Maybe in eclipse 4.x it's different. Anyway, I've marked that test @Ignore and will have to move on. Thanks very much for your help, at least I don't think it's anything I'm doing wrong now.
Craig
|
|
|
Powered by
FUDForum. Page generated in 0.04075 seconds