|
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 520-573
Link Here
|
| 520 |
full_tcs.put(tc.getUniqueRealName(), tc); |
521 |
full_tcs.put(tc.getUniqueRealName(), tc); |
| 521 |
} |
522 |
} |
| 522 |
|
523 |
|
| 523 |
public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException { |
524 |
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException { |
| 524 |
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); |
525 |
try { |
| 525 |
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish); |
526 |
monitor.beginTask("", 100); //$NON-NLS-1$ |
| 526 |
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); |
527 |
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); |
| 527 |
|
528 |
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish); |
| 528 |
cfgs = fConfigPage.getCfgItems(false); |
529 |
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); |
| 529 |
if (cfgs == null || cfgs.length == 0) |
530 |
monitor.worked(10); |
| 530 |
cfgs = CDTConfigWizardPage.getDefaultCfgs(this); |
531 |
cfgs = fConfigPage.getCfgItems(false); |
| 531 |
|
532 |
if (cfgs == null || cfgs.length == 0) |
| 532 |
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) { |
533 |
cfgs = CDTConfigWizardPage.getDefaultCfgs(this); |
| 533 |
throw new CoreException(new Status(IStatus.ERROR, |
534 |
|
| 534 |
ManagedBuilderUIPlugin.getUniqueIdentifier(), |
535 |
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) { |
| 535 |
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$ |
536 |
throw new CoreException(new Status(IStatus.ERROR, |
| 536 |
} |
537 |
ManagedBuilderUIPlugin.getUniqueIdentifier(), |
| 537 |
Configuration cf = (Configuration)cfgs[0].getConfiguration(); |
538 |
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$ |
| 538 |
ManagedProject mProj = new ManagedProject(project, cf.getProjectType()); |
539 |
} |
| 539 |
info.setManagedProject(mProj); |
540 |
Configuration cf = (Configuration)cfgs[0].getConfiguration(); |
| 540 |
|
541 |
ManagedProject mProj = new ManagedProject(project, cf.getProjectType()); |
| 541 |
cfgs = CfgHolder.unique(cfgs); |
542 |
info.setManagedProject(mProj); |
| 542 |
cfgs = CfgHolder.reorder(cfgs); |
543 |
monitor.worked(10); |
| 543 |
|
544 |
cfgs = CfgHolder.unique(cfgs); |
| 544 |
ICConfigurationDescription cfgDebug = null; |
545 |
cfgs = CfgHolder.reorder(cfgs); |
| 545 |
ICConfigurationDescription cfgFirst = null; |
546 |
|
| 546 |
|
547 |
ICConfigurationDescription cfgDebug = null; |
| 547 |
for(int i = 0; i < cfgs.length; i++){ |
548 |
ICConfigurationDescription cfgFirst = null; |
| 548 |
cf = (Configuration)cfgs[i].getConfiguration(); |
549 |
|
| 549 |
String id = ManagedBuildManager.calculateChildId(cf.getId(), null); |
550 |
int work = 50/cfgs.length; |
| 550 |
Configuration config = new Configuration(mProj, cf, id, false, true); |
551 |
|
| 551 |
CConfigurationData data = config.getConfigurationData(); |
552 |
for(int i = 0; i < cfgs.length; i++){ |
| 552 |
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); |
553 |
cf = (Configuration)cfgs[i].getConfiguration(); |
| 553 |
config.setConfigurationDescription(cfgDes); |
554 |
String id = ManagedBuildManager.calculateChildId(cf.getId(), null); |
| 554 |
config.exportArtifactInfo(); |
555 |
Configuration config = new Configuration(mProj, cf, id, false, true); |
| 555 |
|
556 |
CConfigurationData data = config.getConfigurationData(); |
| 556 |
IBuilder bld = config.getEditableBuilder(); |
557 |
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); |
| 557 |
if (bld != null) { bld.setManagedBuildOn(true); } |
558 |
config.setConfigurationDescription(cfgDes); |
| 558 |
|
559 |
config.exportArtifactInfo(); |
| 559 |
config.setName(cfgs[i].getName()); |
560 |
|
| 560 |
config.setArtifactName(removeSpaces(project.getName())); |
561 |
IBuilder bld = config.getEditableBuilder(); |
| 561 |
|
562 |
if (bld != null) { bld.setManagedBuildOn(true); } |
| 562 |
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY); |
563 |
|
| 563 |
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId())) |
564 |
config.setName(cfgs[i].getName()); |
| 564 |
cfgDebug = cfgDes; |
565 |
config.setArtifactName(removeSpaces(project.getName())); |
| 565 |
if (cfgFirst == null) // select at least first configuration |
566 |
|
| 566 |
cfgFirst = cfgDes; |
567 |
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY); |
| 567 |
} |
568 |
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId())) |
| 568 |
mngr.setProjectDescription(project, des); |
569 |
cfgDebug = cfgDes; |
| 569 |
doTemplatesPostProcess(project); |
570 |
if (cfgFirst == null) // select at least first configuration |
| 570 |
doCustom(project); |
571 |
cfgFirst = cfgDes; |
|
|
572 |
monitor.worked(work); |
| 573 |
} |
| 574 |
mngr.setProjectDescription(project, des); |
| 575 |
doTemplatesPostProcess(project); |
| 576 |
doCustom(project); |
| 577 |
monitor.worked(30); |
| 578 |
} finally { |
| 579 |
monitor.done(); |
| 580 |
} |
| 571 |
} |
581 |
} |
| 572 |
|
582 |
|
| 573 |
protected void doTemplatesPostProcess(IProject prj) { |
583 |
protected void doTemplatesPostProcess(IProject prj) { |