use of org.eclipse.cdt.internal.autotools.core.configure.IConfigureOption in project linuxtools by eclipse.
the class CProjectBuildHelpers method isOptionCheckedInAutotoolsPrefStore.
/**
* <h1>Option enabled check</h1>
* <p> Check to see if an option is enabled in the .autotools configuration.</p>
*
* @param project the IProject project which will be read to check if it is c or cpp.
* @param optionId copy paste directly from .autotools. pick the 'ID' field value.
* @return true if it is
*/
public static boolean isOptionCheckedInAutotoolsPrefStore(final IProject project, final String optionId) {
// We define a 'final' variable that will be accessible in the runnable object.
final BooleanWithGetSet userChoiceBool = new BooleanWithGetSet(false);
// need to run this in the ui thread otherwise get SWT Exceptions
// based on concurrency issues.
Display.getDefault().syncExec(() -> {
// Code copied from private methd: SetAutotoolsStringOptionValue.setOptionValue()
// Except I added a line to save the configuration to disk as well.
AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
ICConfigurationDescription cfgds = CoreModel.getDefault().getProjectDescription(project).getActiveConfiguration();
if (cfgds != null) {
IAConfiguration iaConfig = AutotoolsConfigurationManager.getInstance().getConfiguration(project, cfgds.getId());
// Read option value
IConfigureOption option = iaConfig.getOption(optionId);
String optValString = option.getValue();
boolean optVal = Boolean.parseBoolean(optValString);
userChoiceBool.setVal(optVal);
}
});
return userChoiceBool.getVal();
}
Aggregations