mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
bug 272432: tidied up a bit
This commit is contained in:
parent
5f088e7a74
commit
4b6bf63742
1 changed files with 23 additions and 33 deletions
|
@ -10,11 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.templateengine.processes;
|
||||
|
||||
import org.eclipse.cdt.core.templateengine.process.processes.Messages;
|
||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||
import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
|
||||
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
|
||||
import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
|
||||
import org.eclipse.cdt.core.templateengine.process.processes.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||
|
@ -56,8 +56,7 @@ public class SetMBSStringOptionValue extends ProcessRunner {
|
|||
|
||||
ProcessArgument[][] resourcePathObjects = args[1].getComplexArrayValue();
|
||||
boolean modified = false;
|
||||
for(int i=0; i<resourcePathObjects.length; i++) {
|
||||
ProcessArgument[] resourcePathObject = resourcePathObjects[i];
|
||||
for (ProcessArgument[] resourcePathObject : resourcePathObjects) {
|
||||
String id = resourcePathObject[0].getSimpleValue();
|
||||
String value = resourcePathObject[1].getSimpleValue();
|
||||
String path = resourcePathObject[2].getSimpleValue();
|
||||
|
@ -84,8 +83,7 @@ public class SetMBSStringOptionValue extends ProcessRunner {
|
|||
boolean resource = !(path == null || path.equals("") || path.equals("/")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
boolean modified = false;
|
||||
|
||||
for(int i=0; i<projectConfigs.length; i++) {
|
||||
IConfiguration config = projectConfigs[i];
|
||||
for (IConfiguration config : projectConfigs) {
|
||||
IResourceConfiguration resourceConfig = null;
|
||||
if (resource) {
|
||||
resourceConfig = config.getResourceConfiguration(path);
|
||||
|
@ -97,16 +95,16 @@ public class SetMBSStringOptionValue extends ProcessRunner {
|
|||
resourceConfig = config.createResourceConfiguration(file);
|
||||
}
|
||||
ITool[] tools = resourceConfig.getTools();
|
||||
for(int j=0; j<tools.length; j++) {
|
||||
modified |= setOptionForResourceConfig(id, value, resourceConfig, tools[j].getOptions(), tools[j]);
|
||||
for (ITool tool : tools) {
|
||||
modified |= setOptionForResourceConfig(id, value, resourceConfig, tool.getOptions(), tool);
|
||||
}
|
||||
} else {
|
||||
IToolChain toolChain = config.getToolChain();
|
||||
modified |= setOptionForConfig(id, value, config, toolChain.getOptions(), toolChain);
|
||||
|
||||
ITool[] tools = config.getTools();
|
||||
for(int j=0; j<tools.length; j++) {
|
||||
modified |= setOptionForConfig(id, value, config, tools[j].getOptions(), tools[j]);
|
||||
for (ITool tool : tools) {
|
||||
modified |= setOptionForConfig(id, value, config, tool.getOptions(), tool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,15 +115,11 @@ public class SetMBSStringOptionValue extends ProcessRunner {
|
|||
private boolean setOptionForResourceConfig(String id, String value, IResourceConfiguration resourceConfig, IOption[] options, IHoldsOptions optionHolder) throws BuildException {
|
||||
boolean modified = false;
|
||||
String lowerId = id.toLowerCase();
|
||||
int optionType;
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i].getBaseId().toLowerCase().matches(lowerId)) {
|
||||
optionType = options[i].getValueType();
|
||||
for (IOption option : options) {
|
||||
if (option.getBaseId().toLowerCase().matches(lowerId)) {
|
||||
int optionType = option.getValueType();
|
||||
if ((optionType == IOption.STRING) || (optionType == IOption.ENUMERATED)) {
|
||||
IOption setOption = ManagedBuildManager.setOption(resourceConfig, optionHolder, options[i], value);
|
||||
if (setOption == null) {
|
||||
setOption = options[i];
|
||||
}
|
||||
ManagedBuildManager.setOption(resourceConfig, optionHolder, option, value);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
@ -136,15 +130,11 @@ public class SetMBSStringOptionValue extends ProcessRunner {
|
|||
private boolean setOptionForConfig(String id, String value, IConfiguration config, IOption[] options, IHoldsOptions optionHolder) throws BuildException {
|
||||
boolean modified = false;
|
||||
String lowerId = id.toLowerCase();
|
||||
int optionType;
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i].getBaseId().toLowerCase().matches(lowerId)) {
|
||||
optionType = options[i].getValueType();
|
||||
for (IOption option : options) {
|
||||
if (option.getBaseId().toLowerCase().matches(lowerId)) {
|
||||
int optionType = option.getValueType();
|
||||
if ((optionType == IOption.STRING) || (optionType == IOption.ENUMERATED)) {
|
||||
IOption setOption = ManagedBuildManager.setOption(config, optionHolder, options[i], value);
|
||||
if (setOption == null) {
|
||||
setOption = options[i];
|
||||
}
|
||||
ManagedBuildManager.setOption(config, optionHolder, option, value);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue