Search in sources :

Example 1 with IGeneratorEntryExecutor

use of org.yakindu.sct.generator.core.execution.IGeneratorEntryExecutor in project statecharts by Yakindu.

the class AbstractJavaGeneratorTest method generateAndCompile.

public IMarker[] generateAndCompile(Statechart statechart) throws Exception {
    GeneratorEntry entry = createGeneratorEntry(statechart.getName(), SRC_GEN);
    entry.setElementRef(statechart);
    IProject targetProject = getProject(entry);
    targetProject.delete(true, new NullProgressMonitor());
    targetProject = getProject(entry);
    if (!targetProject.exists()) {
        targetProject.create(new NullProgressMonitor());
        targetProject.open(new NullProgressMonitor());
    }
    IGeneratorEntryExecutor executor = new EclipseContextGeneratorExecutorLookup() {

        protected Module getContextModule() {
            return Modules.override(super.getContextModule()).with(new Module() {

                @Override
                public void configure(Binder binder) {
                    binder.bind(IConsoleLogger.class).to(TestLogger.class);
                }
            });
        }
    }.createExecutor(entry, "yakindu::java");
    executor.execute(entry);
    targetProject.refreshLocal(IResource.DEPTH_INFINITE, null);
    targetProject.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
    targetProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
    IMarker[] markers = targetProject.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
    return markers;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Binder(com.google.inject.Binder) IConsoleLogger(org.yakindu.sct.generator.core.console.IConsoleLogger) GeneratorEntry(org.yakindu.sct.model.sgen.GeneratorEntry) IGeneratorEntryExecutor(org.yakindu.sct.generator.core.execution.IGeneratorEntryExecutor) IMarker(org.eclipse.core.resources.IMarker) Module(com.google.inject.Module) IProject(org.eclipse.core.resources.IProject) EclipseContextGeneratorExecutorLookup(org.yakindu.sct.generator.builder.EclipseContextGeneratorExecutorLookup)

Aggregations

Binder (com.google.inject.Binder)1 Module (com.google.inject.Module)1 IMarker (org.eclipse.core.resources.IMarker)1 IProject (org.eclipse.core.resources.IProject)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 EclipseContextGeneratorExecutorLookup (org.yakindu.sct.generator.builder.EclipseContextGeneratorExecutorLookup)1 IConsoleLogger (org.yakindu.sct.generator.core.console.IConsoleLogger)1 IGeneratorEntryExecutor (org.yakindu.sct.generator.core.execution.IGeneratorEntryExecutor)1 GeneratorEntry (org.yakindu.sct.model.sgen.GeneratorEntry)1