X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.linking.ui%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Flinking%2Freport%2FExportToPDF.java;h=f9645042bbc2b8b5fc97f85b4f041d2286f8cd2c;hp=2bfdf79c0a0f850308fd03423eb24a62fee830cf;hb=8783f9ee2b67f83160d88f43a7aef02a6b25f955;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java index 2bfdf79c0..f9645042b 100644 --- a/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java +++ b/bundles/org.simantics.document.linking.ui/src/org/simantics/document/linking/report/ExportToPDF.java @@ -84,18 +84,18 @@ public class ExportToPDF { Document lineWriter = null; try { - if (filename.toLowerCase().endsWith(".pdf")) - lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10)); - else if (filename.toLowerCase().endsWith(".html") || - filename.toLowerCase().endsWith(".htm")) + if (filename.toLowerCase().endsWith(".pdf")) //$NON-NLS-1$ + lineWriter = new PDFDocument(filename, new Font("Arial", Font.PLAIN, 10),new Font("Arial", Font.BOLD, 10)); //$NON-NLS-1$ //$NON-NLS-2$ + else if (filename.toLowerCase().endsWith(".html") || //$NON-NLS-1$ + filename.toLowerCase().endsWith(".htm")) //$NON-NLS-1$ lineWriter = new HTMLDocument(new File(filename)); else { - throw new Exception("File has unknow extension " + filename); + throw new Exception("File has unknow extension " + filename); //$NON-NLS-1$ } export(lineWriter, reportWriter, monitor); } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not generate report", e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportToPDF_ActivatorCouldNotGenerateReport, e); } finally { if (lineWriter != null) { try { @@ -106,7 +106,7 @@ public class ExportToPDF { } } - String status = "Report generated."; + String status = Messages.ExportToPDF_ReportGenerated; // if (lineWriter instanceof PDFTableWriter) { // status += " Report size " + ((PDFTableWriter)lineWriter).getCurrentPageIndex() + " pages."; // } @@ -124,16 +124,16 @@ public class ExportToPDF { try { Map context = new HashMap(); - context.put("model", model); + context.put("model", model); //$NON-NLS-1$ context.put(Document.class, document); context.put(ReportWriter.class, reportWriter); - context.put("DocumentName", reportWriter.getName()); + context.put("DocumentName", reportWriter.getName()); //$NON-NLS-1$ reportWriter.start(graph, model, document, context); List list = reportWriter.getReportItems(graph); - monitor.beginTask("Write Report", list.size()); + monitor.beginTask(Messages.ExportToPDF_MonitorWriteReport, list.size()); T previous = null; T current = null;