[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Set active build configuration

I haven't looked at why your code doesn't work but here's some code I used in a test:

    // Emulates ChangeConfigAction
    private void changeProjectConfiguration(IProject project, String configName) throws CoreException, InterruptedException {
        ICProjectDescription prjd = CCorePlugin.getDefault().getProjectDescriptionManager().getProjectDescription(project);
        ICConfigurationDescription[] configs = prjd.getConfigurations();
        if (configs != null && configs.length > 0) {
            for (ICConfigurationDescription config : configs) {
                if (config.getName().equals(configName)) {
                    config.setActive();
                    CoreModel.getDefault().setProjectDescription(project, prjd);
                    break;
                }
            }
        }
    }

Marc-Andre

On 10/08/2012 11:05 AM, Hồ Thị Bé wrote:
I have some code
public static void activeBuiltRom(IProject project) throws CoreException{
        IProjectDescription desc = project.getDescription();
        IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
        IConfiguration configs[] = buildInfo.getManagedProject().getConfigurations();
       
       
        desc.setActiveBuildConfig(configs[0].toString());
        project.setDescription(desc, null);
        ManagedBuildManager.saveBuildInfo(project, true);

    }
But it's not effect to active build configuration


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev