1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

cleanup: loops, spaces, some generics

This commit is contained in:
Andrew Gvozdev 2010-01-02 19:27:05 +00:00
parent 172ea442ad
commit a3665af421

View file

@ -56,7 +56,6 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription; import org.eclipse.cdt.core.settings.model.ICMultiConfigDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
@ -250,7 +249,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// Environment Build Paths Change Listener // Environment Build Paths Change Listener
private static IEnvironmentBuildPathsChangeListener fEnvironmentBuildPathsChangeListener; private static IEnvironmentBuildPathsChangeListener fEnvironmentBuildPathsChangeListener;
private static HashMap fSortedToolChains; private static HashMap<String, List<ToolChain>> fSortedToolChains;
private static HashMap fSortedTools; private static HashMap fSortedTools;
private static HashMap fSortedBuilders; private static HashMap fSortedBuilders;
@ -333,11 +332,11 @@ public class ManagedBuildManager extends AbstractCExtension {
if (size > 0) { if (size > 0) {
int n = 0; int n = 0;
for (int i = 0; i < projectTypes.size(); ++i) for (int i = 0; i < projectTypes.size(); i++)
types[n++] = (IProjectType)projectTypes.get(i); types[n++] = projectTypes.get(i);
if (definedTypes != null) if (definedTypes != null)
for (int i = 0; i < definedTypes.size(); ++i) for (int i = 0; i < definedTypes.size(); i++)
types[n++] = definedTypes.get(i); types[n++] = definedTypes.get(i);
} }
@ -359,7 +358,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IProjectType)getExtensionProjectTypeMap().get(id); return getExtensionProjectTypeMap().get(id);
} }
public static Version getVersion(){ public static Version getVersion(){
@ -605,7 +604,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IProjectType) getExtensionProjectTypeMap().get(id); return getExtensionProjectTypeMap().get(id);
} }
/** /**
@ -693,7 +692,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (ITool) getExtensionToolMap().get(id); return getExtensionToolMap().get(id);
} }
/** /**
@ -1391,7 +1390,7 @@ public class ManagedBuildManager extends AbstractCExtension {
if (!status.isOK()) { if (!status.isOK()) {
if (status.getCode() == IResourceStatus.READ_ONLY_LOCAL) { if (status.getCode() == IResourceStatus.READ_ONLY_LOCAL) {
stream.close(); stream.close();
throw new IOException(ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_READ_ONLY, projectFile.getFullPath().toString())); //$NON-NLS-1$ throw new IOException(ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_READ_ONLY, projectFile.getFullPath().toString()));
} }
} }
} }
@ -1436,7 +1435,7 @@ public class ManagedBuildManager extends AbstractCExtension {
public void run() { public void run() {
MessageDialog.openError(shell, MessageDialog.openError(shell,
ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$ ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$
ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, //$NON-NLS-1$ ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED,
exceptionMsg)); exceptionMsg));
} }
} ); } );
@ -1462,6 +1461,7 @@ public class ManagedBuildManager extends AbstractCExtension {
//can not acquire the root rule //can not acquire the root rule
Job j = new Job("save build info job"){ //$NON-NLS-1$ Job j = new Job("save build info job"){ //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
try { try {
updateBuildInfo(project, force); updateBuildInfo(project, force);
@ -1660,8 +1660,8 @@ public class ManagedBuildManager extends AbstractCExtension {
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project); ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project);
boolean updated = false; boolean updated = false;
if(projDes != null){ if(projDes != null){
for(int i = 0; i < cfgs.length; i++){ for (IConfiguration cfg : cfgs) {
if(BuildSettingsUtil.applyConfiguration(cfgs[i], projDes, true)){ if(BuildSettingsUtil.applyConfiguration(cfg, projDes, true)){
updated = true; updated = true;
} }
} }
@ -1680,7 +1680,7 @@ public class ManagedBuildManager extends AbstractCExtension {
if(info != null){ if(info != null){
IConfiguration[] configs = info.getManagedProject().getConfigurations(); IConfiguration[] configs = info.getManagedProject().getConfigurations();
// Send an event to each configuration and if they exist, its resource configurations // Send an event to each configuration and if they exist, its resource configurations
for (int i=0; i < configs.length; ++i) { for (int i=0; i < configs.length; i++) {
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_CLOSE); ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_CLOSE);
} }
@ -2082,8 +2082,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IConfigurationElement[] elements = extension.getConfigurationElements(); IConfigurationElement[] elements = extension.getConfigurationElements();
// Find the version string in the manifest // Find the version string in the manifest
for (int index = 0; index < elements.length; ++index) { for (IConfigurationElement element : elements) {
IConfigurationElement element = elements[index];
if (element.getName().equals(REVISION_ELEMENT_NAME)) { if (element.getName().equals(REVISION_ELEMENT_NAME)) {
version = new PluginVersionIdentifier(element.getAttribute(VERSION_ELEMENT_NAME)); version = new PluginVersionIdentifier(element.getAttribute(VERSION_ELEMENT_NAME));
break; break;
@ -2215,8 +2214,8 @@ public class ManagedBuildManager extends AbstractCExtension {
IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations(); IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
// Send an event to each configuration and if they exist, its resource configurations // Send an event to each configuration and if they exist, its resource configurations
for (int i=0; i < configs.length; ++i) { for (IConfiguration cfg : configs) {
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_OPEN); ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_OPEN);
} }
// Finish up // Finish up
//project.setSessionProperty(buildInfoProperty, buildInfo); //project.setSessionProperty(buildInfoProperty, buildInfo);
@ -2272,8 +2271,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// First call the constructors of the internal classes that correspond to the // First call the constructors of the internal classes that correspond to the
// build model elements // build model elements
for (int i = 0; i < extensions.length; ++i) { for (IExtension extension : extensions) {
IExtension extension = extensions[i];
// Can we read this manifest // Can we read this manifest
if (!isVersionCompatible(extension)) { if (!isVersionCompatible(extension)) {
// The version of the Plug-in is greater than what the manager thinks it understands // The version of the Plug-in is greater than what the manager thinks it understands
@ -2305,9 +2303,7 @@ public class ManagedBuildManager extends AbstractCExtension {
String revision = null; String revision = null;
// Get the managedBuildRevsion of the extension. // Get the managedBuildRevsion of the extension.
for (int j = 0; j < elements.length; j++) { for (IConfigurationElement element : elements) {
IConfigurationElement element = elements[j];
if( element.getName().equals(REVISION_ELEMENT_NAME) ) { if( element.getName().equals(REVISION_ELEMENT_NAME) ) {
revision = element.getAttribute(VERSION_ELEMENT_NAME); revision = element.getAttribute(VERSION_ELEMENT_NAME);
break; break;
@ -2461,8 +2457,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// Call the constructors of the internal classes that correspond to the // Call the constructors of the internal classes that correspond to the
// V2.0 build model elements. Some of these objects are converted to new model objects. // V2.0 build model elements. Some of these objects are converted to new model objects.
// Others can use the same classes. // Others can use the same classes.
for (int i = 0; i < extensions.length; ++i) { for (IExtension extension : extensions) {
IExtension extension = extensions[i];
// Can we read this manifest // Can we read this manifest
if (!isVersionCompatible(extension)) { if (!isVersionCompatible(extension)) {
//The version of the Plug-in is greater than what the manager thinks it understands //The version of the Plug-in is greater than what the manager thinks it understands
@ -2471,8 +2466,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IConfigurationElement[] elements = extension.getConfigurationElements(); IConfigurationElement[] elements = extension.getConfigurationElements();
// Get the managedBuildRevsion of the extension. // Get the managedBuildRevsion of the extension.
for (int j = 0; j < elements.length; j++) { for (IConfigurationElement element : elements) {
IConfigurationElement element = elements[j];
if(element.getName().equals(REVISION_ELEMENT_NAME)) { if(element.getName().equals(REVISION_ELEMENT_NAME)) {
revision = element.getAttribute(VERSION_ELEMENT_NAME); revision = element.getAttribute(VERSION_ELEMENT_NAME);
break; break;
@ -2577,17 +2571,17 @@ public class ManagedBuildManager extends AbstractCExtension {
private static void performAdjustments(){ private static void performAdjustments(){
IProjectType types[] = getDefinedProjectTypes(); IProjectType types[] = getDefinedProjectTypes();
for(int i = 0; i < types.length; i++){ for (IProjectType type : types) {
IConfiguration cfgs[] = types[i].getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for(int j = 0; j < cfgs.length; j++){ for (IConfiguration cfg : cfgs) {
adjustConfig(cfgs[j]); adjustConfig(cfg);
} }
} }
for(int i = 0; i < types.length; i++){ for (IProjectType type : types) {
IConfiguration cfgs[] = types[i].getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for(int j = 0; j < cfgs.length; j++){ for (IConfiguration cfg : cfgs) {
performValueHandlerEvent(cfgs[j], IManagedOptionValueHandler.EVENT_LOAD); performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_LOAD);
} }
} }
@ -2595,21 +2589,21 @@ public class ManagedBuildManager extends AbstractCExtension {
private static void adjustConfig(IConfiguration cfg){ private static void adjustConfig(IConfiguration cfg){
IResourceInfo rcInfos[] = cfg.getResourceInfos(); IResourceInfo rcInfos[] = cfg.getResourceInfos();
for(int i = 0 ; i < rcInfos.length; i++){ for (IResourceInfo rcInfo : rcInfos) {
if(rcInfos[i] instanceof IFolderInfo){ if(rcInfo instanceof IFolderInfo){
IFolderInfo info = (IFolderInfo)rcInfos[i]; IFolderInfo info = (IFolderInfo)rcInfo;
IToolChain tc = info.getToolChain(); IToolChain tc = info.getToolChain();
adjustHolder(info, tc); adjustHolder(info, tc);
ITool tools[] = tc.getTools(); ITool tools[] = tc.getTools();
for(int j = 0; j < tools.length; j++){ for (ITool tool : tools) {
adjustHolder(info, tools[j]); adjustHolder(info, tool);
} }
} else if (rcInfos[i] instanceof IFileInfo){ } else if (rcInfo instanceof IFileInfo){
IFileInfo info = (IFileInfo)rcInfos[i]; IFileInfo info = (IFileInfo)rcInfo;
ITool rcTools[] = info.getTools(); ITool rcTools[] = info.getTools();
for(int j = 0; j < rcTools.length; j++){ for (ITool rcTool : rcTools) {
adjustHolder(info, rcTools[j]); adjustHolder(info, rcTool);
} }
} }
@ -2617,7 +2611,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IResourceConfiguration rcCfgs[] = cfg.getResourceConfigurations(); IResourceConfiguration rcCfgs[] = cfg.getResourceConfigurations();
for(int i = 0; i <rcCfgs.length; i++){ for (IResourceConfiguration rcCfg : rcCfgs) {
} }
} }
@ -2625,8 +2619,8 @@ public class ManagedBuildManager extends AbstractCExtension {
private static void adjustHolder(IResourceInfo rcInfo, IHoldsOptions holder){ private static void adjustHolder(IResourceInfo rcInfo, IHoldsOptions holder){
IOption options[] = holder.getOptions(); IOption options[] = holder.getOptions();
for(int i = 0; i < options.length; i++){ for (IOption opt : options) {
Option option = (Option)options[i]; Option option = (Option)opt;
BooleanExpressionApplicabilityCalculator calc = BooleanExpressionApplicabilityCalculator calc =
option.getBooleanExpressionCalculator(true); option.getBooleanExpressionCalculator(true);
@ -2637,9 +2631,8 @@ public class ManagedBuildManager extends AbstractCExtension {
private static void loadConfigElements(IManagedConfigElement[] elements, String revision) { private static void loadConfigElements(IManagedConfigElement[] elements, String revision) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { for (IManagedConfigElement element : elements) {
try { try {
IManagedConfigElement element = elements[toolIndex];
// Load the top level elements, which in turn load their children // Load the top level elements, which in turn load their children
if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) { if (element.getName().equals(IProjectType.PROJECTTYPE_ELEMENT_NAME)) {
new ProjectType(element, revision); new ProjectType(element, revision);
@ -2681,9 +2674,8 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
private static void loadConfigElementsV2(IManagedConfigElement[] elements, String revision) { private static void loadConfigElementsV2(IManagedConfigElement[] elements, String revision) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) { for (IManagedConfigElement element : elements) {
try { try {
IManagedConfigElement element = elements[toolIndex];
// Load the top level elements, which in turn load their children // Load the top level elements, which in turn load their children
if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) { if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
new Tool(element, revision); new Tool(element, revision);
@ -2979,7 +2971,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// Check if there is any build info associated with this project for this session // Check if there is any build info associated with this project for this session
try { try {
buildInfo = (ManagedBuildInfo)getLoadedBuildInfo(resource.getProject()); buildInfo = getLoadedBuildInfo(resource.getProject());
} catch (CoreException e) { } catch (CoreException e) {
// Continue, to see if any of the upcoming checks are successful // Continue, to see if any of the upcoming checks are successful
} }
@ -3178,9 +3170,7 @@ public class ManagedBuildManager extends AbstractCExtension {
if (extensions != null) { if (extensions != null) {
// Iterate over all extensions that contribute to .buildDefinitions // Iterate over all extensions that contribute to .buildDefinitions
for (int i = 0; i < extensions.length; ++i) { for (IExtension extension : extensions) {
IExtension extension = extensions[i];
// Determine whether the configuration element that is // Determine whether the configuration element that is
// associated with the path, is valid for the extension that // associated with the path, is valid for the extension that
// we are currently processing. // we are currently processing.
@ -3408,15 +3398,15 @@ public class ManagedBuildManager extends AbstractCExtension {
IOption[] options = toolChain.getOptions(); IOption[] options = toolChain.getOptions();
// Get global options directly under Toolchain (not associated with a particular tool) // Get global options directly under Toolchain (not associated with a particular tool)
// This has to be sent to all the Options associated with this configuration. // This has to be sent to all the Options associated with this configuration.
for (int i = 0; i < options.length; ++i) { for (IOption option : options) {
// Ignore invalid options // Ignore invalid options
if (options[i].isValid()) { if (option.isValid()) {
// Call the handler // Call the handler
if (options[i].getValueHandler().handleValue( if (option.getValueHandler().handleValue(
config, config,
toolChain, toolChain,
options[i], option,
options[i].getValueHandlerExtraArgument(), option.getValueHandlerExtraArgument(),
event)) { event)) {
// TODO : Event is handled successfully and returned true. // TODO : Event is handled successfully and returned true.
// May need to do something here say logging a message. // May need to do something here say logging a message.
@ -3428,17 +3418,17 @@ public class ManagedBuildManager extends AbstractCExtension {
// Get options associated with tools under toolChain // Get options associated with tools under toolChain
ITool[] tools = config.getFilteredTools(); ITool[] tools = config.getFilteredTools();
for (int i = 0; i < tools.length; ++i) { for (ITool tool : tools) {
IOption[] toolOptions = tools[i].getOptions(); IOption[] toolOptions = tool.getOptions();
for (int j = 0; j < toolOptions.length; ++j) { for (IOption toolOption : toolOptions) {
// Ignore invalid options // Ignore invalid options
if (toolOptions[j].isValid()) { if (toolOption.isValid()) {
// Call the handler // Call the handler
if (toolOptions[j].getValueHandler().handleValue( if (toolOption.getValueHandler().handleValue(
config, config,
tools[i], tool,
toolOptions[j], toolOption,
toolOptions[j].getValueHandlerExtraArgument(), toolOption.getValueHandlerExtraArgument(),
event)) { event)) {
// TODO : Event is handled successfully and returned true. // TODO : Event is handled successfully and returned true.
// May need to do something here say logging a message. // May need to do something here say logging a message.
@ -3452,8 +3442,8 @@ public class ManagedBuildManager extends AbstractCExtension {
// Call backs for Resource Configurations associated with this config. // Call backs for Resource Configurations associated with this config.
if (doChildren == true) { if (doChildren == true) {
IResourceConfiguration[] resConfigs = config.getResourceConfigurations(); IResourceConfiguration[] resConfigs = config.getResourceConfigurations();
for (int j=0; j < resConfigs.length; ++j) { for (IResourceConfiguration resConfig : resConfigs) {
ManagedBuildManager.performValueHandlerEvent(resConfigs[j], event); ManagedBuildManager.performValueHandlerEvent(resConfig, event);
} }
} }
} }
@ -3474,17 +3464,17 @@ public class ManagedBuildManager extends AbstractCExtension {
ITool[] tools = config instanceof IFileInfo ? ITool[] tools = config instanceof IFileInfo ?
((IFileInfo)config).getToolsToInvoke() : ((IFileInfo)config).getToolsToInvoke() :
((IFolderInfo)config).getFilteredTools(); ((IFolderInfo)config).getFilteredTools();
for (int i = 0; i < tools.length; ++i) { for (ITool tool : tools) {
IOption[] toolOptions = tools[i].getOptions(); IOption[] toolOptions = tool.getOptions();
for (int j = 0; j < toolOptions.length; ++j) { for (IOption toolOption : toolOptions) {
// Ignore invalid options // Ignore invalid options
if (toolOptions[j].isValid()) { if (toolOption.isValid()) {
// Call the handler // Call the handler
if (toolOptions[j].getValueHandler().handleValue( if (toolOption.getValueHandler().handleValue(
config, config,
tools[i], tool,
toolOptions[j], toolOption,
toolOptions[j].getValueHandlerExtraArgument(), toolOption.getValueHandlerExtraArgument(),
event)) { event)) {
// TODO : Event is handled successfully and returned true. // TODO : Event is handled successfully and returned true.
// May need to do something here say logging a message. // May need to do something here say logging a message.
@ -3526,8 +3516,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// other wise, walk through the hierarchy of the project and // other wise, walk through the hierarchy of the project and
// call the converters if available for each configuration // call the converters if available for each configuration
IConfiguration[] configs = managedProject.getConfigurations(); IConfiguration[] configs = managedProject.getConfigurations();
for (int i = 0; i < configs.length; i++) { for (IConfiguration configuration : configs) {
IConfiguration configuration = configs[i];
IToolChain toolChain = configuration.getToolChain(); IToolChain toolChain = configuration.getToolChain();
if (forCurrentMbsVersion) { if (forCurrentMbsVersion) {
@ -3550,8 +3539,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// If there are no converters for toolChain, walk through // If there are no converters for toolChain, walk through
// it's children // it's children
ITool[] tools = toolChain.getTools(); ITool[] tools = toolChain.getTools();
for (int j = 0; j < tools.length; j++) { for (ITool tool : tools) {
ITool tool = tools[j];
if (forCurrentMbsVersion) { if (forCurrentMbsVersion) {
element = ((Tool) tool) element = ((Tool) tool)
.getCurrentMbsVersionConversionElement(); .getCurrentMbsVersionConversionElement();
@ -3591,11 +3579,9 @@ public class ManagedBuildManager extends AbstractCExtension {
IResourceConfiguration[] resourceConfigs = configuration IResourceConfiguration[] resourceConfigs = configuration
.getResourceConfigurations(); .getResourceConfigurations();
if ((resourceConfigs != null) && (resourceConfigs.length > 0)) { if ((resourceConfigs != null) && (resourceConfigs.length > 0)) {
for (int j = 0; j < resourceConfigs.length; j++) { for (IResourceConfiguration resConfig : resourceConfigs) {
IResourceConfiguration resConfig = resourceConfigs[j];
ITool[] resTools = resConfig.getTools(); ITool[] resTools = resConfig.getTools();
for (int k = 0; k < resTools.length; k++) { for (ITool resTool : resTools) {
ITool resTool = resTools[k];
if (forCurrentMbsVersion) { if (forCurrentMbsVersion) {
element = ((Tool) resTool) element = ((Tool) resTool)
.getCurrentMbsVersionConversionElement(); .getCurrentMbsVersionConversionElement();
@ -3677,13 +3663,12 @@ public class ManagedBuildManager extends AbstractCExtension {
if (extensionPoint != null) { if (extensionPoint != null) {
// Get the extensions // Get the extensions
IExtension[] extensions = extensionPoint.getExtensions(); IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) { for (IExtension extension : extensions) {
// Get the configuration elements of each extension // Get the configuration elements of each extension
IConfigurationElement[] configElements = extensions[i] IConfigurationElement[] configElements = extension
.getConfigurationElements(); .getConfigurationElements();
for (int j = 0; j < configElements.length; j++) { for (IConfigurationElement element : configElements) {
IConfigurationElement element = configElements[j];
if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) { //$NON-NLS-1$ if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) { //$NON-NLS-1$
tmpToId = element.getAttribute("toId"); //$NON-NLS-1$ tmpToId = element.getAttribute("toId"); //$NON-NLS-1$
if (tmpToId.equals(toId)) { if (tmpToId.equals(toId)) {
@ -3713,13 +3698,10 @@ public class ManagedBuildManager extends AbstractCExtension {
if (extensionPoint != null) { if (extensionPoint != null) {
// Get the extensions // Get the extensions
IExtension[] extensions = extensionPoint.getExtensions(); IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) { for (IExtension extension : extensions) {
// Get the configuration elements of each extension // Get the configuration elements of each extension
IConfigurationElement[] configElements = extensions[i] IConfigurationElement[] configElements = extension.getConfigurationElements();
.getConfigurationElements(); for (IConfigurationElement element : configElements) {
for (int j = 0; j < configElements.length; j++) {
IConfigurationElement element = configElements[j];
if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) //$NON-NLS-1$ if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) //$NON-NLS-1$
return true; return true;
} }
@ -3743,15 +3725,12 @@ public class ManagedBuildManager extends AbstractCExtension {
if (extensionPoint != null) { if (extensionPoint != null) {
// Get the extensions // Get the extensions
IExtension[] extensions = extensionPoint.getExtensions(); IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) { for (IExtension extension : extensions) {
// Get the configuration elements of each extension // Get the configuration elements of each extension
IConfigurationElement[] configElements = extensions[i] IConfigurationElement[] configElements = extension.getConfigurationElements();
.getConfigurationElements(); for (IConfigurationElement element : configElements) {
for (int j = 0; j < configElements.length; j++) {
IConfigurationElement element = configElements[j];
if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) { //$NON-NLS-1$ if (element.getName().equals("converter") && (isBuildObjectApplicableForConversion(buildObj, element) == true)) { //$NON-NLS-1$
conversionTargets.put((String) element conversionTargets.put(element.getAttribute("name"), element); //$NON-NLS-1$
.getAttribute("name"), element); //$NON-NLS-1$
} }
} }
} }
@ -3920,18 +3899,18 @@ public class ManagedBuildManager extends AbstractCExtension {
public static int optionTypeToEntryKind(int type){ public static int optionTypeToEntryKind(int type){
switch(type){ switch(type){
case IOption.INCLUDE_PATH: case IOption.INCLUDE_PATH:
return ICLanguageSettingEntry.INCLUDE_PATH; return ICSettingEntry.INCLUDE_PATH;
case IOption.PREPROCESSOR_SYMBOLS: case IOption.PREPROCESSOR_SYMBOLS:
return ICLanguageSettingEntry.MACRO; return ICSettingEntry.MACRO;
case IOption.INCLUDE_FILES: case IOption.INCLUDE_FILES:
return ICLanguageSettingEntry.INCLUDE_FILE; return ICSettingEntry.INCLUDE_FILE;
case IOption.LIBRARY_PATHS: case IOption.LIBRARY_PATHS:
return ICLanguageSettingEntry.LIBRARY_PATH; return ICSettingEntry.LIBRARY_PATH;
case IOption.LIBRARIES: case IOption.LIBRARIES:
case IOption.LIBRARY_FILES: case IOption.LIBRARY_FILES:
return ICLanguageSettingEntry.LIBRARY_FILE; return ICSettingEntry.LIBRARY_FILE;
case IOption.MACRO_FILES: case IOption.MACRO_FILES:
return ICLanguageSettingEntry.MACRO_FILE; return ICSettingEntry.MACRO_FILE;
} }
return 0; return 0;
} }
@ -3944,34 +3923,34 @@ public class ManagedBuildManager extends AbstractCExtension {
public static int optionUndefTypeToEntryKind(int type){ public static int optionUndefTypeToEntryKind(int type){
switch(type){ switch(type){
case IOption.UNDEF_INCLUDE_PATH: case IOption.UNDEF_INCLUDE_PATH:
return ICLanguageSettingEntry.INCLUDE_PATH; return ICSettingEntry.INCLUDE_PATH;
case IOption.UNDEF_PREPROCESSOR_SYMBOLS: case IOption.UNDEF_PREPROCESSOR_SYMBOLS:
return ICLanguageSettingEntry.MACRO; return ICSettingEntry.MACRO;
case IOption.UNDEF_INCLUDE_FILES: case IOption.UNDEF_INCLUDE_FILES:
return ICLanguageSettingEntry.INCLUDE_FILE; return ICSettingEntry.INCLUDE_FILE;
case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_PATHS:
return ICLanguageSettingEntry.LIBRARY_PATH; return ICSettingEntry.LIBRARY_PATH;
case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_LIBRARY_FILES:
return ICLanguageSettingEntry.LIBRARY_FILE; return ICSettingEntry.LIBRARY_FILE;
case IOption.UNDEF_MACRO_FILES: case IOption.UNDEF_MACRO_FILES:
return ICLanguageSettingEntry.MACRO_FILE; return ICSettingEntry.MACRO_FILE;
} }
return 0; return 0;
} }
public static int entryKindToOptionType(int kind){ public static int entryKindToOptionType(int kind){
switch(kind){ switch(kind){
case ICLanguageSettingEntry.INCLUDE_PATH: case ICSettingEntry.INCLUDE_PATH:
return IOption.INCLUDE_PATH; return IOption.INCLUDE_PATH;
case ICLanguageSettingEntry.INCLUDE_FILE: case ICSettingEntry.INCLUDE_FILE:
return IOption.INCLUDE_FILES; return IOption.INCLUDE_FILES;
case ICLanguageSettingEntry.MACRO: case ICSettingEntry.MACRO:
return IOption.PREPROCESSOR_SYMBOLS; return IOption.PREPROCESSOR_SYMBOLS;
case ICLanguageSettingEntry.MACRO_FILE: case ICSettingEntry.MACRO_FILE:
return IOption.MACRO_FILES; return IOption.MACRO_FILES;
case ICLanguageSettingEntry.LIBRARY_PATH: case ICSettingEntry.LIBRARY_PATH:
return IOption.LIBRARY_PATHS;//TODO IOption.LIBRARIES; return IOption.LIBRARY_PATHS;//TODO IOption.LIBRARIES;
case ICLanguageSettingEntry.LIBRARY_FILE: case ICSettingEntry.LIBRARY_FILE:
return IOption.LIBRARY_FILES; return IOption.LIBRARY_FILES;
} }
return 0; return 0;
@ -3979,17 +3958,17 @@ public class ManagedBuildManager extends AbstractCExtension {
public static int entryKindToUndefOptionType(int kind){ public static int entryKindToUndefOptionType(int kind){
switch(kind){ switch(kind){
case ICLanguageSettingEntry.INCLUDE_PATH: case ICSettingEntry.INCLUDE_PATH:
return IOption.UNDEF_INCLUDE_PATH; return IOption.UNDEF_INCLUDE_PATH;
case ICLanguageSettingEntry.INCLUDE_FILE: case ICSettingEntry.INCLUDE_FILE:
return IOption.UNDEF_INCLUDE_FILES; return IOption.UNDEF_INCLUDE_FILES;
case ICLanguageSettingEntry.MACRO: case ICSettingEntry.MACRO:
return IOption.UNDEF_PREPROCESSOR_SYMBOLS; return IOption.UNDEF_PREPROCESSOR_SYMBOLS;
case ICLanguageSettingEntry.MACRO_FILE: case ICSettingEntry.MACRO_FILE:
return IOption.UNDEF_MACRO_FILES; return IOption.UNDEF_MACRO_FILES;
case ICLanguageSettingEntry.LIBRARY_PATH: case ICSettingEntry.LIBRARY_PATH:
return IOption.UNDEF_LIBRARY_PATHS;//TODO IOption.LIBRARIES; return IOption.UNDEF_LIBRARY_PATHS;//TODO IOption.LIBRARIES;
case ICLanguageSettingEntry.LIBRARY_FILE: case ICSettingEntry.LIBRARY_FILE:
return IOption.UNDEF_LIBRARY_FILES; return IOption.UNDEF_LIBRARY_FILES;
} }
return 0; return 0;
@ -4041,8 +4020,8 @@ public class ManagedBuildManager extends AbstractCExtension {
IContainer crs[] = ((IWorkspaceRoot)project.getParent()).findContainersForLocation(buildDirectory); IContainer crs[] = ((IWorkspaceRoot)project.getParent()).findContainersForLocation(buildDirectory);
if(crs.length != 0){ if(crs.length != 0){
String projName = project.getName(); String projName = project.getName();
for(int i = 0; i < crs.length; i++){ for (IContainer cr : crs) {
IPath path = crs[i].getFullPath(); IPath path = cr.getFullPath();
if(path.segmentCount() != 0 && path.segment(0).equals(projName)){ if(path.segmentCount() != 0 && path.segment(0).equals(projName)){
fullPath = path; fullPath = path;
break; break;
@ -4217,8 +4196,8 @@ public class ManagedBuildManager extends AbstractCExtension {
List result = new ArrayList(); List result = new ArrayList();
IConfiguration cfgs[] = type.getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for(int i = 0; i < cfgs.length; i++){ for (IConfiguration cfg : cfgs) {
IToolChain tc = cfgs[i].getToolChain(); IToolChain tc = cfg.getToolChain();
if(tc == null) if(tc == null)
continue; continue;
@ -4239,11 +4218,11 @@ public class ManagedBuildManager extends AbstractCExtension {
public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, IProjectType type){ public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, IProjectType type){
List list = new ArrayList(); List list = new ArrayList();
IConfiguration cfgs[] = type.getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for(int i = 0; i < cfgs.length; i++){ for (IConfiguration cfg : cfgs) {
IToolChain cur = cfgs[i].getToolChain(); IToolChain cur = cfg.getToolChain();
if(cur != null if(cur != null
&& findIdenticalElements((ToolChain)cur, fToolChainSorter) == findIdenticalElements((ToolChain)tChain, fToolChainSorter)){ && findIdenticalElements((ToolChain)cur, fToolChainSorter) == findIdenticalElements((ToolChain)tChain, fToolChainSorter)){
list.add(cfgs[i]); list.add(cfg);
} }
} }
return (IConfiguration[])list.toArray(new Configuration[list.size()]); return (IConfiguration[])list.toArray(new Configuration[list.size()]);
@ -4320,7 +4299,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
*/ */
private static HashMap getSortedToolChains(){ private static HashMap<String, List<ToolChain>> getSortedToolChains(){
if(fSortedToolChains == null){ if(fSortedToolChains == null){
fSortedToolChains = getSortedElements(ManagedBuildManager.getExtensionToolChainMap().values()); fSortedToolChains = getSortedElements(ManagedBuildManager.getExtensionToolChainMap().values());
} }
@ -4365,12 +4344,11 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
public static IToolChain[] getRealToolChains(){ public static IToolChain[] getRealToolChains(){
HashMap map = getSortedToolChains(); HashMap<String, List<ToolChain>> map = getSortedToolChains();
IToolChain tcs[] = new ToolChain[map.size()]; IToolChain tcs[] = new ToolChain[map.size()];
int i = 0; int i = 0;
for(Iterator iter = map.values().iterator(); iter.hasNext();){ for (List<ToolChain> list : map.values()) {
List list = (List)iter.next(); tcs[i++] = list.get(0);
tcs[i++] = (ToolChain)list.get(0);
} }
return tcs; return tcs;
} }
@ -4407,11 +4385,10 @@ public class ManagedBuildManager extends AbstractCExtension {
if(list.size() == 0){ if(list.size() == 0){
realBuilder = extBuilder; realBuilder = extBuilder;
} else { } else {
IBuilder[] realBs = getRealBuilders(); for (IBuilder realBldr : getRealBuilders()) {
for(int i = 0; i < realBs.length; i++){ List rList = findIdenticalElements((Builder)realBldr, fBuilderSorter);
List rList = findIdenticalElements((Builder)realBs[i], fBuilderSorter);
if(rList == list){ if(rList == list){
realBuilder = realBs[i]; realBuilder = realBldr;
break; break;
} }
} }
@ -4434,11 +4411,10 @@ public class ManagedBuildManager extends AbstractCExtension {
if(list.size() == 0){ if(list.size() == 0){
realTool = extTool; realTool = extTool;
} else { } else {
ITool[] realTs = getRealTools(); for (ITool realT : getRealTools()) {
for(int i = 0; i < realTs.length; i++){ List rList = findIdenticalElements((Tool)realT, fToolSorter);
List rList = findIdenticalElements((Tool)realTs[i], fToolSorter);
if(rList == list){ if(rList == list){
realTool = realTs[i]; realTool = realT;
break; break;
} }
} }
@ -4457,19 +4433,18 @@ public class ManagedBuildManager extends AbstractCExtension {
public static IToolChain getRealToolChain(IToolChain tc){ public static IToolChain getRealToolChain(IToolChain tc){
IToolChain extTc = tc; IToolChain extTc = tc;
IToolChain realTc = null; IToolChain realToolChain = null;
for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass()); for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass());
if(extTc != null){ if(extTc != null){
List list = findIdenticalElements((ToolChain)extTc, fToolChainSorter); List list = findIdenticalElements((ToolChain)extTc, fToolChainSorter);
if(list.size() == 0){ if(list.size() == 0){
realTc = extTc; realToolChain = extTc;
} else { } else {
IToolChain[] realTcs = getRealToolChains(); for (IToolChain realTc : getRealToolChains()) {
for(int i = 0; i < realTcs.length; i++){ List rList = findIdenticalElements((ToolChain)realTc, fToolChainSorter);
List rList = findIdenticalElements((ToolChain)realTcs[i], fToolChainSorter);
if(rList == list){ if(rList == list){
realTc = realTcs[i]; realToolChain = realTc;
break; break;
} }
} }
@ -4477,7 +4452,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} else { } else {
//TODO: //TODO:
} }
return realTc; return realToolChain;
} }
public static IToolChain[] findIdenticalToolChains(IToolChain tc){ public static IToolChain[] findIdenticalToolChains(IToolChain tc){
@ -4500,10 +4475,9 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
public static IToolChain[] getExtensionsToolChains(String propertyType, String propertyValue, boolean supportedPropsOnly){ public static IToolChain[] getExtensionsToolChains(String propertyType, String propertyValue, boolean supportedPropsOnly){
HashMap all = getSortedToolChains(); HashMap<String, List<ToolChain>> all = getSortedToolChains();
List result = new ArrayList(); List result = new ArrayList();
for(Iterator iter = all.values().iterator(); iter.hasNext();){ for (List<ToolChain> list : all.values()) {
List list = (List)iter.next();
IToolChain tc = findToolChain(list, propertyType, propertyValue, supportedPropsOnly); IToolChain tc = findToolChain(list, propertyType, propertyValue, supportedPropsOnly);
if(tc != null) if(tc != null)
result.add(tc); result.add(tc);
@ -4526,14 +4500,14 @@ public class ManagedBuildManager extends AbstractCExtension {
getSortedBuilders(); getSortedBuilders();
} }
private static IToolChain findToolChain(List list, String propertyType, String propertyValue, boolean supportedOnly){ private static IToolChain findToolChain(List<ToolChain> list, String propertyType, String propertyValue, boolean supportedOnly){
ToolChain bestMatch = null; ToolChain bestMatch = null;
IConfiguration cfg = null; IConfiguration cfg = null;
IProjectType type = null; IProjectType type = null;
boolean valueSupported = false; boolean valueSupported = false;
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){
ToolChain tc = (ToolChain)list.get(i); ToolChain tc = list.get(i);
if(tc.supportsValue(propertyType, propertyValue)){ if(tc.supportsValue(propertyType, propertyValue)){
valueSupported = true; valueSupported = true;
} else if (valueSupported){ } else if (valueSupported){
@ -4616,8 +4590,8 @@ public class ManagedBuildManager extends AbstractCExtension {
if(cfgDes != null){ if(cfgDes != null){
ICConfigurationDescription[] descs= CoreModelUtil.getReferencedConfigurationDescriptions(cfgDes, false); ICConfigurationDescription[] descs= CoreModelUtil.getReferencedConfigurationDescriptions(cfgDes, false);
List result = new ArrayList(); List result = new ArrayList();
for(int i=0; i<descs.length; i++) { for (ICConfigurationDescription desc : descs) {
IConfiguration cfg = getConfigurationForDescription(descs[i]); IConfiguration cfg = getConfigurationForDescription(desc);
if(cfg != null) { if(cfg != null) {
result.add(cfg); result.add(cfg);
} }
@ -4649,8 +4623,7 @@ public class ManagedBuildManager extends AbstractCExtension {
private static Map sortConfigs(IConfiguration cfgs[]){ private static Map sortConfigs(IConfiguration cfgs[]){
Map cfgMap = new HashMap(); Map cfgMap = new HashMap();
for(int i = 0; i < cfgs.length; i++){ for (IConfiguration cfg : cfgs) {
IConfiguration cfg = cfgs[i];
IProject proj = cfg.getOwner().getProject(); IProject proj = cfg.getOwner().getProject();
Set set = (Set)cfgMap.get(proj); Set set = (Set)cfgMap.get(proj);
if(set == null){ if(set == null){