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