|
Lines 55-60
Link Here
|
| 55 |
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener; |
55 |
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener; |
| 56 |
import org.eclipse.core.resources.IProject; |
56 |
import org.eclipse.core.resources.IProject; |
| 57 |
import org.eclipse.core.runtime.CoreException; |
57 |
import org.eclipse.core.runtime.CoreException; |
|
|
58 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 58 |
import org.eclipse.core.runtime.IStatus; |
59 |
import org.eclipse.core.runtime.IStatus; |
| 59 |
import org.eclipse.core.runtime.Status; |
60 |
import org.eclipse.core.runtime.Status; |
| 60 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
61 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
|
Lines 502-555
Link Here
|
| 502 |
} |
503 |
} |
| 503 |
|
504 |
|
| 504 |
@Override |
505 |
@Override |
| 505 |
public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException { |
506 |
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException { |
| 506 |
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); |
507 |
try { |
| 507 |
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish); |
508 |
monitor.beginTask("Create project", 100); |
| 508 |
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); |
509 |
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); |
| 509 |
|
510 |
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish); |
| 510 |
cfgs = fConfigPage.getCfgItems(false); |
511 |
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); |
| 511 |
if (cfgs == null || cfgs.length == 0) |
512 |
monitor.worked(10); |
| 512 |
cfgs = CDTConfigWizardPage.getDefaultCfgs(this); |
513 |
cfgs = fConfigPage.getCfgItems(false); |
| 513 |
|
514 |
if (cfgs == null || cfgs.length == 0) |
| 514 |
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) { |
515 |
cfgs = CDTConfigWizardPage.getDefaultCfgs(this); |
| 515 |
throw new CoreException(new Status(IStatus.ERROR, |
516 |
|
| 516 |
ManagedBuilderUIPlugin.getUniqueIdentifier(), |
517 |
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) { |
| 517 |
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$ |
518 |
throw new CoreException(new Status(IStatus.ERROR, |
| 518 |
} |
519 |
ManagedBuilderUIPlugin.getUniqueIdentifier(), |
| 519 |
Configuration cf = (Configuration)cfgs[0].getConfiguration(); |
520 |
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$ |
| 520 |
ManagedProject mProj = new ManagedProject(project, cf.getProjectType()); |
521 |
} |
| 521 |
info.setManagedProject(mProj); |
522 |
Configuration cf = (Configuration)cfgs[0].getConfiguration(); |
| 522 |
|
523 |
ManagedProject mProj = new ManagedProject(project, cf.getProjectType()); |
| 523 |
cfgs = CfgHolder.unique(cfgs); |
524 |
info.setManagedProject(mProj); |
| 524 |
cfgs = CfgHolder.reorder(cfgs); |
525 |
monitor.worked(10); |
| 525 |
|
526 |
cfgs = CfgHolder.unique(cfgs); |
| 526 |
ICConfigurationDescription cfgDebug = null; |
527 |
cfgs = CfgHolder.reorder(cfgs); |
| 527 |
ICConfigurationDescription cfgFirst = null; |
528 |
|
| 528 |
|
529 |
ICConfigurationDescription cfgDebug = null; |
| 529 |
for(int i = 0; i < cfgs.length; i++){ |
530 |
ICConfigurationDescription cfgFirst = null; |
| 530 |
cf = (Configuration)cfgs[i].getConfiguration(); |
531 |
|
| 531 |
String id = ManagedBuildManager.calculateChildId(cf.getId(), null); |
532 |
int work = 50/cfgs.length; |
| 532 |
Configuration config = new Configuration(mProj, cf, id, false, true); |
533 |
|
| 533 |
CConfigurationData data = config.getConfigurationData(); |
534 |
for(int i = 0; i < cfgs.length; i++){ |
| 534 |
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); |
535 |
cf = (Configuration)cfgs[i].getConfiguration(); |
| 535 |
config.setConfigurationDescription(cfgDes); |
536 |
String id = ManagedBuildManager.calculateChildId(cf.getId(), null); |
| 536 |
config.exportArtifactInfo(); |
537 |
Configuration config = new Configuration(mProj, cf, id, false, true); |
| 537 |
|
538 |
CConfigurationData data = config.getConfigurationData(); |
| 538 |
IBuilder bld = config.getEditableBuilder(); |
539 |
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); |
| 539 |
if (bld != null) { bld.setManagedBuildOn(true); } |
540 |
config.setConfigurationDescription(cfgDes); |
| 540 |
|
541 |
config.exportArtifactInfo(); |
| 541 |
config.setName(cfgs[i].getName()); |
542 |
|
| 542 |
config.setArtifactName(removeSpaces(project.getName())); |
543 |
IBuilder bld = config.getEditableBuilder(); |
| 543 |
|
544 |
if (bld != null) { bld.setManagedBuildOn(true); } |
| 544 |
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY); |
545 |
|
| 545 |
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId())) |
546 |
config.setName(cfgs[i].getName()); |
| 546 |
cfgDebug = cfgDes; |
547 |
config.setArtifactName(removeSpaces(project.getName())); |
| 547 |
if (cfgFirst == null) // select at least first configuration |
548 |
|
| 548 |
cfgFirst = cfgDes; |
549 |
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY); |
| 549 |
} |
550 |
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId())) |
| 550 |
mngr.setProjectDescription(project, des); |
551 |
cfgDebug = cfgDes; |
| 551 |
doTemplatesPostProcess(project); |
552 |
if (cfgFirst == null) // select at least first configuration |
| 552 |
doCustom(project); |
553 |
cfgFirst = cfgDes; |
|
|
554 |
monitor.worked(work); |
| 555 |
} |
| 556 |
mngr.setProjectDescription(project, des); |
| 557 |
doTemplatesPostProcess(project); |
| 558 |
doCustom(project); |
| 559 |
monitor.worked(30); |
| 560 |
} finally { |
| 561 |
monitor.done(); |
| 562 |
} |
| 553 |
} |
563 |
} |
| 554 |
|
564 |
|
| 555 |
@Override |
565 |
@Override |