Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 250982 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/ui/wizards/CCProjectWizard.java (-3 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation and others.
2
 * Copyright (c) 2007, 2008 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-18 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Intel Corporation - initial API and implementation
9
 *     Intel Corporation - initial API and implementation
10
 *     IBM Corporation
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.ui.wizards;
12
package org.eclipse.cdt.ui.wizards;
12
13
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.core.runtime.NullProgressMonitor;
17
import org.eclipse.core.runtime.SubProgressMonitor;
16
18
17
import org.eclipse.cdt.core.CCProjectNature;
19
import org.eclipse.cdt.core.CCProjectNature;
18
import org.eclipse.cdt.core.CCorePlugin;
20
import org.eclipse.cdt.core.CCorePlugin;
Lines 32-41 Link Here
32
	
34
	
33
	@Override
35
	@Override
34
	protected IProject continueCreation(IProject prj) {
36
	protected IProject continueCreation(IProject prj) {
37
		if (continueCreationMonitor == null) {
38
			continueCreationMonitor = new NullProgressMonitor();
39
		}
40
		
35
		try {
41
		try {
36
			CProjectNature.addCNature(prj, new NullProgressMonitor());
42
			continueCreationMonitor.beginTask(UIMessages.getString("CCProjectWizard.0"), 2); //$NON-NLS-1$
37
			CCProjectNature.addCCNature(prj, new NullProgressMonitor());
43
			CProjectNature.addCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
44
			CCProjectNature.addCCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
38
		} catch (CoreException e) {}
45
		} catch (CoreException e) {}
46
		finally {continueCreationMonitor.done();}
39
		return prj;
47
		return prj;
40
	}
48
	}
41
	
49
	
(-)src/org/eclipse/cdt/ui/wizards/CDTCommonProjectWizard.java (-11 / +64 lines)
Lines 34-39 Link Here
34
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.IProgressMonitor;
35
import org.eclipse.core.runtime.NullProgressMonitor;
35
import org.eclipse.core.runtime.NullProgressMonitor;
36
import org.eclipse.core.runtime.Platform;
36
import org.eclipse.core.runtime.Platform;
37
import org.eclipse.core.runtime.SubProgressMonitor;
37
import org.eclipse.core.runtime.content.IContentType;
38
import org.eclipse.core.runtime.content.IContentType;
38
import org.eclipse.core.runtime.content.IContentTypeManager;
39
import org.eclipse.core.runtime.content.IContentTypeManager;
39
import org.eclipse.jface.dialogs.MessageDialog;
40
import org.eclipse.jface.dialogs.MessageDialog;
Lines 230-252 Link Here
230
		final boolean defaults = _defaults;
231
		final boolean defaults = _defaults;
231
		return new IRunnableWithProgress() {
232
		return new IRunnableWithProgress() {
232
			public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
233
			public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
234
				final Exception except[] = new Exception[1];
233
				getShell().getDisplay().syncExec(new Runnable() {
235
				getShell().getDisplay().syncExec(new Runnable() {
234
					public void run() { 
236
					public void run() {
237
						IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
238
							public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
239
								final IProgressMonitor fMonitor;
240
								if (monitor == null) {
241
									fMonitor= new NullProgressMonitor();
242
								} else {
243
									fMonitor = monitor;
244
								}
245
								fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
246
								fMonitor.worked(10);
247
								try {							
248
									newProject = createIProject(lastProjectName, lastProjectLocation, new SubProgressMonitor(fMonitor, 40));
249
									if (newProject != null) 
250
										fMainPage.h_selected.createProject(newProject, defaults, onFinish, new SubProgressMonitor(fMonitor, 40));
251
									fMonitor.worked(10);
252
								} catch (CoreException e) {	CUIPlugin.log(e); }
253
								finally {
254
									fMonitor.done();
255
								}
256
							}
257
						});
235
						try {
258
						try {
236
							newProject = createIProject(lastProjectName, lastProjectLocation);
259
							getContainer().run(false, true, op);
237
							if (newProject != null) 
260
						} catch (InvocationTargetException e) {
238
								fMainPage.h_selected.createProject(newProject, defaults, onFinish);
261
							except[0] = e;
239
						} catch (CoreException e) {	CUIPlugin.log(e); }
262
						} catch (InterruptedException e) {
263
							except[0] = e;
264
						}
240
					}
265
					}
241
				});
266
				});
