|
|
|
Re: How to close Jface wizard while progress bar is running for a long time [message #335348 is a reply to message #335347] |
Fri, 03 April 2009 10:23 |
Sebastian Paul Messages: 106 Registered: July 2009 |
Senior Member |
|
|
Naag wrote:
> Hi prakash
>
> I have set the cancelled flag as true. I couldnt see any cancel image
> enabled next to progressbar.
>
> I am using a long run operation in wizard page. getContainer().run method
>
>
> //Sample code
> getContainer().run(true, true, new IRunnableWithProgress() {
This is correct. By providing cancelable=true, the Cancel Button will be
enabled while the operation is running.
> public void run(IProgressMonitor monitor) throws
> InvocationTargetException, InterruptedException {
> monitor.begintask("");
> //SDK and DB calls to fill the data to UI
Here, you have to check monitor.isCanceled() after each call and throw
an InteruptedException when it is true. See the JavaDoc of
IRunnableWithProgress.
>
> monitor.done();
> }
>
> what should i do now? please help me out
You have to catch the InteruptedException and close the wizard with
getShell().close().
This is a little bit ugly, as you make an assumption that the shell is
owned by the WizardDialog. In fact, a Wizard could be run by a container
that is no WizardDialog. For example, it could be run embedded in the
workbench window. Calling shell.close() here would have another meaning.
Anyway, WizardDialog is the only container I was using so far, and
AFAICS shell.close() is the only way of closing the wizard programmatically
>
> Thanks for the eclipse tips site
> NAAG
>
Regards, Sebastian
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04338 seconds