1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 13:25:45 +02:00

cleanup: mostly generics, Javadoc warnings etc

This commit is contained in:
Andrew Gvozdev 2010-01-04 03:37:39 +00:00
parent a3665af421
commit 4fef3217d9
2 changed files with 183 additions and 199 deletions

View file

@ -51,8 +51,6 @@ import org.eclipse.cdt.core.AbstractCExtension;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.CoreModelUtil; import org.eclipse.cdt.core.model.CoreModelUtil;
import org.eclipse.cdt.core.model.ICProject;
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;
@ -202,29 +200,29 @@ public class ManagedBuildManager extends AbstractCExtension {
public static SortedMap<String, IProjectType> projectTypeMap; public static SortedMap<String, IProjectType> projectTypeMap;
private static List<IProjectType> projectTypes; private static List<IProjectType> projectTypes;
// Early configuration initialization extension elements // Early configuration initialization extension elements
private static List startUpConfigElements; private static List<IManagedConfigElement> startUpConfigElements;
// Configurations defined in the manifest files // Configurations defined in the manifest files
private static Map extensionConfigurationMap; private static Map<String, IConfiguration> extensionConfigurationMap;
// Resource configurations defined in the manifest files // Resource configurations defined in the manifest files
private static Map extensionResourceConfigurationMap; private static Map<String, IResourceConfiguration> extensionResourceConfigurationMap;
// Tool-chains defined in the manifest files // Tool-chains defined in the manifest files
private static SortedMap extensionToolChainMap; private static SortedMap<String, IToolChain> extensionToolChainMap;
// Tools defined in the manifest files // Tools defined in the manifest files
private static SortedMap<String, Tool> extensionToolMap; private static SortedMap<String, ITool> extensionToolMap;
// Target Platforms defined in the manifest files // Target Platforms defined in the manifest files
private static Map extensionTargetPlatformMap; private static Map<String, ITargetPlatform> extensionTargetPlatformMap;
// Builders defined in the manifest files // Builders defined in the manifest files
private static SortedMap extensionBuilderMap; private static SortedMap<String, IBuilder> extensionBuilderMap;
// Options defined in the manifest files // Options defined in the manifest files
private static Map extensionOptionMap; private static Map<String, IOption> extensionOptionMap;
// Option Categories defined in the manifest files // Option Categories defined in the manifest files
private static Map extensionOptionCategoryMap; private static Map<String, IOptionCategory> extensionOptionCategoryMap;
// Input types defined in the manifest files // Input types defined in the manifest files
private static Map extensionInputTypeMap; private static Map<String, IInputType> extensionInputTypeMap;
// Output types defined in the manifest files // Output types defined in the manifest files
private static Map extensionOutputTypeMap; private static Map<String, IOutputType> extensionOutputTypeMap;
// Targets defined in the manifest files (CDT V2.0 object model) // Targets defined in the manifest files (CDT V2.0 object model)
private static Map extensionTargetMap; private static Map<String, ITarget> extensionTargetMap;
// "Selected configuraton" elements defined in the manifest files. // "Selected configuraton" elements defined in the manifest files.
@ -238,22 +236,22 @@ public class ManagedBuildManager extends AbstractCExtension {
// reflects the content and structure of the extension section within the // reflects the content and structure of the extension section within the
// declaring plug-in's manifest (plugin.xml) file. // declaring plug-in's manifest (plugin.xml) file.
// This map has a lifecycle corresponding to the build definitions extension loading. // This map has a lifecycle corresponding to the build definitions extension loading.
private static Map configElementMap; private static Map<IBuildObject, IManagedConfigElement> configElementMap;
// private static List sortedToolChains; // private static List sortedToolChains;
// private static Map builtTypeToToolChainListMap; // private static Map builtTypeToToolChainListMap;
// Listeners interested in build model changes // Listeners interested in build model changes
private static Map buildModelListeners; private static Map<IResource, List<IScannerInfoChangeListener>> buildModelListeners;
// Random number for derived object model elements // Random number for derived object model elements
private static Random randomNumber; private static Random randomNumber;
// Environment Build Paths Change Listener // Environment Build Paths Change Listener
private static IEnvironmentBuildPathsChangeListener fEnvironmentBuildPathsChangeListener; private static IEnvironmentBuildPathsChangeListener fEnvironmentBuildPathsChangeListener;
private static HashMap<String, List<ToolChain>> fSortedToolChains; private static HashMap<String, List<IToolChain>> fSortedToolChains;
private static HashMap fSortedTools; private static HashMap<String, List<ITool>> fSortedTools;
private static HashMap fSortedBuilders; private static HashMap<String, List<IBuilder>> fSortedBuilders;
private static Map fInfoMap = new HashMap(); private static Map<IProject, IManagedBuildInfo> fInfoMap = new HashMap<IProject, IManagedBuildInfo>();
private static ISorter fToolChainSorter = new ISorter(){ private static ISorter fToolChainSorter = new ISorter(){
public void sort() { public void sort() {
@ -344,10 +342,8 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
/** /**
* Returns the project type with the passed in ID * @param id - id of the project type
* * @return the project type with the passed in ID
* @param String
* @return IProjectType
*/ */
public static IProjectType getProjectType(String id) { public static IProjectType getProjectType(String id) {
try { try {
@ -397,9 +393,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionConfigurationMap() { protected static Map<String, IConfiguration> getExtensionConfigurationMap() {
if (extensionConfigurationMap == null) { if (extensionConfigurationMap == null) {
extensionConfigurationMap = new HashMap(); extensionConfigurationMap = new HashMap<String, IConfiguration>();
} }
return extensionConfigurationMap; return extensionConfigurationMap;
} }
@ -409,9 +405,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionResourceConfigurationMap() { protected static Map<String, IResourceConfiguration> getExtensionResourceConfigurationMap() {
if (extensionResourceConfigurationMap == null) { if (extensionResourceConfigurationMap == null) {
extensionResourceConfigurationMap = new HashMap(); extensionResourceConfigurationMap = new HashMap<String, IResourceConfiguration>();
} }
return extensionResourceConfigurationMap; return extensionResourceConfigurationMap;
} }
@ -421,14 +417,14 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
public static SortedMap getExtensionToolChainMap() { public static SortedMap<String, IToolChain> getExtensionToolChainMap() {
try { try {
loadExtensions(); loadExtensions();
} catch (BuildException e) { } catch (BuildException e) {
} }
if (extensionToolChainMap == null) { if (extensionToolChainMap == null) {
extensionToolChainMap = new TreeMap(); extensionToolChainMap = new TreeMap<String, IToolChain>();
} }
return extensionToolChainMap; return extensionToolChainMap;
} }
@ -440,9 +436,9 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
if (extensionToolChainMap == null) { if (extensionToolChainMap == null) {
extensionToolChainMap = new TreeMap(); extensionToolChainMap = new TreeMap<String, IToolChain>();
} }
return (ToolChain[])extensionToolChainMap.values().toArray(new ToolChain[extensionToolChainMap.size()]); return extensionToolChainMap.values().toArray(new ToolChain[extensionToolChainMap.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -450,13 +446,13 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
public static SortedMap<String, Tool> getExtensionToolMap() { public static SortedMap<String, ITool> getExtensionToolMap() {
try { try {
loadExtensions(); loadExtensions();
} catch (BuildException e) { } catch (BuildException e) {
} }
if (extensionToolMap == null) { if (extensionToolMap == null) {
extensionToolMap = new TreeMap<String, Tool>(); extensionToolMap = new TreeMap<String, ITool>();
} }
return extensionToolMap; return extensionToolMap;
} }
@ -467,7 +463,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} catch (BuildException e) { } catch (BuildException e) {
} }
if (extensionToolMap == null) { if (extensionToolMap == null) {
extensionToolMap = new TreeMap<String, Tool>(); extensionToolMap = new TreeMap<String, ITool>();
} }
return extensionToolMap.values().toArray(new Tool[extensionToolMap.size()]); return extensionToolMap.values().toArray(new Tool[extensionToolMap.size()]);
} }
@ -477,9 +473,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionTargetPlatformMap() { protected static Map<String, ITargetPlatform> getExtensionTargetPlatformMap() {
if (extensionTargetPlatformMap == null) { if (extensionTargetPlatformMap == null) {
extensionTargetPlatformMap = new HashMap(); extensionTargetPlatformMap = new HashMap<String, ITargetPlatform>();
} }
return extensionTargetPlatformMap; return extensionTargetPlatformMap;
} }
@ -489,13 +485,13 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
public static SortedMap getExtensionBuilderMap() { public static SortedMap<String, IBuilder> getExtensionBuilderMap() {
try { try {
loadExtensions(); loadExtensions();
} catch (BuildException e) { } catch (BuildException e) {
} }
if (extensionBuilderMap == null) { if (extensionBuilderMap == null) {
extensionBuilderMap = new TreeMap(); extensionBuilderMap = new TreeMap<String, IBuilder>();
} }
return extensionBuilderMap; return extensionBuilderMap;
} }
@ -506,9 +502,9 @@ public class ManagedBuildManager extends AbstractCExtension {
} catch (BuildException e) { } catch (BuildException e) {
} }
if (extensionBuilderMap == null) { if (extensionBuilderMap == null) {
extensionBuilderMap = new TreeMap(); extensionBuilderMap = new TreeMap<String, IBuilder>();
} }
return (Builder[])extensionBuilderMap.values().toArray(new Builder[extensionBuilderMap.size()]); return extensionBuilderMap.values().toArray(new Builder[extensionBuilderMap.size()]);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -516,9 +512,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionOptionMap() { protected static Map<String, IOption> getExtensionOptionMap() {
if (extensionOptionMap == null) { if (extensionOptionMap == null) {
extensionOptionMap = new HashMap(); extensionOptionMap = new HashMap<String, IOption>();
} }
return extensionOptionMap; return extensionOptionMap;
} }
@ -528,9 +524,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionOptionCategoryMap() { protected static Map<String, IOptionCategory> getExtensionOptionCategoryMap() {
if (extensionOptionCategoryMap == null) { if (extensionOptionCategoryMap == null) {
extensionOptionCategoryMap = new HashMap(); extensionOptionCategoryMap = new HashMap<String, IOptionCategory>();
} }
return extensionOptionCategoryMap; return extensionOptionCategoryMap;
} }
@ -540,9 +536,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionInputTypeMap() { protected static Map<String, IInputType> getExtensionInputTypeMap() {
if (extensionInputTypeMap == null) { if (extensionInputTypeMap == null) {
extensionInputTypeMap = new HashMap(); extensionInputTypeMap = new HashMap<String, IInputType>();
} }
return extensionInputTypeMap; return extensionInputTypeMap;
} }
@ -552,9 +548,9 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionOutputTypeMap() { protected static Map<String, IOutputType> getExtensionOutputTypeMap() {
if (extensionOutputTypeMap == null) { if (extensionOutputTypeMap == null) {
extensionOutputTypeMap = new HashMap(); extensionOutputTypeMap = new HashMap<String, IOutputType>();
} }
return extensionOutputTypeMap; return extensionOutputTypeMap;
} }
@ -564,19 +560,17 @@ public class ManagedBuildManager extends AbstractCExtension {
* *
* @return Map * @return Map
*/ */
protected static Map getExtensionTargetMap() { protected static Map<String, ITarget> getExtensionTargetMap() {
if (extensionTargetMap == null) { if (extensionTargetMap == null) {
extensionTargetMap = new HashMap(); extensionTargetMap = new HashMap<String, ITarget>();
} }
return extensionTargetMap; return extensionTargetMap;
} }
/** /**
* Returns the targets owned by this project. If none are owned, * @param resource
* @return the targets owned by this resource. If none are owned,
* an empty array is returned. * an empty array is returned.
*
* @param project
* @return
*/ */
public static ITarget[] getTargets(IResource resource) { public static ITarget[] getTargets(IResource resource) {
IManagedBuildInfo buildInfo = getBuildInfo(resource); IManagedBuildInfo buildInfo = getBuildInfo(resource);
@ -623,7 +617,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IConfiguration) getExtensionConfigurationMap().get(id); return getExtensionConfigurationMap().get(id);
} }
public static IConfiguration[] getExtensionConfigurations() { public static IConfiguration[] getExtensionConfigurations() {
@ -635,7 +629,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IConfiguration[]) getExtensionConfigurationMap().values().toArray(new Configuration[getExtensionConfigurationMap().size()]); return getExtensionConfigurationMap().values().toArray(new Configuration[getExtensionConfigurationMap().size()]);
} }
/** /**
@ -654,7 +648,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IResourceConfiguration) getExtensionResourceConfigurationMap().get(id); return getExtensionResourceConfigurationMap().get(id);
} }
/** /**
@ -673,7 +667,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IToolChain) getExtensionToolChainMap().get(id); return getExtensionToolChainMap().get(id);
} }
/** /**
@ -711,7 +705,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (ITargetPlatform) getExtensionTargetPlatformMap().get(id); return getExtensionTargetPlatformMap().get(id);
} }
/** /**
@ -730,11 +724,13 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IBuilder) getExtensionBuilderMap().get(id); return getExtensionBuilderMap().get(id);
} }
public static IBuilder getExtensionBuilder(IBuilder builder) { public static IBuilder getExtensionBuilder(IBuilder builder) {
for(;builder != null && !builder.isExtensionElement(); builder = builder.getSuperClass()); for(;builder != null && !builder.isExtensionElement(); builder = builder.getSuperClass()) {
// empty loop to find parent builder
}
return builder; return builder;
} }
@ -755,7 +751,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IOption) getExtensionOptionMap().get(id); return getExtensionOptionMap().get(id);
} }
/** /**
@ -774,7 +770,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IInputType) getExtensionInputTypeMap().get(id); return getExtensionInputTypeMap().get(id);
} }
/** /**
@ -793,7 +789,7 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (IOutputType) getExtensionOutputTypeMap().get(id); return getExtensionOutputTypeMap().get(id);
} }
/** /**
@ -812,16 +808,15 @@ public class ManagedBuildManager extends AbstractCExtension {
e.printStackTrace(); e.printStackTrace();
} }
return (ITarget) getExtensionTargetMap().get(id); return getExtensionTargetMap().get(id);
} }
/** /**
* Answers the result of a best-effort search to find a target with the * @param resource to find the target
* specified ID, or <code>null</code> if one is not found. * @param id - ID of the target
* *
* @param resource * @return the result of a best-effort search to find a target with the
* @param id * specified ID, or {@code null} if one is not found.
* @return
*/ */
public static ITarget getTarget(IResource resource, String id) { public static ITarget getTarget(IResource resource, String id) {
ITarget target = null; ITarget target = null;
@ -833,7 +828,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
// OK, check the extension map // OK, check the extension map
if (target == null) { if (target == null) {
target = (ITarget)getExtensionTargetMap().get(id); target = getExtensionTargetMap().get(id);
} }
return target; return target;
} }
@ -861,7 +856,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* property pages are displayed * property pages are displayed
* *
* @param project * @param project
* @param target * @param config
*/ */
public static void setSelectedConfiguration(IProject project, IConfiguration config) { public static void setSelectedConfiguration(IProject project, IConfiguration config) {
if (project == null) { if (project == null) {
@ -874,10 +869,6 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
} }
/**
* @param targetId
* @return
*/
public static IManagedBuilderMakefileGenerator getBuildfileGenerator(IConfiguration config) { public static IManagedBuilderMakefileGenerator getBuildfileGenerator(IConfiguration config) {
IToolChain toolChain = config.getToolChain(); IToolChain toolChain = config.getToolChain();
if(toolChain != null){ if(toolChain != null){
@ -891,7 +882,7 @@ public class ManagedBuildManager extends AbstractCExtension {
/** /**
* load tool provider defined or default (if not found) command line generator special for selected tool * load tool provider defined or default (if not found) command line generator special for selected tool
* @param toolId - id selected id * @param toolId - id selected tool ID
* @return IManagedCommandLineGenerator * @return IManagedCommandLineGenerator
*/ */
public static IManagedCommandLineGenerator getCommandLineGenerator(IConfiguration config, String toolId) { public static IManagedCommandLineGenerator getCommandLineGenerator(IConfiguration config, String toolId) {
@ -907,7 +898,6 @@ public class ManagedBuildManager extends AbstractCExtension {
* how to discover built-in compiler defines and includes search paths. * how to discover built-in compiler defines and includes search paths.
* Find the profile for the target specified. * Find the profile for the target specified.
* *
* @param string the unique id of the target to search for
* @return scanner configuration discovery profile id * @return scanner configuration discovery profile id
*/ */
public static String getScannerInfoProfileId(IConfiguration config) { public static String getScannerInfoProfileId(IConfiguration config) {
@ -1033,13 +1023,13 @@ public class ManagedBuildManager extends AbstractCExtension {
// Figure out if there is a listener for this change // Figure out if there is a listener for this change
IResource resource = resConfig.getParent().getOwner(); IResource resource = resConfig.getParent().getOwner();
List listeners = (List) getBuildModelListeners().get(resource); List<IScannerInfoChangeListener> listeners = getBuildModelListeners().get(resource);
if (listeners == null) { if (listeners == null) {
return; return;
} }
ListIterator iter = listeners.listIterator(); ListIterator<IScannerInfoChangeListener> iter = listeners.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
((IScannerInfoChangeListener)iter.next()).changeNotification(resource, (IScannerInfo)getBuildInfo(resource)); iter.next().changeNotification(resource, (IScannerInfo)getBuildInfo(resource));
} }
} }
@ -1738,9 +1728,7 @@ public class ManagedBuildManager extends AbstractCExtension {
IConfiguration[] cfs = (IConfiguration[])mc.getItems(); IConfiguration[] cfs = (IConfiguration[])mc.getItems();
cfg = (Configuration)cfs[0]; cfg = (Configuration)cfs[0];
} }
if(cfg.isExtensionElement() || cfg.isPreference()) if(!(cfg==null || cfg.isExtensionElement() || cfg.isPreference()))
project = null;
else
project = cfg.getOwner().getProject(); project = cfg.getOwner().getProject();
if (rcInfo instanceof MultiResourceInfo) { if (rcInfo instanceof MultiResourceInfo) {
@ -1771,7 +1759,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
projectTypes.add(projectType); projectTypes.add(projectType);
Object previous = getExtensionProjectTypeMap().put(projectType.getId(), projectType); IProjectType previous = getExtensionProjectTypeMap().put(projectType.getId(), projectType);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1788,7 +1776,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param configuration * @param configuration
*/ */
public static void addExtensionConfiguration(Configuration configuration) { public static void addExtensionConfiguration(Configuration configuration) {
Object previous = getExtensionConfigurationMap().put(configuration.getId(), configuration); IConfiguration previous = getExtensionConfigurationMap().put(configuration.getId(), configuration);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1805,7 +1793,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param resourceConfiguration * @param resourceConfiguration
*/ */
public static void addExtensionResourceConfiguration(ResourceConfiguration resourceConfiguration) { public static void addExtensionResourceConfiguration(ResourceConfiguration resourceConfiguration) {
Object previous = getExtensionResourceConfigurationMap().put(resourceConfiguration.getId(), resourceConfiguration); IResourceConfiguration previous = getExtensionResourceConfigurationMap().put(resourceConfiguration.getId(), resourceConfiguration);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1822,7 +1810,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param toolChain * @param toolChain
*/ */
public static void addExtensionToolChain(ToolChain toolChain) { public static void addExtensionToolChain(ToolChain toolChain) {
Object previous = getExtensionToolChainMap().put(toolChain.getId(), toolChain); IToolChain previous = getExtensionToolChainMap().put(toolChain.getId(), toolChain);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1841,7 +1829,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param tool * @param tool
*/ */
public static void addExtensionTool(Tool tool) { public static void addExtensionTool(Tool tool) {
Object previous = getExtensionToolMap().put(tool.getId(), tool); ITool previous = getExtensionToolMap().put(tool.getId(), tool);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1858,7 +1846,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param targetPlatform * @param targetPlatform
*/ */
public static void addExtensionTargetPlatform(TargetPlatform targetPlatform) { public static void addExtensionTargetPlatform(TargetPlatform targetPlatform) {
Object previous = getExtensionTargetPlatformMap().put(targetPlatform.getId(), targetPlatform); ITargetPlatform previous = getExtensionTargetPlatformMap().put(targetPlatform.getId(), targetPlatform);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1875,7 +1863,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param Builder * @param Builder
*/ */
public static void addExtensionBuilder(Builder builder) { public static void addExtensionBuilder(Builder builder) {
Object previous = getExtensionBuilderMap().put(builder.getId(), builder); IBuilder previous = getExtensionBuilderMap().put(builder.getId(), builder);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1892,7 +1880,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param option * @param option
*/ */
public static void addExtensionOption(Option option) { public static void addExtensionOption(Option option) {
Object previous = getExtensionOptionMap().put(option.getId(), option); IOption previous = getExtensionOptionMap().put(option.getId(), option);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1909,7 +1897,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param optionCategory * @param optionCategory
*/ */
public static void addExtensionOptionCategory(OptionCategory optionCategory) { public static void addExtensionOptionCategory(OptionCategory optionCategory) {
Object previous = getExtensionOptionCategoryMap().put(optionCategory.getId(), optionCategory); IOptionCategory previous = getExtensionOptionCategoryMap().put(optionCategory.getId(), optionCategory);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1926,7 +1914,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param inputType * @param inputType
*/ */
public static void addExtensionInputType(InputType inputType) { public static void addExtensionInputType(InputType inputType) {
Object previous = getExtensionInputTypeMap().put(inputType.getId(), inputType); IInputType previous = getExtensionInputTypeMap().put(inputType.getId(), inputType);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1943,7 +1931,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* @param outputType * @param outputType
*/ */
public static void addExtensionOutputType(OutputType outputType) { public static void addExtensionOutputType(OutputType outputType) {
Object previous = getExtensionOutputTypeMap().put(outputType.getId(), outputType); IOutputType previous = getExtensionOutputTypeMap().put(outputType.getId(), outputType);
if (previous != null) { if (previous != null) {
// Report error // Report error
ManagedBuildManager.outputDuplicateIdError( ManagedBuildManager.outputDuplicateIdError(
@ -1967,7 +1955,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* Creates a new project instance for the resource based on the parent project type. * Creates a new project instance for the resource based on the parent project type.
* *
* @param resource * @param resource
* @param parentTarget * @param parent - parent project type
* @return new <code>ITarget</code> with settings based on the parent passed in the arguments * @return new <code>ITarget</code> with settings based on the parent passed in the arguments
* @throws BuildException * @throws BuildException
*/ */
@ -2010,10 +1998,6 @@ public class ManagedBuildManager extends AbstractCExtension {
return new Target(resource, parentTarget); return new Target(resource, parentTarget);
} }
/**
* @param resource
* @return
*/
public static IStatus initBuildInfoContainer(IResource resource) { public static IStatus initBuildInfoContainer(IResource resource) {
return Status.OK_STATUS; return Status.OK_STATUS;
/* /*
@ -2038,41 +2022,41 @@ public class ManagedBuildManager extends AbstractCExtension {
*/ */
} }
/* (non-Javadoc) // /**
* Private helper method to intialize the path entry container once and // * Private helper method to initialize the path entry container once and
* only once when the build info is first loaded or created. // * only once when the build info is first loaded or created.
* // *
* @param info // * @param info
* @throws CoreException // * @throws CoreException
*/ // */
private static void initBuildInfoContainer(ManagedBuildInfo info) throws CoreException { // private static void initBuildInfoContainer(ManagedBuildInfo info) throws CoreException {
if (info == null) { // if (info == null) {
throw new CoreException(new Status(IStatus.ERROR, // throw new CoreException(new Status(IStatus.ERROR,
ManagedBuilderCorePlugin.getUniqueIdentifier(), // ManagedBuilderCorePlugin.getUniqueIdentifier(),
IStatus.ERROR, // IStatus.ERROR,
new String(), // new String(),
null)); // null));
} // }
//
if (info.isContainerInited()) return; // if (info.isContainerInited()) return;
// Now associate the path entry container with the project // // Now associate the path entry container with the project
ICProject cProject = info.getCProject(); // ICProject cProject = info.getCProject();
//
synchronized (cProject) { // synchronized (cProject) {
//
// This does not block the workspace or trigger delta events // // This does not block the workspace or trigger delta events
IPathEntry[] entries = cProject.getRawPathEntries(); // IPathEntry[] entries = cProject.getRawPathEntries();
// Make sure the container for this project is in the path entries // // Make sure the container for this project is in the path entries
List newEntries = new ArrayList(Arrays.asList(entries)); // List newEntries = new ArrayList(Arrays.asList(entries));
if (!newEntries.contains(ManagedBuildInfo.containerEntry)) { // if (!newEntries.contains(ManagedBuildInfo.containerEntry)) {
// In this case we should trigger an init and deltas // // In this case we should trigger an init and deltas
newEntries.add(ManagedBuildInfo.containerEntry); // newEntries.add(ManagedBuildInfo.containerEntry);
cProject.setRawPathEntries((IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]), new NullProgressMonitor()); // cProject.setRawPathEntries((IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]), new NullProgressMonitor());
} // }
info.setContainerInited(true); // info.setContainerInited(true);
//
} // end synchronized // } // end synchronized
} // }
private static boolean isVersionCompatible(IExtension extension) { private static boolean isVersionCompatible(IExtension extension) {
// We can ignore the qualifier // We can ignore the qualifier
@ -2262,7 +2246,7 @@ public class ManagedBuildManager extends AbstractCExtension {
try { try {
//The list of the IManagedBuildDefinitionsStartup callbacks //The list of the IManagedBuildDefinitionsStartup callbacks
List buildDefStartupList = null; List<IManagedBuildDefinitionsStartup> buildDefStartupList = null;
// Get the extensions that use the current CDT managed build model // Get the extensions that use the current CDT managed build model
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
if( extensionPoint != null) { if( extensionPoint != null) {
@ -2318,12 +2302,12 @@ public class ManagedBuildManager extends AbstractCExtension {
// Call the start up config extensions. These may rely on the standard elements // Call the start up config extensions. These may rely on the standard elements
// having already been loaded so we wait to call them from here. // having already been loaded so we wait to call them from here.
if (startUpConfigElements != null) { if (startUpConfigElements != null) {
buildDefStartupList = new ArrayList(startUpConfigElements.size()); buildDefStartupList = new ArrayList<IManagedBuildDefinitionsStartup>(startUpConfigElements.size());
for (Iterator iter = startUpConfigElements.iterator(); iter.hasNext();) { for (IManagedConfigElement startUpConfigElement : startUpConfigElements) {
IManagedBuildDefinitionsStartup customConfigLoader; IManagedBuildDefinitionsStartup customConfigLoader;
try { try {
customConfigLoader = createStartUpConfigLoader((DefaultManagedConfigElement)iter.next()); customConfigLoader = createStartUpConfigLoader((DefaultManagedConfigElement)startUpConfigElement);
//need to save the startup for the future notifications //need to save the startup for the future notifications
buildDefStartupList.add(customConfigLoader); buildDefStartupList.add(customConfigLoader);
@ -2331,7 +2315,8 @@ public class ManagedBuildManager extends AbstractCExtension {
// Now we can perform any actions on the build configurations // Now we can perform any actions on the build configurations
// in an extended plugin before the build configurations have been resolved // in an extended plugin before the build configurations have been resolved
customConfigLoader.buildDefsLoaded(); customConfigLoader.buildDefsLoaded();
} catch (CoreException e) {} } catch (CoreException e) {
}
} }
} }
@ -2660,7 +2645,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// Cache up early configuration extension elements so was can call them after // Cache up early configuration extension elements so was can call them after
// other configuration elements have loaded. // other configuration elements have loaded.
if (startUpConfigElements == null) if (startUpConfigElements == null)
startUpConfigElements = new ArrayList(); startUpConfigElements = new ArrayList<IManagedConfigElement>();
startUpConfigElements.add(element); startUpConfigElements.add(element);
} }
} else { } else {
@ -2775,10 +2760,6 @@ public class ManagedBuildManager extends AbstractCExtension {
return (IManagedBuildDefinitionsStartup)element.getConfigurationElement().createExecutableExtension(IManagedBuildDefinitionsStartup.CLASS_ATTRIBUTE); return (IManagedBuildDefinitionsStartup)element.getConfigurationElement().createExecutableExtension(IManagedBuildDefinitionsStartup.CLASS_ATTRIBUTE);
} }
/**
* @param project
* @return
*/
public static boolean manages(IResource resource) { public static boolean manages(IResource resource) {
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(resource.getProject(), false); ICProjectDescription des = CoreModel.getDefault().getProjectDescription(resource.getProject(), false);
if(des == null){ if(des == null){
@ -2839,11 +2820,9 @@ public class ManagedBuildManager extends AbstractCExtension {
ManagedBuildInfo buildInfo = null; ManagedBuildInfo buildInfo = null;
IProject proj = rc.getProject(); IProject proj = rc.getProject();
if(buildInfo == null){
if(BuildDbgUtil.DEBUG) if(BuildDbgUtil.DEBUG)
BuildDbgUtil.getInstance().traceln(BuildDbgUtil.BUILD_INFO_LOAD, "build info load: info is null, querying the update mngr"); //$NON-NLS-1$ BuildDbgUtil.getInstance().traceln(BuildDbgUtil.BUILD_INFO_LOAD, "build info load: info is null, querying the update mngr"); //$NON-NLS-1$
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(proj); buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(proj);
}
if(buildInfo != null) if(buildInfo != null)
return buildInfo; return buildInfo;
@ -3079,8 +3058,6 @@ public class ManagedBuildManager extends AbstractCExtension {
* Calling this method is the same as calling getBuildInfo(IResource resource, boolean forceLoad) * Calling this method is the same as calling getBuildInfo(IResource resource, boolean forceLoad)
* with the "forceLoad" argument set to true * with the "forceLoad" argument set to true
* *
*
* @see ManagedBuildManager#initBuildInfo(IResource)
* @param resource The resource to search for managed build information on. * @param resource The resource to search for managed build information on.
* @return IManagedBuildInfo The build information object for the resource. * @return IManagedBuildInfo The build information object for the resource.
*/ */
@ -3125,7 +3102,6 @@ public class ManagedBuildManager extends AbstractCExtension {
* loads the build info from the .cdtbuild file * loads the build info from the .cdtbuild file
* In case "forceLoad" is false, does not load the build info and returns null in case it is not loadded * In case "forceLoad" is false, does not load the build info and returns null in case it is not loadded
* *
* @see ManagedBuildManager#initBuildInfo(IResource)
* @param resource The resource to search for managed build information on. * @param resource The resource to search for managed build information on.
* @param forceLoad specifies whether the build info should be loadded in case it is not loadded currently. * @param forceLoad specifies whether the build info should be loadded in case it is not loadded currently.
* @return IManagedBuildInfo The build information object for the resource. * @return IManagedBuildInfo The build information object for the resource.
@ -3138,7 +3114,6 @@ public class ManagedBuildManager extends AbstractCExtension {
* Determines if the managed build information for the * Determines if the managed build information for the
* argument can be found. * argument can be found.
* *
* @see ManagedBuildManager#initBuildInfo(IResource)
* @param resource The resource to search for managed build information on. * @param resource The resource to search for managed build information on.
* @return boolean True if the build info can be found; false otherwise. * @return boolean True if the build info can be found; false otherwise.
*/ */
@ -3207,19 +3182,19 @@ public class ManagedBuildManager extends AbstractCExtension {
/* /*
* @return * @return
*/ */
private static Map getBuildModelListeners() { private static Map<IResource, List<IScannerInfoChangeListener>> getBuildModelListeners() {
if (buildModelListeners == null) { if (buildModelListeners == null) {
buildModelListeners = new HashMap(); buildModelListeners = new HashMap<IResource, List<IScannerInfoChangeListener>>();
} }
return buildModelListeners; return buildModelListeners;
} }
private static Map getConfigElementMap() { private static Map<IBuildObject, IManagedConfigElement> getConfigElementMap() {
if(!projectTypesLoading) if(!projectTypesLoading)
throw new IllegalStateException(); throw new IllegalStateException();
if (configElementMap == null) { if (configElementMap == null) {
configElementMap = new HashMap(); configElementMap = new HashMap<IBuildObject, IManagedConfigElement>();
} }
return configElementMap; return configElementMap;
} }
@ -3245,7 +3220,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* by clients. * by clients.
*/ */
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) { public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
return (IManagedConfigElement)getConfigElementMap().get(buildObj); return getConfigElementMap().get(buildObj);
} }
public static void optionValidError(int errorId, String id) { public static void optionValidError(int errorId, String id) {
@ -3370,7 +3345,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* Send event to value handlers of relevant configuration including * Send event to value handlers of relevant configuration including
* all its child resource configurations, if they exist. * all its child resource configurations, if they exist.
* *
* @param IConfiguration configuration for which to send the event * @param config configuration for which to send the event
* @param event to be sent * @param event to be sent
* *
* @since 3.0 * @since 3.0
@ -3382,7 +3357,7 @@ public class ManagedBuildManager extends AbstractCExtension {
/** /**
* Send event to value handlers of relevant configuration. * Send event to value handlers of relevant configuration.
* *
* @param IConfiguration configuration for which to send the event * @param config configuration for which to send the event
* @param event to be sent * @param event to be sent
* @param doChildren - if true, also perform the event for all * @param doChildren - if true, also perform the event for all
* resource configurations that are children if this configuration. * resource configurations that are children if this configuration.
@ -3451,7 +3426,7 @@ public class ManagedBuildManager extends AbstractCExtension {
/** /**
* Send event to value handlers of relevant configuration. * Send event to value handlers of relevant configuration.
* *
* @param IResourceConfiguration configuration for which to send the event * @param config configuration for which to send the event
* @param event to be sent * @param event to be sent
* *
* @since 3.0 * @since 3.0
@ -3821,7 +3796,7 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
/** /**
* Calculate a relative path given the full path to a folder and a file * @return calculated relative path given the full path to a folder and a file
*/ */
public static IPath calculateRelativePath(IPath container, IPath contents){ public static IPath calculateRelativePath(IPath container, IPath contents){
IPath path = contents; IPath path = contents;
@ -4193,7 +4168,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// } // }
public static IToolChain[] getExtensionToolChains(IProjectType type){ public static IToolChain[] getExtensionToolChains(IProjectType type){
List result = new ArrayList(); List<IToolChain> result = new ArrayList<IToolChain>();
IConfiguration cfgs[] = type.getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for (IConfiguration cfg : cfgs) { for (IConfiguration cfg : cfgs) {
@ -4212,11 +4187,11 @@ public class ManagedBuildManager extends AbstractCExtension {
result.add(tc); result.add(tc);
} }
} }
return (IToolChain[])result.toArray(new IToolChain[result.size()]); return result.toArray(new IToolChain[result.size()]);
} }
public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, IProjectType type){ public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, IProjectType type){
List list = new ArrayList(); List<IConfiguration> list = new ArrayList<IConfiguration>();
IConfiguration cfgs[] = type.getConfigurations(); IConfiguration cfgs[] = type.getConfigurations();
for (IConfiguration cfg : cfgs) { for (IConfiguration cfg : cfgs) {
IToolChain cur = cfg.getToolChain(); IToolChain cur = cfg.getToolChain();
@ -4225,7 +4200,7 @@ public class ManagedBuildManager extends AbstractCExtension {
list.add(cfg); list.add(cfg);
} }
} }
return (IConfiguration[])list.toArray(new Configuration[list.size()]); return list.toArray(new Configuration[list.size()]);
} }
public static IConfiguration getFirstExtensionConfiguration(IToolChain tChain){ public static IConfiguration getFirstExtensionConfiguration(IToolChain tChain){
@ -4247,7 +4222,7 @@ public class ManagedBuildManager extends AbstractCExtension {
public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, String propertyType, String propertyValue){ public static IConfiguration[] getExtensionConfigurations(IToolChain tChain, String propertyType, String propertyValue){
// List all = getSortedToolChains(); // List all = getSortedToolChains();
List list = findIdenticalElements((ToolChain)tChain, fToolChainSorter); List list = findIdenticalElements((ToolChain)tChain, fToolChainSorter);
LinkedHashSet result = new LinkedHashSet(); LinkedHashSet<IConfiguration> result = new LinkedHashSet<IConfiguration>();
boolean tcFound = false; boolean tcFound = false;
if(list != null){ if(list != null){
for(int i = 0; i < list.size(); i++){ for(int i = 0; i < list.size(); i++){
@ -4285,7 +4260,7 @@ public class ManagedBuildManager extends AbstractCExtension {
// } // }
// } // }
// } // }
return (IConfiguration[])result.toArray(new IConfiguration[result.size()]); return result.toArray(new IConfiguration[result.size()]);
} }
/* public static IToolChain[] getRealToolChains(){ /* public static IToolChain[] getRealToolChains(){
@ -4299,21 +4274,21 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
*/ */
private static HashMap<String, List<ToolChain>> getSortedToolChains(){ private static HashMap<String, List<IToolChain>> getSortedToolChains(){
if(fSortedToolChains == null){ if(fSortedToolChains == null){
fSortedToolChains = getSortedElements(ManagedBuildManager.getExtensionToolChainMap().values()); fSortedToolChains = getSortedElements(ManagedBuildManager.getExtensionToolChainMap().values());
} }
return fSortedToolChains; return fSortedToolChains;
} }
private static HashMap getSortedTools(){ private static HashMap<String, List<ITool>> getSortedTools(){
if(fSortedTools == null){ if(fSortedTools == null){
fSortedTools = getSortedElements(ManagedBuildManager.getExtensionToolMap().values()); fSortedTools = getSortedElements(ManagedBuildManager.getExtensionToolMap().values());
} }
return fSortedTools; return fSortedTools;
} }
private static HashMap getSortedBuilders(){ private static HashMap<String, List<IBuilder>> getSortedBuilders(){
if(fSortedBuilders == null){ if(fSortedBuilders == null){
fSortedBuilders = getSortedElements(ManagedBuildManager.getExtensionBuilderMap().values()); fSortedBuilders = getSortedElements(ManagedBuildManager.getExtensionBuilderMap().values());
} }
@ -4344,33 +4319,31 @@ public class ManagedBuildManager extends AbstractCExtension {
} }
public static IToolChain[] getRealToolChains(){ public static IToolChain[] getRealToolChains(){
HashMap<String, List<ToolChain>> map = getSortedToolChains(); HashMap<String, List<IToolChain>> map = getSortedToolChains();
IToolChain tcs[] = new ToolChain[map.size()]; IToolChain tcs[] = new ToolChain[map.size()];
int i = 0; int i = 0;
for (List<ToolChain> list : map.values()) { for (List<IToolChain> list : map.values()) {
tcs[i++] = list.get(0); tcs[i++] = list.get(0);
} }
return tcs; return tcs;
} }
public static ITool[] getRealTools(){ public static ITool[] getRealTools(){
HashMap map = getSortedTools(); HashMap<String, List<ITool>> map = getSortedTools();
Tool ts[] = new Tool[map.size()]; Tool ts[] = new Tool[map.size()];
int i = 0; int i = 0;
for(Iterator iter = map.values().iterator(); iter.hasNext();){ for (List<ITool> list : map.values()) {
List list = (List)iter.next();
ts[i++] = (Tool)list.get(0); ts[i++] = (Tool)list.get(0);
} }
return ts; return ts;
} }
public static IBuilder[] getRealBuilders(){ public static IBuilder[] getRealBuilders(){
HashMap map = getSortedBuilders(); HashMap<String, List<IBuilder>> map = getSortedBuilders();
IBuilder bs[] = new Builder[map.size()]; IBuilder bs[] = new Builder[map.size()];
int i = 0; int i = 0;
for(Iterator iter = map.values().iterator(); iter.hasNext();){ for (List<IBuilder> list : map.values()) {
List list = (List)iter.next(); bs[i++] = list.get(0);
bs[i++] = (Builder)list.get(0);
} }
return bs; return bs;
} }
@ -4378,7 +4351,9 @@ public class ManagedBuildManager extends AbstractCExtension {
public static IBuilder getRealBuilder(IBuilder builder){ public static IBuilder getRealBuilder(IBuilder builder){
IBuilder extBuilder = builder; IBuilder extBuilder = builder;
IBuilder realBuilder = null; IBuilder realBuilder = null;
for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass()); for(;extBuilder != null && !extBuilder.isExtensionElement(); extBuilder = extBuilder.getSuperClass()) {
// empty body
}
if(extBuilder != null){ if(extBuilder != null){
List list = findIdenticalElements((Builder)extBuilder, fBuilderSorter); List list = findIdenticalElements((Builder)extBuilder, fBuilderSorter);
@ -4404,7 +4379,9 @@ public class ManagedBuildManager extends AbstractCExtension {
return null; return null;
ITool extTool = tool; ITool extTool = tool;
ITool realTool = null; ITool realTool = null;
for(;extTool != null && !extTool.isExtensionElement(); extTool= extTool.getSuperClass()); for(;extTool != null && !extTool.isExtensionElement(); extTool= extTool.getSuperClass()) {
// empty body
}
if(extTool != null){ if(extTool != null){
List list = findIdenticalElements((Tool)extTool, fToolSorter); List list = findIdenticalElements((Tool)extTool, fToolSorter);
@ -4427,14 +4404,18 @@ public class ManagedBuildManager extends AbstractCExtension {
public static IToolChain getExtensionToolChain(IToolChain tc){ public static IToolChain getExtensionToolChain(IToolChain tc){
IToolChain extTc = tc; IToolChain extTc = tc;
for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass()); for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass()) {
// empty body
}
return extTc; return extTc;
} }
public static IToolChain getRealToolChain(IToolChain tc){ public static IToolChain getRealToolChain(IToolChain tc){
IToolChain extTc = tc; IToolChain extTc = tc;
IToolChain realToolChain = null; IToolChain realToolChain = null;
for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass()); for(;extTc != null && !extTc.isExtensionElement(); extTc= extTc.getSuperClass()) {
// empty body
}
if(extTc != null){ if(extTc != null){
List list = findIdenticalElements((ToolChain)extTc, fToolChainSorter); List list = findIdenticalElements((ToolChain)extTc, fToolChainSorter);
@ -4475,14 +4456,14 @@ 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<String, List<ToolChain>> all = getSortedToolChains(); HashMap<String, List<IToolChain>> all = getSortedToolChains();
List result = new ArrayList(); List<IToolChain> result = new ArrayList<IToolChain>();
for (List<ToolChain> list : all.values()) { for (List<IToolChain> list : all.values()) {
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);
} }
return (IToolChain[])result.toArray(new ToolChain[result.size()]); return result.toArray(new ToolChain[result.size()]);
} }
public static void resortToolChains(){ public static void resortToolChains(){
@ -4500,14 +4481,14 @@ public class ManagedBuildManager extends AbstractCExtension {
getSortedBuilders(); getSortedBuilders();
} }
private static IToolChain findToolChain(List<ToolChain> list, String propertyType, String propertyValue, boolean supportedOnly){ private static IToolChain findToolChain(List<IToolChain> 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 = list.get(i); ToolChain tc = (ToolChain)list.get(i);
if(tc.supportsValue(propertyType, propertyValue)){ if(tc.supportsValue(propertyType, propertyValue)){
valueSupported = true; valueSupported = true;
} else if (valueSupported){ } else if (valueSupported){
@ -4582,7 +4563,7 @@ public class ManagedBuildManager extends AbstractCExtension {
* Returns the configurations referenced by this configuration. * Returns the configurations referenced by this configuration.
* Returns an empty array if there are no referenced configurations. * Returns an empty array if there are no referenced configurations.
* *
* @see CoreModelUtil.getReferencedConfigurations() * @see CoreModelUtil#getReferencedConfigurationDescriptions(ICConfigurationDescription, boolean)
* @return an array of IConfiguration objects referenced by this IConfiguration * @return an array of IConfiguration objects referenced by this IConfiguration
*/ */
public static IConfiguration[] getReferencedConfigurations(IConfiguration config){ public static IConfiguration[] getReferencedConfigurations(IConfiguration config){

View file

@ -349,10 +349,12 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
} }
/** /**
* Create a <code>Tool</code> based upon an existing tool. * Create a {@link Tool} based upon an existing tool.
* *
* @param parent The <code>IToolChain</code> or <code>IResourceConfiguration</code> * @param parent The {@link IToolChain} or {@link IResourceConfiguration}
* the tool will be added to. * the tool will be added to.
* @param Id The new Tool ID
* @param name The new Tool name
* @param tool The existing tool to clone. * @param tool The existing tool to clone.
*/ */
public Tool(IBuildObject parent, ITool toolSuperClass, String Id, String name, Tool tool){ public Tool(IBuildObject parent, ITool toolSuperClass, String Id, String name, Tool tool){
@ -971,7 +973,6 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
/** /**
* Persist the tool to the project file. * Persist the tool to the project file.
* *
* @param doc
* @param element * @param element
*/ */
@Override @Override
@ -3067,7 +3068,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
String high = ManagedBuildManager.getExtensionToolMap() String high = ManagedBuildManager.getExtensionToolMap()
.lastKey(); .lastKey();
SortedMap<String, Tool> subMap = null; SortedMap<String, ITool> subMap = null;
if (superClassId.compareTo(high) <= 0) { if (superClassId.compareTo(high) <= 0) {
subMap = ManagedBuildManager.getExtensionToolMap().subMap( subMap = ManagedBuildManager.getExtensionToolMap().subMap(
superClassId, high + "\0"); //$NON-NLS-1$ superClassId, high + "\0"); //$NON-NLS-1$
@ -3505,7 +3506,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
return base; return base;
IOutputType extType = base; IOutputType extType = base;
for(;extType != null && !extType.isExtensionElement();extType = extType.getSuperClass()); for(;extType != null && !extType.isExtensionElement();extType = extType.getSuperClass()){
// empty body - loop to find extension
}
String id; String id;
if(extType != null){ if(extType != null){
id = ManagedBuildManager.calculateChildId(extType.getId(), null); id = ManagedBuildManager.calculateChildId(extType.getId(), null);