[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Setting enumerated option value in a project
|
> This is again regarding my new MBS which I have implemented for a cross
> compiler.
>
> I have an enumerated option with CPU types which has three
> enumeratedOptionValues added.
>
> During new project generation wizard I have given the option of choosing
> between the CPU types by having a combo for selection.
>
> I want to set the value of the enumeratedOptionValue depending upon the
> CPU type selected during the project generation.
>
> If I use the option.setDefaultValue it changes the enumerated option
> value in all my open projects. I want the change only for my new
> project.
Rekha,
We seem to be doing about the same, below a template that's hopefully helpful:
public static void setCpuOption( IProject project, String cpu )
{
IManagedBuildInfo buildinfo = ManagedBuildManager.getBuildInfo(project);
IManagedProject mpjt = buildinfo.getManagedProject();
// presumes you want to set the CPU for all project configurations
for ( IConfiguration config : mpjt.getConfigurations() )
{
setConfigCpuOption(config,cpu);
}
ManagedBuildManager.saveBuildInfo(project,true);
}
public static void setConfigCpuOption( IConfiguration config, String cpu )
{
for ( ITool tool : config.getFilteredTools() ) // rewrite for Java 1.4
{
IOption option = tool.getOptionById( "<your cpu option id>" );
if ( option != null )
{
ManagedBuildManager.setOption(config,tool,option,cpu);
return;
}
}
}
Regards,
Wieant