mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Clean up the API around the build model.
Eventually we want to get rid of it. Also expose the internal packages. Need them for UI testing in clients to get at the Template object. Change-Id: I049f4173cfff86ec398e5e8586c8760c6e1a681a
This commit is contained in:
parent
7dd2ff7e92
commit
6848810854
3 changed files with 23 additions and 3 deletions
|
@ -20,6 +20,7 @@ import java.net.URISyntaxException;
|
|||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -74,8 +75,19 @@ public abstract class FMGenerator implements IGenerator, TemplateLoader {
|
|||
return manifest;
|
||||
}
|
||||
|
||||
protected void populateModel(Map<String, Object> model) {
|
||||
// default nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(IProgressMonitor monitor) throws CoreException {
|
||||
generate(new HashMap<>(), monitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
|
||||
populateModel(model);
|
||||
|
||||
// If no manifest, just return
|
||||
if (manifestPath == null) {
|
||||
return;
|
||||
|
|
|
@ -48,10 +48,15 @@ public abstract class FMProjectGenerator extends FMGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
|
||||
protected void populateModel(Map<String, Object> model) {
|
||||
super.populateModel(model);
|
||||
|
||||
// Make sure project name is in model
|
||||
model.put("projectName", projectName); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
|
||||
// Create the project
|
||||
createProject(monitor);
|
||||
|
||||
|
@ -59,7 +64,7 @@ public abstract class FMProjectGenerator extends FMGenerator {
|
|||
super.generate(model, monitor);
|
||||
}
|
||||
|
||||
protected void createProject(IProgressMonitor monitor) throws CoreException {
|
||||
protected IProject createProject(IProgressMonitor monitor) throws CoreException {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
|
||||
project = workspace.getRoot().getProject(projectName);
|
||||
|
@ -76,6 +81,8 @@ public abstract class FMProjectGenerator extends FMGenerator {
|
|||
// TODO make sure it's got all our settings or is this an error
|
||||
// condition?
|
||||
}
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,4 +11,5 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.tools.templates.core;bundle-version="1.0.0";visibility:=reexport
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.eclipse.tools.templates.ui
|
||||
Export-Package: org.eclipse.tools.templates.ui,
|
||||
org.eclipse.tools.templates.ui.internal
|
||||
|
|
Loading…
Add table
Reference in a new issue