protected void doFinish(String runtimeName, WGADeployment deployment, IProgressMonitor monitor, List<String> workingSetsToAddTo) throws CoreException {
monitor.beginTask("Creating WGA runtime '" + runtimeName + "'", 5);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(runtimeName);
if (project.exists()) {
throwCoreException("A project with name '" + runtimeName + "' already exists in the workspace.");
} else {
// create project
project.create(new SubProgressMonitor(monitor, 1));
project.open(new SubProgressMonitor(monitor, 1));
JDTUtils.addNature(project, WGADesignerPlugin.NATURE_WGA_RUNTIME);
_wgaRuntime = (WGARuntime) project.getNature(WGADesignerPlugin.NATURE_WGA_RUNTIME);
_wgaRuntime.getConfiguration().setWgaDistribution(deployment.getName());
_wgaRuntime.flushConfig();
monitor.worked(1);
if(workingSetsToAddTo!=null && workingSetsToAddTo.size()>0){
List<IWorkingSet> workingSets = new ArrayList<IWorkingSet>();//workingSetsToAddTo.size()
for(String currentWorkingSet : workingSetsToAddTo){
if(!currentWorkingSet.equals("")){
workingSets.add(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(currentWorkingSet));
}
}
PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(_wgaRuntime.getProject(), workingSets.toArray(new IWorkingSet[0]));
}
// configure tomcat
try {
Map<String,String> variables = new HashMap<String,String>();
TomcatUtils.getInstance().initConfDir(_wgaRuntime.getCatalinaConf().getLocation().toFile(), variables);
monitor.worked(1);
} catch (IOException e) {
throwCoreException(e.getMessage(), e);
}
project.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
}
}