From 367b3c257c57a2665116da5a5f12c7dfa9d23067 Mon Sep 17 00:00:00 2001 From: tkellner Date: Mon, 3 Feb 2014 15:56:29 +0000 Subject: 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 --- .../java/at/asit/pdfover/gui/composites/OutputComposite.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit') 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); } } } -- cgit v1.2.3