diff --git a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/generated/org/polarsys/kitalpha/doc/gen/business/core/searchIndex/SearchIndex.java b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/generated/org/polarsys/kitalpha/doc/gen/business/core/searchIndex/SearchIndex.java index 00c3879dcc..ed67e92423 100644 --- a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/generated/org/polarsys/kitalpha/doc/gen/business/core/searchIndex/SearchIndex.java +++ b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/generated/org/polarsys/kitalpha/doc/gen/business/core/searchIndex/SearchIndex.java @@ -1,212 +1,206 @@ -//Generated with EGF 1.5.1.v20180423-0901 -package org.polarsys.kitalpha.doc.gen.business.core.searchIndex; - -import java.util.Map.Entry; -import org.polarsys.kitalpha.doc.gen.business.core.services.IndexItem; -import org.eclipse.egf.common.helper.*; -import java.util.*; -import org.eclipse.emf.ecore.*; -import org.eclipse.egf.model.pattern.*; -import org.eclipse.egf.pattern.execution.*; -import org.eclipse.egf.pattern.query.*; -import org.polarsys.kitalpha.doc.gen.business.core.util.DocGenHtmlUtil; - -public class SearchIndex extends org.polarsys.kitalpha.doc.gen.business.core.doccontent.ElementDocContent { - protected static String nl; - - public static synchronized SearchIndex create(String lineSeparator) { - nl = lineSeparator; - SearchIndex result = new SearchIndex(); - nl = null; - return result; - } - - public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; - protected final String TEXT_1 = NL + "" + NL - + "" + NL + "" + NL - + "\t\t" + NL + "" + NL - + "" + NL + "" + NL - + "\t\t
" + NL - + "\t\t\t
" + NL - + "\t\t\t\t
" + NL - + "\t\t\t\t\tBack to Model" + NL + "\t\t\t\t
" + NL + "\t\t\t
" + NL - + "\t\t
" + NL + "
" + NL - + " \t " + NL + " \t

" + NL - + "

