Search in sources :

Example 1 with XpandExecutionContextImpl

use of org.eclipse.xpand2.XpandExecutionContextImpl in project xtext-xtend by eclipse.

the class ContentAssistParserGenerator method generate.

@Override
public void generate(Grammar grammar, XpandExecutionContext ctx) {
    XpandExecutionContextImpl casted = (XpandExecutionContextImpl) ctx;
    casted.registerAdvices("org::eclipse::xtend::core::parser::ContentAssistAntlrGrammarWithTokens");
    super.generate(grammar, ctx);
}
Also used : XpandExecutionContextImpl(org.eclipse.xpand2.XpandExecutionContextImpl)

Example 2 with XpandExecutionContextImpl

use of org.eclipse.xpand2.XpandExecutionContextImpl in project applause by applause.

the class ApplauseDslProjectCreator method enhanceProject.

protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
    OutputImpl output = new OutputImpl();
    output.addOutlet(new Outlet(false, getEncoding(), null, true, project.getLocation().makeAbsolute().toOSString()));
    XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(output, null);
    execCtx.getResourceManager().setFileEncoding("ISO-8859-1");
    execCtx.registerMetaModel(new JavaBeansMetaModel());
    XpandFacade facade = XpandFacade.create(execCtx);
    facade.evaluate("org::applause::lang::ui::wizard::ApplauseDslNewProject::main", getProjectInfo());
    project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
Also used : Outlet(org.eclipse.xpand2.output.Outlet) XpandExecutionContextImpl(org.eclipse.xpand2.XpandExecutionContextImpl) JavaBeansMetaModel(org.eclipse.xtend.type.impl.java.JavaBeansMetaModel) OutputImpl(org.eclipse.xpand2.output.OutputImpl) XpandFacade(org.eclipse.xpand2.XpandFacade)

Example 3 with XpandExecutionContextImpl

use of org.eclipse.xpand2.XpandExecutionContextImpl in project applause by applause.

the class AbstractBuildStrategy method generate.

public void generate(Application app, Output output) {
    System.out.println("Generating code for platform project " + getPlatformProject().getName() + " from model in model project " + context.getBuiltProject());
    XpandExecutionContextImpl ctx = new XpandExecutionContextImpl(output, null, Collections.<String, Variable>emptyMap(), null, null);
    ctx.registerMetaModel(new JavaBeansMetaModel());
    try {
        XpandFacade.create(ctx).evaluate(getMainTemplateName(), app);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : XpandExecutionContextImpl(org.eclipse.xpand2.XpandExecutionContextImpl) JavaBeansMetaModel(org.eclipse.xtend.type.impl.java.JavaBeansMetaModel) CoreException(org.eclipse.core.runtime.CoreException) VetoException(org.eclipse.xpand2.output.VetoException)

Aggregations

XpandExecutionContextImpl (org.eclipse.xpand2.XpandExecutionContextImpl)3 JavaBeansMetaModel (org.eclipse.xtend.type.impl.java.JavaBeansMetaModel)2 CoreException (org.eclipse.core.runtime.CoreException)1 XpandFacade (org.eclipse.xpand2.XpandFacade)1 Outlet (org.eclipse.xpand2.output.Outlet)1 OutputImpl (org.eclipse.xpand2.output.OutputImpl)1 VetoException (org.eclipse.xpand2.output.VetoException)1