| //Generated on Wed Jan 18 17:28:09 CET 2012 with EGF 0.6.1.qualifier |
| package jet_tags; |
| |
| 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.eclipse.egf.common.helper.*; |
| |
| public class CalleeInjected { |
| |
| public CalleeInjected() { |
| //Here is the constructor |
| // add initialisation of the pattern variables (declaration has been already done). |
| } |
| |
| public void generate(Object argument) throws Exception { |
| InternalPatternContext ctx = (InternalPatternContext) argument; |
| IQuery.ParameterDescription paramDesc = null; |
| Map<String, String> queryCtx = null; |
| Node.Container currentNode = ctx.getNode(); |
| paramDesc = new IQuery.ParameterDescription("parameter", "http://www.eclipse.org/emf/2002/Ecore#//EClass"); |
| queryCtx = new HashMap<String, String>(); |
| List<Object> parameterList = QueryHelper.load(ctx, "org.eclipse.egf.pattern.query.EObjectInjectedContextQuery").execute(paramDesc, queryCtx, ctx); |
| |
| for (Object parameterParameter : parameterList) { |
| |
| this.parameter = (org.eclipse.emf.ecore.EClass) parameterParameter; |
| |
| { |
| ctx.setNode(new Node.Container(currentNode, getClass())); |
| orchestration((PatternContext) argument); |
| |
| } |
| } |
| if (ctx.useReporter()) { |
| ctx.getReporter().executionFinished(OutputManager.computeExecutionOutput(ctx), ctx); |
| } |
| } |
| |
| public String orchestration(PatternContext ctx) throws Exception { |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| Node.Container currentNode = ictx.getNode(); |
| method_body(new StringBuffer(), ictx); |
| ictx.setNode(currentNode); |
| if (ictx.useReporter()) { |
| Map<String, Object> parameterValues = new HashMap<String, Object>(); |
| parameterValues.put("parameter", this.parameter); |
| String outputWithCallBack = OutputManager.computeLoopOutput(ictx); |
| String loop = OutputManager.computeLoopOutputWithoutCallback(ictx); |
| ictx.getReporter().loopFinished(loop, outputWithCallBack, ictx, parameterValues); |
| } |
| return null; |
| } |
| |
| protected void method_body(final StringBuffer out, final PatternContext ctx) throws Exception { |
| out.append("CalleeInjected : "); |
| |
| out.append("className="); |
| if (parameter != null) |
| out.append(parameter.getName()); |
| |
| InternalPatternContext ictx = (InternalPatternContext) ctx; |
| new Node.DataLeaf(ictx.getNode(), getClass(), "body", out.toString()); |
| } |
| |
| protected org.eclipse.emf.ecore.EClass parameter; |
| |
| public void set_parameter(org.eclipse.emf.ecore.EClass parameter) { |
| this.parameter = parameter; |
| } |
| |
| public Map<String, Object> getParameters() { |
| Map<String, Object> parameters = new HashMap<String, Object>(); |
| parameters.put("parameter", this.parameter); |
| return parameters; |
| } |
| |
| } |