how to open a MessageDialog from progress monitor run method. [message #120693] |
Tue, 02 September 2003 17:58  |
Eclipse User |
|
|
|
Hi,
I am using a wizard and in my perform finish i start a
ProgressMonitorDialog. If i get an error then i am unable to open a
MessageDialog mentioning that error to the user. I always get invalid thread
acces. Can someone help me in opening a messagedialog from progress monitor
run method.
Here is the code.
public boolean performFinish() {
ProgressMonitorDialog pmd =
new ProgressMonitorDialog( myWizardPage.getShell() );
pmd.setBlockOnOpen( false );
try {
pmd.run( true, true, new IRunnableWithProgress() {
public void run( IProgressMonitor iProgressMonitor )
throws InvocationTargetException, InterruptedException {
iProgressMonitor.beginTask( "...", 2 );
PublishUtil.processPublish( iProgressMonitor );
try {
.......
}catch ( Exception e ) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveW orkbenchWindow()
..getShell(),
"Exception",
e.getMessage() );
}
}
} );
} catch ( InvocationTargetException e ) {
} catch ( InterruptedException e ){
} finally{
pmd.close();
}
return true;
}
-thanks
Khurrum
|
|
|
Re: how to open a MessageDialog from progress monitor run method. [message #121591 is a reply to message #120693] |
Tue, 02 September 2003 21:39  |
Eclipse User |
|
|
|
Frequently Asked Question #234
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MessageDialog.openError(.....);
});
Chris
"Khurrum" <khurrum.abdullah@certive.com> wrote in message
news:bj33pd$seg$1@eclipse.org...
> Hi,
>
> I am using a wizard and in my perform finish i start a
> ProgressMonitorDialog. If i get an error then i am unable to open a
> MessageDialog mentioning that error to the user. I always get invalid
thread
> acces. Can someone help me in opening a messagedialog from progress
monitor
> run method.
>
> Here is the code.
>
> public boolean performFinish() {
>
> ProgressMonitorDialog pmd =
> new ProgressMonitorDialog( myWizardPage.getShell() );
> pmd.setBlockOnOpen( false );
>
> try {
>
> pmd.run( true, true, new IRunnableWithProgress() {
> public void run( IProgressMonitor iProgressMonitor )
> throws InvocationTargetException, InterruptedException {
> iProgressMonitor.beginTask( "...", 2 );
> PublishUtil.processPublish( iProgressMonitor );
> try {
> .......
> }catch ( Exception e ) {
>
>
MessageDialog.openError(PlatformUI.getWorkbench().getActiveW orkbenchWindow()
> .getShell(),
> "Exception",
> e.getMessage() );
>
> }
> }
> } );
>
> } catch ( InvocationTargetException e ) {
> } catch ( InterruptedException e ){
> } finally{
> pmd.close();
> }
> return true;
> }
>
> -thanks
> Khurrum
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02901 seconds