blob: 16518ae5d86937df6298746129048e490680cf3e [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.wizard.ui.aggregator;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osbp.wizard.ui.basic.AbstractNonPluginProjectCreator;
import org.eclipse.osbp.wizard.ui.basic.BasicProjectFactory;
import org.eclipse.osbp.wizard.ui.basic.BasicProjectInfo;
import org.eclipse.xtext.ui.util.PluginProjectFactory;
import org.eclipse.xtext.ui.util.ProjectFactory;
import org.eclipse.xtext.ui.wizard.IProjectInfo;
/**
* Creator for a new Application Project.
*/
public class AggregatorProjectCreator extends AbstractNonPluginProjectCreator {
/**
* Execute one model project for each existing project post fixes.
*
* @param projectInfo
* the project info
* @param monitor
* the monitor
* @throws InvocationTargetException
* the invocation target exception
* @throws CoreException
* the core exception
* @throws InterruptedException
* the interrupted exception
*/
public static void execute(BasicProjectInfo projectInfo, IProgressMonitor monitor) throws InvocationTargetException, CoreException, InterruptedException {
// generate a new application project
projectInfo.useForAggregatorFactory();
AggregatorProjectCreator instance = new AggregatorProjectCreator(projectInfo);
instance.execute(monitor);
// return to the product project factory
projectInfo.useForProductFactory();
}
/**
* Instantiates a new aggregator project creator.
*
* @param projectInfo
* the project info
*/
private AggregatorProjectCreator(BasicProjectInfo projectInfo) {
super();
super.setProjectInfo(projectInfo);
}
@Override
protected BasicProjectInfo getProjectInfo() {
return (BasicProjectInfo) super.getProjectInfo();
}
/**
* Do not use this method!
*/
@Deprecated
@Override
public void setProjectInfo(IProjectInfo projectInfo) {
System.err.println();
}
@Override
protected ProjectFactory configureProjectFactory(ProjectFactory factory) {
ProjectFactory result = super.configureProjectFactory(factory);
((BasicProjectFactory) result).configureFrom(getProjectInfo());
((BasicProjectFactory) result).setRule(getRule());
return result;
}
/**
* @return a specific model project factory
*/
@Override
protected PluginProjectFactory createProjectFactory() {
return new AggregatorProjectFactory(); // super.createProjectFactory();
}
@Override
protected String getEncoding() throws CoreException {
return super.getEncoding();
}
/**
* Enhance the model project and display the progress on the monitor.
*
* @param project
* @param monitor
*/
@Override
protected void enhanceProject(final IProject project, final IProgressMonitor monitor) throws CoreException {
enhanceProject(project, monitor, "aggregator");
}
}