use of org.eclipse.cdt.managedbuilder.core.IResourceConfiguration in project usbdm-eclipse-plugins by podonoghue.
the class ApplyOptions method setOptionValue.
// public void updateConfigurations(IProgressMonitor monitor) {
// ManagedBuildManager.saveBuildInfo(projectHandle, true);
// IConfiguration[] projectConfigs = ManagedBuildManager.getBuildInfo(projectHandle).getManagedProject().getConfigurations();
// for (IConfiguration config : projectConfigs) {
// ScannerConfigBuilder.build(config, ScannerConfigBuilder.PERFORM_CORE_UPDATE, monitor);
// }
// }
private boolean setOptionValue(String id, String[] value, String path, boolean replace, String targetConfig, IProgressMonitor monitor) throws Exception {
IConfiguration[] projectConfigs = ManagedBuildManager.getBuildInfo(projectHandle).getManagedProject().getConfigurations();
// $NON-NLS-1$ //$NON-NLS-2$
boolean resource = !(path == null || path.equals("") || path.equals("/"));
boolean modified = false;
for (IConfiguration config : projectConfigs) {
if ((targetConfig != null) && !config.getId().contains(targetConfig)) {
// System.err.println("ApplyOptions() - Skipping config " + config.getId()); //$NON-NLS-1$
continue;
}
IResourceConfiguration resourceConfig = null;
if (resource) {
resourceConfig = config.getResourceConfiguration(path);
if (resourceConfig == null) {
IFile file = projectHandle.getFile(path);
if (file == null) {
// $NON-NLS-1$
throw new Exception("ApplyOptions() file is null for path = " + path);
}
resourceConfig = config.createResourceConfiguration(file);
}
ITool[] tools = resourceConfig.getTools();
for (ITool tool : tools) {
modified |= addToOptionForResourceConfig(id, value, replace, resourceConfig, tool.getOptions(), tool);
}
} else {
IToolChain toolChain = config.getToolChain();
modified |= addToOptionForConfig(id, value, replace, config, toolChain.getOptions(), toolChain);
ITool[] tools = config.getTools();
for (ITool tool : tools) {
modified |= addToOptionForConfig(id, value, replace, config, tool.getOptions(), tool);
}
}
}
return modified;
}
Aggregations