Example usage for java.lang ThreadDeath getLocalizedMessage

List of usage examples for java.lang ThreadDeath getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang ThreadDeath getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.polymap.core.runtime.UIJob.java

protected final IStatus run(final IProgressMonitor monitor) {
    sessionContext.execute(new Runnable() {
        public void run() {
            if (display == null || !PlatformUI.getWorkbench().isClosing()) {
                try {
                    executionMonitor = progressDialog != null ? progressDialog.getProgressMonitor() : monitor; //new OffThreadProgressMonitor( monitor, display );

                    threadJob.set(UIJob.this);

                    //                        if (showProgress && display != null) {
                    //                            if (progressDialog == null) {
                    //                                display.syncExec( new Runnable() {
                    //                                    public void run() {
                    //                                        progressDialog = new ProgressDialog( getName(), true );
                    //                                    }
                    //                                });
                    //                            }
                    //                        }

                    runWithException(executionMonitor);

                    resultStatus = executionMonitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
                }//from w  ww.  j a  va  2  s .  c om
                // ThreadDeath is a normal error when the thread is dying.
                // We must propagate it in order for it to properly terminate.
                catch (ThreadDeath e) {
                    throw e;
                } catch (final Throwable e) {
                    log.warn("UIJob exception: ", e);

                    if (display != null) {
                        display.syncExec(new Runnable() {
                            public void run() {
                                PolymapWorkbench.handleError(CorePlugin.PLUGIN_ID, UIJob.this,
                                        i18n.get("errorMsg", getName()), e);
                            }
                        });
                    }

                    // users don't read any further if they see an 'error' sign, so make a warning
                    resultStatus = new Status(IStatus.WARNING, CorePlugin.PLUGIN_ID,
                            e.getLocalizedMessage() /*Messages.get( "UIJob_errormsg" )*/, e);
                } finally {
                    threadJob.set(null);
                    executionMonitor = null;
                }
            }
        }
    });
    return resultStatus;
}