\t" + NL + "\t" + NL + "\t
" + NL + "" + NL - + ""; - protected final String TEXT_19 = NL; - protected final String TEXT_20 = NL; - - public SearchIndex() { - //Here is the constructor - StringBuffer stringBuffer = new StringBuffer(); - - // add initialisation of the pattern variables (declaration has been already done). - - } - - public String generate(Object argument) throws Exception { - final StringBuffer stringBuffer = new StringBuffer(); - - InternalPatternContext ctx = (InternalPatternContext) argument; - Map queryCtx = null; - IQuery.ParameterDescription paramDesc = null; - Node.Container currentNode = ctx.getNode(); - - if (preCondition(ctx)) { - ctx.setNode(new Node.Container(currentNode, getClass())); - orchestration(ctx); - } - - ctx.setNode(currentNode); - if (ctx.useReporter()) { - ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx); - } - - stringBuffer.append(TEXT_19); - stringBuffer.append(TEXT_20); - return stringBuffer.toString(); - } - - public String orchestration(PatternContext ctx) throws Exception { - InternalPatternContext ictx = (InternalPatternContext) ctx; - - super.orchestration(new SuperOrchestrationContext(ictx)); - - return null; - } - - public Map getParameters() { - final Map parameters = new HashMap(); - return parameters; - } - - protected void method_content(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - Map indexItems = (Map) ctx.getValue("IndexItem"); - - stringBuffer.append(TEXT_1); - stringBuffer.append((indexItems.size() / 255) + 1); - stringBuffer.append(TEXT_2); - stringBuffer.append(indexItems.size()); - stringBuffer.append(TEXT_3); - stringBuffer.append(indexItems.size()); - stringBuffer.append(TEXT_4); - - int count = 0; - int listCount = 0; - int i = 0; - - for (Entry entry : indexItems.entrySet()) { - i++; - - stringBuffer.append(TEXT_5); - stringBuffer.append(listCount); - stringBuffer.append(TEXT_6); - stringBuffer.append(count); - stringBuffer.append(TEXT_7); - stringBuffer.append(entry.getValue().getConceptName().replace("\"", "\\\"")); - stringBuffer.append(TEXT_8); - stringBuffer.append(listCount); - stringBuffer.append(TEXT_9); - stringBuffer.append(count); - stringBuffer.append(TEXT_10); - stringBuffer.append(i + "_" + DocGenHtmlUtil.getValidFileName(entry.getValue().getConceptName())); - stringBuffer.append(TEXT_11); - if (entry.getValue().getIconTag() != null && !entry.getValue().getIconTag().isEmpty()) { - stringBuffer.append(TEXT_12); - stringBuffer.append(listCount); - stringBuffer.append(TEXT_13); - stringBuffer.append(count); - stringBuffer.append(TEXT_14); - stringBuffer.append(entry.getValue().getIconTag().replaceAll("\"", "'").replaceFirst("../", "")); - stringBuffer.append(TEXT_15); - } - stringBuffer.append(TEXT_16); - - if (count == 254) { - count = 0; - listCount++; - } else { - count++; - } - - stringBuffer.append(TEXT_17); - - } - - stringBuffer.append(TEXT_18); - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "content", stringBuffer.toString()); - } - - protected void method_docFooter(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "docFooter", stringBuffer.toString()); - } - - protected void method_docHeader(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "docHeader", stringBuffer.toString()); - } - - protected void method_endContent(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "endContent", stringBuffer.toString()); - } - - protected void method_startContent(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "startContent", stringBuffer.toString()); - } - - protected void method_setContext(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { - - fileName = "searchIndex"; - - InternalPatternContext ictx = (InternalPatternContext) ctx; - new Node.DataLeaf(ictx.getNode(), getClass(), "setContext", stringBuffer.toString()); - } +//Generated with EGF 1.6.1.201906060805 +package org.polarsys.kitalpha.doc.gen.business.core.searchIndex; + +import java.util.Map.Entry; +import org.polarsys.kitalpha.doc.gen.business.core.services.IndexItem; +import java.util.*; +import org.eclipse.egf.model.pattern.*; +import org.eclipse.egf.pattern.execution.*; +import org.eclipse.egf.pattern.query.*; +import org.polarsys.kitalpha.doc.gen.business.core.util.DocGenHtmlUtil; +import org.polarsys.kitalpha.doc.gen.business.core.util.EscapeChars; + +public class SearchIndex extends org.polarsys.kitalpha.doc.gen.business.core.doccontent.ElementDocContent { + protected static String nl; + + public static synchronized SearchIndex create(String lineSeparator) { + nl = lineSeparator; + SearchIndex result = new SearchIndex(); + nl = null; + return result; + } + + public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = NL + "" + NL + + "" + NL + "" + NL + + "\t\t" + NL + "" + NL + + "" + NL + "" + NL + + "\t\t
" + NL + + "\t\t\t
" + NL + + "\t\t\t\t
" + NL + + "\t\t\t\t\tBack to Model" + NL + "\t\t\t\t
" + NL + "\t\t\t
" + NL + + "\t\t
" + NL + "
" + NL + + " \t " + NL + " \t

" + NL + + "

\t" + NL + "\t" + NL + "\t
" + NL + "" + NL + ""; + protected final String TEXT_14 = NL; + + public SearchIndex() { + //Here is the constructor + StringBuffer stringBuffer = new StringBuffer(); + + // add initialisation of the pattern variables (declaration has been already done). + + } + + public String generate(Object argument) throws Exception { + final StringBuffer stringBuffer = new StringBuffer(); + + InternalPatternContext ctx = (InternalPatternContext) argument; + Map queryCtx = null; + IQuery.ParameterDescription paramDesc = null; + Node.Container currentNode = ctx.getNode(); + + if (preCondition(ctx)) { + ctx.setNode(new Node.Container(currentNode, getClass())); + orchestration(ctx); + } + + ctx.setNode(currentNode); + if (ctx.useReporter()) { + ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx); + } + + stringBuffer.append(TEXT_14); + stringBuffer.append(TEXT_14); + return stringBuffer.toString(); + } + + public String orchestration(PatternContext ctx) throws Exception { + InternalPatternContext ictx = (InternalPatternContext) ctx; + + super.orchestration(new SuperOrchestrationContext(ictx)); + + return null; + } + + public Map getParameters() { + final Map parameters = new HashMap(); + return parameters; + } + + protected void method_content(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + Map indexItems = (Map) ctx.getValue("IndexItem"); + + stringBuffer.append(TEXT_1); + stringBuffer.append((indexItems.size() / 255) + 1); + stringBuffer.append(TEXT_2); + stringBuffer.append(indexItems.size()); + stringBuffer.append(TEXT_3); + stringBuffer.append(indexItems.size()); + stringBuffer.append(TEXT_4); + + int count = 0; + int listCount = 0; + int i = 0; + + for (Entry entry : indexItems.entrySet()) { + i++; + + stringBuffer.append(TEXT_5); + stringBuffer.append(listCount); + stringBuffer.append(TEXT_6); + stringBuffer.append(count); + stringBuffer.append(TEXT_7); + stringBuffer.append(EscapeChars + .removeNewline(EscapeChars.forHTML(entry.getValue().getConceptName().replace("\"", "\\\"")))); + stringBuffer.append(TEXT_8); + stringBuffer.append(listCount); + stringBuffer.append(TEXT_6); + stringBuffer.append(count); + stringBuffer.append(TEXT_9); + stringBuffer.append(i + "_" + DocGenHtmlUtil.getValidFileName(entry.getValue().getConceptName())); + stringBuffer.append(TEXT_10); + if (entry.getValue().getIconTag() != null && !entry.getValue().getIconTag().isEmpty()) { + stringBuffer.append(TEXT_5); + stringBuffer.append(listCount); + stringBuffer.append(TEXT_6); + stringBuffer.append(count); + stringBuffer.append(TEXT_11); + stringBuffer.append(entry.getValue().getIconTag().replaceAll("\"", "'").replaceFirst("../", "")); + stringBuffer.append(TEXT_10); + } + stringBuffer.append(TEXT_12); + + if (count == 254) { + count = 0; + listCount++; + } else { + count++; + } + + stringBuffer.append(TEXT_12); + + } + + stringBuffer.append(TEXT_13); + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "content", stringBuffer.toString()); + } + + protected void method_docFooter(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "docFooter", stringBuffer.toString()); + } + + protected void method_docHeader(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "docHeader", stringBuffer.toString()); + } + + protected void method_endContent(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "endContent", stringBuffer.toString()); + } + + protected void method_startContent(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "startContent", stringBuffer.toString()); + } + + protected void method_setContext(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { + + fileName = "searchIndex"; + + InternalPatternContext ictx = (InternalPatternContext) ctx; + new Node.DataLeaf(ictx.getNode(), getClass(), "setContext", stringBuffer.toString()); + } } \ No newline at end of file diff --git a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/src/org/polarsys/kitalpha/doc/gen/business/core/util/EscapeChars.java b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/src/org/polarsys/kitalpha/doc/gen/business/core/util/EscapeChars.java index 7934aa8a9d..ab28c2a9e5 100644 --- a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/src/org/polarsys/kitalpha/doc/gen/business/core/util/EscapeChars.java +++ b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/src/org/polarsys/kitalpha/doc/gen/business/core/util/EscapeChars.java @@ -543,6 +543,10 @@ public static String toDisableTags(String aText) { } return result.toString(); } + + public static String removeNewline(String aText) { + return aText.replaceAll("\\r\\n|\\n|\\r", ""); + } /** * Replace characters having special meaning in regular expressions with diff --git a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5Dwl4yEeGfnvXFIF-hXQ.pt b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5Dwl4yEeGfnvXFIF-hXQ.pt index 975cf677d7..b9f7f39127 100644 --- a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5Dwl4yEeGfnvXFIF-hXQ.pt +++ b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5Dwl4yEeGfnvXFIF-hXQ.pt @@ -1 +1 @@ -<%@ jet package="PACKAGE" class="CLASS" imports="java.util.Map.Entry org.polarsys.kitalpha.doc.gen.business.core.services.IndexItem org.eclipse.egf.common.helper.* java.util.* org.eclipse.emf.ecore.* org.eclipse.egf.model.pattern.* org.eclipse.egf.pattern.execution.* org.eclipse.egf.pattern.query.* org.polarsys.kitalpha.doc.gen.business.core.util.DocGenHtmlUtil" %> \ No newline at end of file +<%@ jet package="PACKAGE" class="CLASS" imports="java.util.Map.Entry org.polarsys.kitalpha.doc.gen.business.core.services.IndexItem java.util.* org.eclipse.egf.model.pattern.* org.eclipse.egf.pattern.execution.* org.eclipse.egf.pattern.query.* org.polarsys.kitalpha.doc.gen.business.core.util.DocGenHtmlUtil org.polarsys.kitalpha.doc.gen.business.core.util.EscapeChars" %> \ No newline at end of file diff --git a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5DxV4yEeGfnvXFIF-hXQ.pt b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5DxV4yEeGfnvXFIF-hXQ.pt index d5ad061e73..0ec795c912 100644 --- a/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5DxV4yEeGfnvXFIF-hXQ.pt +++ b/Docgen/business/plugins/org.polarsys.kitalpha.doc.gen.business.core/templates/pattern._0T5DwF4yEeGfnvXFIF-hXQ/method._0T5DxV4yEeGfnvXFIF-hXQ.pt @@ -50,7 +50,7 @@ int i = 0; for(Entry entry : indexItems.entrySet()) { i++; %> - conceptsList[<%=listCount%>][<%=count%>][0] = "<%=entry.getValue().getConceptName().replace("\"", "\\\"")%>"; + conceptsList[<%=listCount%>][<%=count%>][0] = "<%=EscapeChars.removeNewline(EscapeChars.forHTML(entry.getValue().getConceptName().replace("\"", "\\\"")))%>"; conceptsList[<%=listCount%>][<%=count%>][1] = "<%=i+"_"+DocGenHtmlUtil.getValidFileName(entry.getValue().getConceptName())%>"; <% if (entry.getValue().getIconTag() != null && !entry.getValue().getIconTag().isEmpty()) { %> conceptsList[<%=listCount%>][<%=count%>][2] = "<%= entry.getValue().getIconTag().replaceAll("\"", "'").replaceFirst("../", "") %>"; @@ -91,8 +91,9 @@ for(Entry entry : indexItems.entrySet()) { } $("#p2").html(t); - - element.value = value; + if (element != null) { + element.value = value; + } }).keyup();