diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2014-02-03 15:56:29 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2014-02-03 15:56:29 +0000 |
commit | 367b3c257c57a2665116da5a5f12c7dfa9d23067 (patch) | |
tree | 4d014a1e9a2621a5397c74a229a959e66bde599b /pdf-over-gui/src/main/java/at/asit | |
parent | afb1fa29ae33467c62d4927fa0b58d339cbdd6e7 (diff) | |
download | mocca-367b3c257c57a2665116da5a5f12c7dfa9d23067.tar.gz mocca-367b3c257c57a2665116da5a5f12c7dfa9d23067.tar.bz2 mocca-367b3c257c57a2665116da5a5f12c7dfa9d23067.zip |
Show error message when document opening fails
Happens e.g. when no viewer is installed under Windows
PDFOVER-3 #Done Fixed
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@507 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index 76efb41f..f4a78eb0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -31,6 +31,7 @@ import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.program.Program; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -386,10 +387,16 @@ public class OutputComposite extends StateComposite { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(f); } else { - log.error("SWT Desktop is not supported on this platform!"); //$NON-NLS-1$ + log.info("SWT Desktop is not supported on this platform"); //$NON-NLS-1$ + Program.launch(f.getAbsolutePath()); } - } catch (Exception ex) { + } catch (IOException ex) { log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$ + ErrorDialog error = new ErrorDialog(getShell(), + String.format(Messages.getString("error.FailedToOpenDocument"), //$NON-NLS-1$ + ex.getLocalizedMessage()), BUTTONS.RETRY_CANCEL); + if (error.open() == SWT.RETRY) + widgetSelected(e); } } } |