Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » how to open a MessageDialog from progress monitor run method.
how to open a MessageDialog from progress monitor run method. [message #120693] Tue, 02 September 2003 17:58 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:actions in multi page
Next Topic:Problem with runtime workbench / plugin testing / external jars
Goto Forum:
  


Current Time: Wed May 07 13:29:42 EDT 2025

Powered by FUDForum. Page generated in 0.02901 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top