use of io.sloeber.core.api.ConfigurationDescriptor in project arduino-eclipse-plugin by Sloeber.
the class ShouldHaveBeenInCDT method setCProjectDescription.
/*
* Copied from wizard STDWizardHandler package package
* org.eclipse.cdt.managedbuilder.ui.wizards;; This method creates the
* .cProject file in your project.
*
* BK: modified this and made it work for multiple configs.
*/
/**
* This method creates the .cProject file in your project. it is intended to
* be used with newly created projects. Using this method with project that
* have existed for some time is unknown
*
* @param project
* The newly created project that needs a .cproject file.
* @param alCfgs
* An array-list of configuration descriptors (names, toolchain
* IDs) to be used with this project
* @param isManagedBuild
* When true the project is managed build. Else the project is
* not (read you have to maintain the makefiles yourself)
* @param monitor
* The monitor to follow the process
* @throws CoreException
*/
public static ICProjectDescription setCProjectDescription(IProject project, ArrayList<ConfigurationDescriptor> alCfgs, boolean isManagedBuild, IProgressMonitor monitor) throws CoreException {
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription des = mngr.createProjectDescription(project, false, true);
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
ManagedProject mProj = new ManagedProject(des);
info.setManagedProject(mProj);
monitor.worked(20);
// Iterate across the configurations
for (ConfigurationDescriptor curConfDesc : alCfgs) {
IToolChain tcs = ManagedBuildManager.getExtensionToolChain(curConfDesc.ToolchainID);
Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(curConfDesc.ToolchainID, null), curConfDesc.configName);
IBuilder bld = cfg.getEditableBuilder();
if (bld != null) {
bld.setManagedBuildOn(isManagedBuild);
// $NON-NLS-1$
cfg.setArtifactName("${ProjName}");
} else {
// $NON-NLS-1$
System.out.println("Messages.StdProjectTypeHandler_3");
}
CConfigurationData data = cfg.getConfigurationData();
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
setDefaultLanguageSettingsProviders(project, curConfDesc, cfg, cfgDes);
}
monitor.worked(50);
return des;
}
Aggregations