267
				if (except[0] != null) {
268
					if (except[0] instanceof InvocationTargetException) {
269
						throw (InvocationTargetException)except[0];
270
					}
271
					if (except[0] instanceof InterruptedException) {
272
						throw (InterruptedException)except[0];
273
					}
274
					throw new InvocationTargetException(except[0]);
275
				}					
242
			}
276
			}
243
		};
277
		};
244
	}
278
	}
279
	
280
	public IProject createIProject(final String name, final URI location) throws CoreException{
281
		return createIProject(name, location, new NullProgressMonitor());
282
	}
283
	
284
	/**
285
	 * @since 5.1
286
	 */
287
	protected IProgressMonitor continueCreationMonitor;
245
288
246
	/**
289
	/**
290
	 * @param monitor 
291
	 * @since 5.1
247
	 * 
292
	 * 
248
	 */	
293
	 */	
249
	public IProject createIProject(final String name, final URI location) throws CoreException{
294
	public IProject createIProject(final String name, final URI location, IProgressMonitor monitor) throws CoreException{
295
		
296
		monitor.beginTask("createIProject", 100);
297
		
250
		if (newProject != null)	return newProject;
298
		if (newProject != null)	return newProject;
251
		
299
		
252
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
300
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
Lines 260-282 Link Here
260
			IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
308
			IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
261
			if(location != null)
309
			if(location != null)
262
				description.setLocationURI(location);
310
				description.setLocationURI(location);
263
			newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new NullProgressMonitor());
311
			newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new SubProgressMonitor(monitor,25));
264
		} else {
312
		} else {
265
			IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
313
			IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
266
				public void run(IProgressMonitor monitor) throws CoreException {
314
				public void run(IProgressMonitor monitor) throws CoreException {
267
					newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
315
					newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
268
				}
316
				}
269
			};
317
			};
270
			NullProgressMonitor monitor = new NullProgressMonitor();
318
			workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, new SubProgressMonitor(monitor,25));
271
			workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor);
272
			newProject = newProjectHandle;
319
			newProject = newProjectHandle;
273
		}
320
		}
274
        
321
        
275
		// Open the project if we have to
322
		// Open the project if we have to
276
		if (!newProject.isOpen()) {
323
		if (!newProject.isOpen()) {
277
			newProject.open(new NullProgressMonitor());
324
			newProject.open(new SubProgressMonitor(monitor,25));
278
		}
325
		}
279
		return continueCreation(newProject);	
326
		
327
		continueCreationMonitor = new SubProgressMonitor(monitor,25);
328
		IProject proj = continueCreation(newProject);
329
		
330
		monitor.done();
331
		
332
		return proj;	
280
	}
333
	}
281
	
334
	
282
	protected abstract IProject continueCreation(IProject prj); 
335
	protected abstract IProject continueCreation(IProject prj); 
