diff --git a/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java b/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java index 1df92e8ca7c809dae1860928d3223a25e267b343..55fe9bb84e0a5e3f3b0221a8e999a46ccb9b4cb6 100644 --- a/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java +++ b/plugins/org.etsi.mts.tdl.tools.to.docx.poi/src/org/etsi/mts/tdl/tools/to/docx/poi/Generator.java @@ -53,7 +53,7 @@ import org.osgi.framework.Bundle; public class Generator { int index = 0; - String templateFilename = "template.docx"; + String templateFilename = "resource/template.docx"; public static String selectedTemplate = "TO_4_TABLE_TEMPLATE_EDITHELP"; XWPFDocument template; private boolean hierarchical = true; @@ -295,7 +295,7 @@ public class Generator { } private XWPFDocument loadTemplate() throws Exception { - URI templateLocation = ResourceHandler.getSourceUri(this.getClass(), "org.etsi.mts.tdl.to.docx.poi", templateFilename); + URI templateLocation = ResourceHandler.getSourceUri(this.getClass(), "org.etsi.mts.tdl.tools.to.docx.poi", templateFilename); template = loadTemplateDocument(templateLocation); return template; } @@ -477,7 +477,9 @@ public class Generator { String then = NodeModelUtils.getNode(expectedBehaviours.get(1)).getText(); //TODO: a bit of a hack when = filterSource(when, "\n", "\\s\\s\\s\\s\\w"); - then = filterSource(then, "\n", "\\s+\\w"); + //then = filterSource(then, "\n", "\\s+\\w"); + //then = filterSource(then, "\n", "\\s+\\w"); + then = filterSource(then, "\n", "\\s\\s\\s\\s\\w"); map.put(Placeholders.WHEN, "when {"+when+"\n}"); map.put(Placeholders.THEN, "then {"+then+"\n}"); @@ -557,7 +559,8 @@ public class Generator { String then = NodeModelUtils.getNode(sto.getExpectedBehaviour().getThenClause()).getText(); //TODO: a bit of a hack when = filterSource(when, "\n", "\\s\\s\\s\\s\\w"); - then = filterSource(then, "\n", "\\s+\\w"); + //then = filterSource(then, "\n", "\\s+\\w"); + then = filterSource(then, "\n", "\\s\\s\\s\\s\\w"); map.put(Placeholders.WHEN, "when {"+when+"\n}"); map.put(Placeholders.THEN, "then {"+then+"\n}"); @@ -625,8 +628,7 @@ public class Generator { } private XWPFDocument loadTemplateDocument(URI templateLocation) throws Exception { - File file = new File(templateLocation); - FileInputStream fis = new FileInputStream(file.getAbsolutePath()); + FileInputStream fis = (FileInputStream) templateLocation.toURL().openStream(); XWPFDocument document = new XWPFDocument(fis); fis.close(); return document;