Package org.eclipse.xpand2.output

Examples of org.eclipse.xpand2.output.Output


        cleaner.addExclude("gen.properties");

        /*
         * Create Database Generator
         */
        Generator databaseGen = new Generator();
        databaseGen.setExpand(EXPAND_DATABASE);
        databaseGen.setFileEncoding(config.getFileEncoding());
        databaseGen.addMetaModel(emfMetaModel);
        databaseGen.addOutlet(javaOutlet);
        databaseGen.setPrDefaultExcludes(true);
        databaseGen.setPrSrcPaths(config.getGenPath());

        /*
         * Create Content Provider Generator
         */
        Generator contentProviderGen = new Generator();
        contentProviderGen.setExpand(EXPAND_CONTENT_PROVIDER);
        contentProviderGen.setFileEncoding(config.getFileEncoding());
        contentProviderGen.addMetaModel(emfMetaModel);
        contentProviderGen.addOutlet(javaOutlet);

        /*
         * Create Model Generator
         */
        Generator modelGen = new Generator();
        modelGen.setExpand(EXPAND_MODEL);
        modelGen.setFileEncoding(config.getFileEncoding());
        modelGen.addMetaModel(emfMetaModel);
        modelGen.addOutlet(javaOutlet);

        /*
         * Create Code Snippet Generator
         */
        Generator snippetGen = new Generator();
        snippetGen.setExpand(EXPAND_CODE_SNIPPET);
        snippetGen.setFileEncoding(config.getFileEncoding());
        snippetGen.addMetaModel(emfMetaModel);
        snippetGen.addOutlet(propertiesOutlet);

        /*
         * Execute Reader and Generators
         */
        reader.invoke(ctx, monitor, issues);
        cleaner.invoke(ctx, monitor, issues);
        databaseGen.invoke(ctx, monitor, issues);
        contentProviderGen.invoke(ctx, monitor, issues);
        modelGen.invoke(ctx, monitor, issues);
        snippetGen.invoke(ctx, monitor, issues);
    }
View Full Code Here


    pr.setSrcPathes(prSrcPaths);
    pr.setDefaultExcludes(true);
    pr.setIgnoreList("*.swp");

    // Execution context
    XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(
        output, pr, globalVarsMap, null, null);
    execCtx.registerMetaModel(new org.eclipse.xtend.type.impl.java.JavaBeansMetaModel());

    // Generate
    XpandFacade facade = XpandFacade.create(execCtx);
    String templatePath = "templates::corbasim::Main::main";
    facade.evaluate(templatePath, model);
View Full Code Here

    Output output = new OutputImpl();
    Outlet outlet = new Outlet(RESULT_DIR);
    output.addOutlet(outlet);

    ResourceLoaderFactory.setCurrentThreadResourceLoader(new ResourceLoaderImpl(getClass().getClassLoader()));
    xpandCtx = new XpandExecutionContextImpl(output, null);
    Map<String, Variable> variables = xpandCtx.getGlobalVariables();
    Variable srcDir = new Variable("srcDir", SRC_DIR);
    variables.put("srcDir", srcDir);
    Variable dir = new Variable("dir", RESULT_DIR);
    variables.put("dir", dir);
View Full Code Here

    XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(
        output, pr, globalVarsMap, null, null);
    execCtx.registerMetaModel(new org.eclipse.xtend.type.impl.java.JavaBeansMetaModel());

    // Generate
    XpandFacade facade = XpandFacade.create(execCtx);
    String templatePath = "templates::corbasim::Main::main";
    facade.evaluate(templatePath, model);
  }
View Full Code Here

    public void testSample0() throws Exception {
        PostProcessor postProcessor = new JavaImportBeautifier();
        Properties p = System.getProperties();
        File file = new File("src/test/resources/Sample0.java");
        FileHandle fh = new FileHandleImpl(null, file);

        fh.setBuffer(new CharacterSequence(loadTestFile("Sample01.java_input")));

        postProcessor.beforeWriteAndClose(fh);

        assertNotNull(fh.getBuffer());
    }
View Full Code Here

    public void testSample0() throws Exception {
        PostProcessor postProcessor = new JavaImportBeautifier();
        Properties p = System.getProperties();
        File file = new File("src/test/resources/Sample0.java");
        FileHandle fh = new FileHandleImpl(null, file);

        fh.setBuffer(new CharacterSequence(loadTestFile("Sample01.java_input")));

        postProcessor.beforeWriteAndClose(fh);

        assertNotNull(fh.getBuffer());
    }
View Full Code Here

        }

        MetaModel emfMetaModel = new EmfMetaModel(org.eclipse.emf.ecore.EcorePackage.eINSTANCE);

        Outlet javaOutlet = new Outlet();
        javaOutlet.addPostprocessor(new JavaBeautifier());
        javaOutlet.setPath(config.getGenPath());

        Outlet propertiesOutlet = new Outlet();
        propertiesOutlet.setPath(config.getGenPathCodeSnippet());
View Full Code Here

  private void generate(TranslationUnit model) {
    // http://www.peterfriese.de/using-xpand-in-your-eclipse-wizards/

    // Configure outlets
    OutputImpl output = new OutputImpl();
    Outlet outlet = new Outlet("model");
    outlet.setOverwrite(true);
    // outlet.addPostprocessor(new CppBeautifier());
    outlet.setPath(targetDir);
    output.addOutlet(outlet);

    // Protected regions
    ProtectedRegionResolverImpl pr = new ProtectedRegionResolverImpl();
    pr.setSrcPathes(prSrcPaths);
View Full Code Here

            System.out.println("DEBUG: " + TAG);
        }

        MetaModel emfMetaModel = new EmfMetaModel(org.eclipse.emf.ecore.EcorePackage.eINSTANCE);

        Outlet javaOutlet = new Outlet();
        javaOutlet.addPostprocessor(new JavaBeautifier());
        javaOutlet.setPath(config.getGenPath());

        Outlet propertiesOutlet = new Outlet();
        propertiesOutlet.setPath(config.getGenPathCodeSnippet());

        /*
         * Create Reader
         */
        Reader reader = new Reader();
View Full Code Here

    getInjector().injectMembers(this);
    this.pTest = new ParserTest();
    this.pTest.setUp();

    Output output = new OutputImpl();
    Outlet outlet = new Outlet(RESULT_DIR);
    output.addOutlet(outlet);

    ResourceLoaderFactory.setCurrentThreadResourceLoader(new ResourceLoaderImpl(getClass().getClassLoader()));
    xpandCtx = new XpandExecutionContextImpl(output, null);
    Map<String, Variable> variables = xpandCtx.getGlobalVariables();
View Full Code Here

TOP

Related Classes of org.eclipse.xpand2.output.Output

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.