| //Generated on Thu Jan 12 17:21:26 CET 2012 with EGF 0.6.1.qualifier |
| package org.eclipse.egf.emf.pattern.base; |
| |
| 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.*; |
| |
| public class GenAbstract { |
| protected static String nl; |
| |
| public static synchronized GenAbstract create(String lineSeparator) { |
| nl = lineSeparator; |
| GenAbstract result = new GenAbstract(); |
| nl = null; |
| return result; |
| } |
| |
| public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; |
| protected final String TEXT_1 = ""; |
| protected final String TEXT_2 = NL; |
| |
| public GenAbstract() { |
| //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<String, String> 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_1); |
| stringBuffer.append(TEXT_2); |
| return stringBuffer.toString(); |
| } |
| |
| public String orchestration(PatternContext ctx) throws Exception { |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| |
| method_setGenModel(new StringBuffer(), ictx); |
| |
| method_putGenModelInContext(new StringBuffer(), ictx); |
| |
| method_setChildVariables(new StringBuffer(), ictx); |
| |
| method_setReporterVariables(new StringBuffer(), ictx); |
| |
| method_putReporterVariablesInContext(new StringBuffer(), ictx); |
| |
| method_putContentTypeInContext(new StringBuffer(), ictx); |
| |
| method_setArgument(new StringBuffer(), ictx); |
| |
| method_ensureProjectExists(new StringBuffer(), ictx); |
| |
| return null; |
| } |
| |
| protected org.eclipse.emf.codegen.ecore.genmodel.GenModel genModel = null; |
| |
| public void set_genModel(org.eclipse.emf.codegen.ecore.genmodel.GenModel object) { |
| this.genModel = object; |
| } |
| |
| protected java.lang.Object argument = null; |
| |
| public void set_argument(java.lang.Object object) { |
| this.argument = object; |
| } |
| |
| public Map<String, Object> getParameters() { |
| final Map<String, Object> parameters = new HashMap<String, Object>(); |
| return parameters; |
| } |
| |
| protected void method_setGenModel(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "setGenModel", stringBuffer.toString()); |
| } |
| |
| protected void method_putGenModelInContext(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| ctx.setValue("genModel", genModel); |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "putGenModelInContext", stringBuffer.toString()); |
| } |
| |
| protected void method_setChildVariables(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "setChildVariables", stringBuffer.toString()); |
| } |
| |
| protected void method_setReporterVariables(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "setReporterVariables", stringBuffer.toString()); |
| } |
| |
| protected void method_putReporterVariablesInContext(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "putReporterVariablesInContext", stringBuffer.toString()); |
| } |
| |
| protected void method_putContentTypeInContext(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| ctx.setValue("contentType", ContentType.Undefined); |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "putContentTypeInContext", stringBuffer.toString()); |
| } |
| |
| protected void method_setArgument(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "setArgument", stringBuffer.toString()); |
| } |
| |
| protected void method_ensureProjectExists(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "ensureProjectExists", stringBuffer.toString()); |
| } |
| |
| protected void method_preGenerate(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "preGenerate", stringBuffer.toString()); |
| } |
| |
| protected void method_doGenerate(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "doGenerate", stringBuffer.toString()); |
| } |
| |
| protected void method_postGenerate(final StringBuffer stringBuffer, final PatternContext ctx) throws Exception { |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "postGenerate", stringBuffer.toString()); |
| } |
| |
| public boolean preCondition(PatternContext ctx) throws Exception { |
| return true; |
| } |
| } |