- class InfoMessageDialog extends MessageDialog {\r
-\r
- public InfoMessageDialog(Shell shell) {\r
- super(shell, \r
- "Migration report", null, \r
- "", \r
- MessageDialog.INFORMATION, new String[] { "Continue" }, 0);\r
- }\r
- \r
- @Override\r
- protected boolean isResizable() {\r
- return true;\r
- }\r
- \r
- @Override\r
- protected Point getInitialSize() {\r
- return new Point(800, 500);\r
- }\r
-\r
- @Override\r
- protected Control createCustomArea(Composite composite) {\r
- \r
- GridLayoutFactory.fillDefaults().applyTo(composite);\r
- Text text = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY | SWT.BORDER);\r
- text.setText(report);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(text);\r
- return composite;\r
- \r
- }\r
-\r
- }\r
-\r
- InfoMessageDialog md = new InfoMessageDialog(Display.getCurrent().getActiveShell());\r
- md.open();\r
- \r
- \r
- } catch (DatabaseException e) {\r
- Logger.defaultLogError(e);\r
- }\r
- \r
- return true;\r
+\r
+ ReportDialog md = new ReportDialog(getShell(), report[0], 800, 500);\r
+ md.open();\r
+\r
+ return true;\r
+ } catch (InvocationTargetException e) {\r
+ // Don't show user cancellations as errors.\r
+ Throwable cause = e.getCause();\r
+ if (!(cause instanceof CancelTransactionException || cause instanceof OperationCanceledException)) {\r
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,\r
+ "Migration failed, see Error Log for details.", e.getCause()));\r
+ }\r
+ } catch (InterruptedException e) {\r
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,\r
+ "Migration interrupted, see Error Log for details.", e));\r
+ }\r
+ return false;\r
+ }\r
+\r
+ static class ReportDialog extends MessageDialog {\r
+ private final String report;\r
+ private final int initialWidth;\r
+ private final int initialHeight;\r
+\r
+ public ReportDialog(Shell shell, String report, int width, int height) {\r
+ super(shell, \r
+ "Migration report", null, \r
+ "", \r
+ MessageDialog.INFORMATION, new String[] { "Continue" }, 0);\r
+ this.report = report;\r
+ this.initialWidth = width;\r
+ this.initialHeight = height;\r
+ }\r
+\r
+ @Override\r
+ protected boolean isResizable() {\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ protected Point getInitialSize() {\r
+ return new Point(initialWidth, initialHeight);\r
+ }\r
+\r
+ @Override\r
+ protected Control createCustomArea(Composite composite) {\r
+ GridLayoutFactory.fillDefaults().applyTo(composite);\r
+ Text text = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY | SWT.BORDER);\r
+ text.setText(report);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(text);\r
+ return composite;\r
+ }\r