Commit 8a278e20 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ select edit help template as default (todo:add ui configuration for


selecting templates 
+ fix incorrect label for pics selection
+ fix indentation for event sequences

Change-Id: I058f9260062824b385bc8598723b36285695ea83
Signed-off-by: default avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent d343af5a
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ public class TemplateApp {
		wordTemplateExporter.setTemplateFileName(template);
		wordTemplateExporter.setInputFileName(empty);
		wordTemplateExporter.init();
		setTemplateName("TO_4_TABLE_TEMPLATE_EDITHELP");
		wordTemplateExporter.selectTemplateTable(getTemplateName());
		
		List<StructuredTestObjective> toList = EcoreUtil2.getAllContentsOfType(p, StructuredTestObjective.class);
@@ -266,12 +267,12 @@ public class TemplateApp {
        	String l = "";
        	for (PICSReference p : to.getPicsReference()) {
        		if (p.getComment().size()>0) {
        			l+=" "+p.getComment().get(0).getName() + " ";
        			l+=" "+p.getComment().get(0).getBody() + " ";
        		}
        		
        		l+= p.getPics().getName();
        		toPICSselectionLabelStrList.add(l);
        	}
        	toPICSselectionLabelStrList.add(l);
        }
        
        String indent = "    ";
@@ -289,13 +290,13 @@ public class TemplateApp {
        	if (to.getExpectedBehaviour().getWhenClause().getEvents().size()>0) {
        		i=indent+indent;
        	}
			List<String> whenSource = getSequenceSource(to.getExpectedBehaviour().getWhenClause(), i);
			List<String> whenSource = getSequenceSource(to.getExpectedBehaviour().getWhenClause(), indent);
        	if (whenSource.size()>0) {
        		toWhenLabelStrList.add(indent+"when {");
        		toWhenLabelStrList.addAll(whenSource);
        		toWhenLabelStrList.add(indent+"}");
        	}
        	List<String> thenSource = getSequenceSource(to.getExpectedBehaviour().getThenClause(), i);
        	List<String> thenSource = getSequenceSource(to.getExpectedBehaviour().getThenClause(), indent);
        	if (whenSource.size()>0) {
        		toThenLabelStrList.add(indent+"then {");
        		toThenLabelStrList.addAll(thenSource);
@@ -354,9 +355,16 @@ public class TemplateApp {
		}
		
		List<String> lines = Arrays.asList(s.split("\n"));
		boolean first = true;
		for (String line : lines) {
			if (line.trim().length() > 0) {
				source.add(indent+line);
				if (first) {
					source.add(indent+indent+indent+line);
					first = false;
				} else {
					source.add(line);
				}
				System.out.println(source.get(source.size()-1));
			}
		}
		if (source.isEmpty()) {
@@ -372,6 +380,7 @@ public class TemplateApp {
			filtered = filtered.replaceAll("entity\\s?", "");
			filtered = filtered.replaceAll("\\(literal\\) ","");
			filtered = filtered.replaceAll("\\(predefined\\) ","");
			filtered = filtered.replaceAll("\\(typed\\) ","");
			filtered = filtered.replaceAll("\t","    ");
		}
		return filtered;