|
Re: Programatically how to convert project from one toolchain to another [message #1220712 is a reply to message #1220364] |
Fri, 13 December 2013 09:05 |
Babu M Messages: 20 Registered: February 2012 |
Junior Member |
|
|
got it.. this should do a conversion.
try {
ManagedCProjectNature.addManagedNature(project,
new SubProgressMonitor(monitor, 1));
CCorePlugin.getDefault().mapCProjectOwner(project, projectId, true);
IManagedProject newManagedProject = null;
IManagedBuildInfo info = null;
try {
info = ManagedBuildManager.createBuildInfo(project);
IProjectType projectType = ManagedBuildManager
.getExtensionProjectType(projectId);
newManagedProject = ManagedBuildManager.createManagedProject(
project, projectType);
if (newManagedProject != null) {
IConfiguration[] selectedConfigs = projectType
.getConfigurations();
for (int i = 0; i < selectedConfigs.length; i++) {
IConfiguration config = selectedConfigs[i];
int id = ManagedBuildManager.getRandomNumber();
IConfiguration newConfig = newManagedProject
.createConfiguration(config, config.getId()
+ "." + id);
newConfig.setArtifactName(project.getName());
}
IConfiguration[] newConfigs = newManagedProject
.getConfigurations();
for (int i = 0; i < newConfigs.length; i++) {
if (newConfigs[i].isSupported()) {
defaultCfg = newConfigs[i];
break;
}
}
if (defaultCfg == null && newConfigs.length > 0)
defaultCfg = newConfigs[0];
if (defaultCfg != null) {
ManagedBuildManager.setDefaultConfiguration(project,
defaultCfg);
ManagedBuildManager.setSelectedConfiguration(project,
defaultCfg);
}
ManagedBuildManager.setNewProjectVersion(project);
}
} catch (BuildException e) {
e.printStackTrace();
}
if (info != null) {
info.setValid(true);
ManagedBuildManager.saveBuildInfo(project, true);
}
|
|
|
Powered by
FUDForum. Page generated in 0.03328 seconds