(-)src/org/eclipse/cdt/ui/wizards/CWizardHandler.java (-1 / +33 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Intel Corporation - initial API and implementation
9
 *     Intel Corporation - initial API and implementation
10
 *     IBM Corporation
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.ui.wizards;
12
package org.eclipse.cdt.ui.wizards;
12
13
Lines 14-19 Link Here
14
15
15
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.jface.wizard.IWizardPage;
19
import org.eclipse.jface.wizard.IWizardPage;
18
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.graphics.Image;
21
import org.eclipse.swt.graphics.Image;
Lines 148-154 Link Here
148
	 * @param proj - simple project to be used as base
150
	 * @param proj - simple project to be used as base
149
	 * @param defaults - true if called from 1st Wizard page
151
	 * @param defaults - true if called from 1st Wizard page
150
	 * @param onFinish - true when the project creation is performed on finish. false -otherwise
152
	 * @param onFinish - true when the project creation is performed on finish. false -otherwise
151
	 * false means that the project created is actually a temporary one that can be removed in case cancell is pressed
153
	 * false means that the project created is actually a temporary one that can be removed in case cancel is pressed
152
	 * 
154
	 * 
153
	 * @throws CoreException
155
	 * @throws CoreException
154
	 */
156
	 */
Lines 156-161 Link Here
156
			throws CoreException {
158
			throws CoreException {
157
		createProject(proj, defaults);
159
		createProject(proj, defaults);
158
	}
160
	}
161
	
162
163
	/**
164
	 * Creates project
165
	 * 
166
	 * @param proj - simple project to be used as base
167
	 * @param defaults - true if called from 1st Wizard page
168
	 * @param monitor - progress monitor to track the creation process
169
	 * @throws CoreException
170
	 * @since 5.1
171
	 */
172
	public void createProject(IProject proj, boolean defaults, IProgressMonitor monitor)
173
			throws CoreException {}
174
175
	/**
176
	 * Creates project
177
	 * 
178
	 * @param proj - simple project to be used as base
179
	 * @param defaults - true if called from 1st Wizard page
180
	 * @param onFinish - true when the project creation is performed on finish. false -otherwise
181
	 * false means that the project created is actually a temporary one that can be removed in case cancel is pressed
182
	 * @param monitor - progress monitor to track the creation process
183
	 * 
184
	 * @throws CoreException
185
	 * @since 5.1
186
	 */
187
	public void createProject(IProject proj, boolean defaults, boolean onFinish, IProgressMonitor monitor)
188
			throws CoreException {
189
		createProject(proj, defaults, monitor);
190
	}
159
	/**
191
	/**
160
	 * 
192
	 * 
161
	 * @return true if settings were changed 
193
	 * @return true if settings were changed 
(-)src/org/eclipse/cdt/ui/wizards/CProjectWizard.java (-3 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 Intel Corporation and others.
2
 * Copyright (c) 2007, 2008 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-18 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Intel Corporation - initial API and implementation
9
 *     Intel Corporation - initial API and implementation
10
 *     IBM Corporation
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.ui.wizards;
12
package org.eclipse.cdt.ui.wizards;
12
13
13
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.resources.IProject;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.core.runtime.NullProgressMonitor;
17
import org.eclipse.core.runtime.SubProgressMonitor;
16
18
17
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.CProjectNature;
20
import org.eclipse.cdt.core.CProjectNature;
Lines 29-40 Link Here
29
	public String[] getNatures() {
31
	public String[] getNatures() {
30
		return new String[] { CProjectNature.C_NATURE_ID };
32
		return new String[] { CProjectNature.C_NATURE_ID };
31
	}
33
	}
32
34
	
33
	@Override
35
	@Override
34
	protected IProject continueCreation(IProject prj) {
36
	protected IProject continueCreation(IProject prj) {
37
		if (continueCreationMonitor == null) {
38
			continueCreationMonitor = new NullProgressMonitor();
39
		}
40
		
35
		try {
41
		try {
36
			CProjectNature.addCNature(prj, new NullProgressMonitor());
42
			continueCreationMonitor.beginTask(UIMessages.getString("CProjectWizard.0"), 1); //$NON-NLS-1$
43
			CProjectNature.addCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
37
		} catch (CoreException e) {}
44
		} catch (CoreException e) {}
45
		finally {continueCreationMonitor.done();}
38
		return prj;
46
		return prj;
39
	}
47
	}
40
48
(-)src/org/eclipse/cdt/ui/newui/PluginResources.properties (+2 lines)
Lines 526-531 Link Here
526
NewCfgDialog.5=Import predefined
526
NewCfgDialog.5=Import predefined
527
CDTMainWizardPage.0=Project name cannot contain '\#' symbol
527
CDTMainWizardPage.0=Project name cannot contain '\#' symbol
528
CDTMainWizardPage.1=Project category is selected. Expand the category and select a concrete project type.
528
CDTMainWizardPage.1=Project category is selected. Expand the category and select a concrete project type.
529
CProjectWizard.0=Add C Project Nature
530
CCProjectWizard.0=Add CC Project Nature
529
WorkingSetConfigAction.0=Symbols '
531
WorkingSetConfigAction.0=Symbols '
530
WorkingSetConfigAction.1=Choose active configs for Working Sets
532
WorkingSetConfigAction.1=Choose active configs for Working Sets
531
WorkingSetConfigAction.10=-- CURRENT --
533
WorkingSetConfigAction.10=-- CURRENT --
(-)src/org/eclipse/cdt/managedbuilder/ui/wizards/STDWizardHandler.java (-31 / +42 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Intel Corporation - initial API and implementation
9
 *     Intel Corporation - initial API and implementation
10
 *     IBM Corporation
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.managedbuilder.ui.wizards;
12
package org.eclipse.cdt.managedbuilder.ui.wizards;
12
13
Lines 26-31 Link Here
26
import org.eclipse.cdt.ui.newui.UIMessages;
27
import org.eclipse.cdt.ui.newui.UIMessages;
27
import org.eclipse.core.resources.IProject;
28
import org.eclipse.core.resources.IProject;
28
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.core.runtime.CoreException;
30
import org.eclipse.core.runtime.IProgressMonitor;
29
import org.eclipse.jface.wizard.IWizard;
31
import org.eclipse.jface.wizard.IWizard;
30
import org.eclipse.swt.widgets.Composite;
32
import org.eclipse.swt.widgets.Composite;
31
33
Lines 48-87 Link Here
48
	/**
50
	/**
49
	 * Note that configurations parameter is ignored
51
	 * Note that configurations parameter is ignored
50
	 */
52
	 */
51
	public void createProject(IProject project, boolean defaults, boolean onFinish)  throws CoreException {
53
	@Override
52
		ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
54
	public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)  throws CoreException {
53
		ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
55
		try {
54
		ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
56
			monitor.beginTask("", 100);//$NON-NLS-1$
55
		ManagedProject mProj = new ManagedProject(des);
57
		
56
		info.setManagedProject(mProj);
58
			ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
57
59
			ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
58
		cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
60
			ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
59
		cfgs = CfgHolder.reorder(cfgs);
61
			ManagedProject mProj = new ManagedProject(des);
60
			
62
			info.setManagedProject(mProj);
61
		for (int i=0; i<cfgs.length; i++) {
63
			monitor.worked(20);
62
			String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId();  //$NON-NLS-1$
64
			cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
63
			Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
65
			cfgs = CfgHolder.reorder(cfgs);
64
			IBuilder bld = cfg.getEditableBuilder();
66
			int work = 50/cfgs.length;
65
			if (bld != null) {
67
			for (int i=0; i<cfgs.length; i++) {
66
				if(bld.isInternalBuilder()){
68
				String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId();  //$NON-NLS-1$
67
					IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
69
				Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
68
					IBuilder prefBuilder = prefCfg.getBuilder();
70
				IBuilder bld = cfg.getEditableBuilder();
69
					cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
71
				if (bld != null) {
70
					bld = cfg.getEditableBuilder();
72
					if(bld.isInternalBuilder()){
71
					bld.setBuildPath(null);
73
						IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
74
						IBuilder prefBuilder = prefCfg.getBuilder();
75
						cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
76
						bld = cfg.getEditableBuilder();
77
						bld.setBuildPath(null);
78
					}
79
					bld.setManagedBuildOn(false);
80
				} else {
81
					System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
72
				}
82
				}
73
				bld.setManagedBuildOn(false);
83
				cfg.setArtifactName(removeSpaces(project.getName()));
74
			} else {
84
				CConfigurationData data = cfg.getConfigurationData();
75
				System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
85
				des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
86
				monitor.worked(work);
76
			}
87
			}
77
			cfg.setArtifactName(removeSpaces(project.getName()));
88
			mngr.setProjectDescription(project, des);
78
			CConfigurationData data = cfg.getConfigurationData();
89
			
79
			des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
90
			doTemplatesPostProcess(project);
91
			doCustom(project);
92
			monitor.worked(30);
93
		} finally {
94
			monitor.done();
80
		}
95
		}
81
		mngr.setProjectDescription(project, des);
82
		
83
		doTemplatesPostProcess(project);
84
		doCustom(project);
85
	}
96
	}
86
	public boolean canCreateWithoutToolchain() { return true; } 
97
	public boolean canCreateWithoutToolchain() { return true; } 
87
	
98
	
(-)src/org/eclipse/cdt/managedbuilder/ui/wizards/MBSWizardHandler.java (-48 / +58 lines)
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) {

Return to bug 250982