use of com.archimatetool.editor.browser.BrowserEditorInput in project archi by archimatetool.
the class HTMLReportExporter method preview.
public void preview() throws Exception {
PREVIEW_FOLDER.mkdirs();
Exception[] exception = new Exception[1];
// Since this can take a while, show the busy dialog
IRunnableWithProgress runnable = monitor -> {
try {
// $NON-NLS-1$//$NON-NLS-2$
File file = createReport(PREVIEW_FOLDER, "preview-" + fModel.getId() + ".html", monitor);
// Open it in internal Browser
// $NON-NLS-1$ //$NON-NLS-2$
IBrowserEditorInput input = new BrowserEditorInput("file:///" + file.getPath(), Messages.HTMLReportExporter_0 + " " + fModel.getName());
IBrowserEditor editor = (IBrowserEditor) EditorManager.openEditor(input, IBrowserEditor.ID);
if (editor != null && editor.getBrowser() != null) {
editor.getBrowser().refresh();
}
} catch (Exception ex) {
// Catch OOM and SWT exceptions
exception[0] = ex;
}
};
try {
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
dialog.run(false, true, runnable);
} catch (Exception ex) {
exception[0] = ex;
}
if (exception[0] instanceof CancelledException) {
MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.HTMLReportExporter_2, exception[0].getMessage());
} else if (exception[0] != null) {
throw exception[0];
}
}
Aggregations