use of org.eclipse.vorto.codegen.ui.tasks.EclipseProjectGenerator in project vorto by eclipse.
the class CodeGenerationHelper method createMavenProjectFromGeneratedCode.
private static void createMavenProjectFromGeneratedCode(EclipseProjectGenerator<ModelId> generator) {
final IProject generatedTempProject = generator.getProject();
try {
for (IResource folderResource : generatedTempProject.members(IResource.FOLDER)) {
if (!(folderResource instanceof IFolder)) {
// it could still return eclipse project metadata files :(
continue;
}
EclipseProjectGenerator<IResource> projectGenerator = new EclipseProjectGenerator<>(folderResource.getName());
projectGenerator.addNature(MavenNature.MAVEN_NATURE_STRING);
projectGenerator.addTask(new CopyResourceTask<IResource>(folderResource.getLocationURI().toURL(), ""));
projectGenerator.generate(folderResource, InvocationContext.simpleInvocationContext(), new NullProgressMonitor());
}
} catch (Exception e) {
throw new RuntimeException("Could not postprocess downloaded generated files", e);
} finally {
deleteTemporaryDownloadedProject(generatedTempProject);
}
}
Aggregations