1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

crecoskie July 1, 2005

- Applying minor patch from Jerimiah Lott to refactor some code into protected methods.  This should allow for better subclassing of the wizard.
This commit is contained in:
Chris Recoskie 2005-07-01 18:53:56 +00:00
parent 47dfe9b49c
commit 841ba5d06f

View file

@ -120,6 +120,15 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
optionPage.updateProjectTypeProperties(); optionPage.updateProjectTypeProperties();
} }
protected void addNature(IProgressMonitor monitor) throws CoreException {
monitor.beginTask("", 2);
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_NATURE));
ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_BUILDER));
ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
monitor.done();
}
protected void doRun(IProgressMonitor monitor) throws CoreException { protected void doRun(IProgressMonitor monitor) throws CoreException {
if (monitor == null) { if (monitor == null) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
@ -130,10 +139,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
// Add the managed build nature and builder // Add the managed build nature and builder
try { try {
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_NATURE)); addNature(new SubProgressMonitor(monitor, 2));
ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
monitor.subTask(ManagedBuilderUIMessages.getResourceString(MSG_ADD_BUILDER));
ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
} catch (CoreException e) { } catch (CoreException e) {
ManagedBuilderUIPlugin.log(e); ManagedBuilderUIPlugin.log(e);
} }
@ -143,10 +149,10 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
IManagedBuildInfo info = null; IManagedBuildInfo info = null;
try { try {
info = ManagedBuildManager.createBuildInfo(newProject); info = ManagedBuildManager.createBuildInfo(newProject);
IProjectType parent = projectConfigurationPage.getSelectedProjectType(); IProjectType parent = getSelectedProjectType();
newManagedProject = ManagedBuildManager.createManagedProject(newProject, parent); newManagedProject = ManagedBuildManager.createManagedProject(newProject, parent);
if (newManagedProject != null) { if (newManagedProject != null) {
IConfiguration [] selectedConfigs = projectConfigurationPage.getSelectedConfigurations(); IConfiguration [] selectedConfigs = getSelectedConfigurations();
for (int i = 0; i < selectedConfigs.length; i++) { for (int i = 0; i < selectedConfigs.length; i++) {
IConfiguration config = selectedConfigs[i]; IConfiguration config = selectedConfigs[i];
int id = ManagedBuildManager.getRandomNumber(); int id = ManagedBuildManager.getRandomNumber();
@ -257,4 +263,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard {
return projectConfigurationPage.getSelectedProjectType(); return projectConfigurationPage.getSelectedProjectType();
} }
public IConfiguration[] getSelectedConfigurations() {
return projectConfigurationPage.getSelectedConfigurations();
}
} }