/*******************************************************************************
* Copyright (c) 2008, 2011 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package com.github.sbegaudeau.acceleo.modules.psm.gen.scala.ui.common;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.URI;
import com.github.sbegaudeau.acceleo.modules.psm.gen.scala.main.Workflow;
/**
* Main entry point of the 'Scala' generation module.
*/
public class GenerateAll {
/**
* The model URI.
*/
private URI modelURI;
/**
* The output folder.
*/
private File targetFolder;
/**
* The other arguments.
*/
List<? extends Object> arguments;
/**
* Constructor.
*
* @param modelURI
* is the URI of the model.
* @param targetFolder
* is the output folder
* @param arguments
* are the other arguments
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public GenerateAll(URI modelURI, File targetFolder, List<? extends Object> arguments) {
this.modelURI = modelURI;
this.targetFolder = targetFolder;
this.arguments = arguments;
}
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.exists()) {
targetFolder.mkdirs();
}
Workflow scalaGenerationWorkflow = new Workflow(modelURI, targetFolder, arguments);
scalaGenerationWorkflow.doGenerate(BasicMonitor.toMonitor(monitor));
}
}