public static IProject createCDTProject(String projectName, String pathInWorkspace, String[] configurationIds) throws OperationCanceledException, CoreException { CCorePlugin cdtCorePlugin = CCorePlugin.getDefault(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); IProject project = root.getProject(projectName); IndexerPreferences.set(project, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER); resourcesCreated.add(project); IProjectDescription prjDescription = workspace.newProjectDescription(projectName); IPath absoluteLocation = root.getLocation().append(pathInWorkspace); //IPath absoluteLocation = URIUtil.toPath(pathInWorkspace); prjDescription.setLocation(absoluteLocation); if (configurationIds!=null && configurationIds.length>0) { ICProjectDescriptionManager prjDescManager = cdtCorePlugin.getProjectDescriptionManager(); project.create(null); project.open(null); ICProjectDescription icPrjDescription = prjDescManager.createProjectDescription(project, false); ICConfigurationDescription baseConfiguration = cdtCorePlugin.getPreferenceConfiguration("org.eclipse.cdt.managedbuilder.core.configurationDataProvider"); for (String cfgId : configurationIds) { icPrjDescription.createConfiguration(cfgId, cfgId+" Name", baseConfiguration); } prjDescManager.setProjectDescription(project, icPrjDescription); } project = cdtCorePlugin.createCDTProject(prjDescription, project, new NullProgressMonitor()); IToolChain[] tcs = ManagedBuildManager.getRealToolChains(); ToolChain tc=null; for (int i=0; i<tcs.length; i++) { String str = tcs[i].getName(); if(str.contains("Cross GCC")) { tc = (ToolChain) tcs[i]; break; } } // Create configuration description ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType("cdt.managedbuild.target.gnu.cross.exe"); Assert.isNotNull(type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); //here I try to specify the toolchain: IConfiguration cfg = new Configuration(mProj, tc, "cdt.managedbuild.config.gnu.cross.exe", "GNU Toolchain"); waitForProjectRefreshToFinish(); Assert.isNotNull(project); project.open(null); Assert.isTrue(project.isOpen()); // add C Nature... CProjectNature.addCNature(project, null); ICProjectDescription des = CoreModel.getDefault().createProjectDescription(project, false); return project; }