mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-09 19:43:27 +02:00
1. Add conversion support to projects
2. Change newly added getToolBySuperClassId to getToolsBySuperClassId 3. Fix use of getTools to getFilteredTools in optionCategory.
This commit is contained in:
parent
403a805175
commit
e2ab8aa66b
9 changed files with 285 additions and 100 deletions
|
@ -224,17 +224,17 @@ public interface IConfiguration extends IBuildObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>ITool</code> in this configuration's tool-chain with
|
* Returns the <code>ITool</code> in this configuration's tool-chain with
|
||||||
* the specified ID, or a tool with a superclass with this id.
|
* the specified ID, or the tool(s) with a superclass with this id.
|
||||||
*
|
*
|
||||||
* <p>If the tool-chain does not have a tool with that ID, the method
|
* <p>If the tool-chain does not have a tool with that ID, the method
|
||||||
* returns <code>null</code>. It is the responsibility of the caller to
|
* returns an empty array. It is the responsibility of the caller to
|
||||||
* verify the return value.
|
* verify the return value.
|
||||||
*
|
*
|
||||||
* @param id unique identifier of the tool to search for
|
* @param id unique identifier of the tool to search for
|
||||||
* @return <code>ITool</code>
|
* @return <code>ITool[]</code>
|
||||||
* @since 3.0.2
|
* @since 3.0.2
|
||||||
*/
|
*/
|
||||||
public ITool getToolBySuperClassId(String id);
|
public ITool[] getToolsBySuperClassId(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>IToolChain</code> child of this configuration.
|
* Returns the <code>IToolChain</code> child of this configuration.
|
||||||
|
|
|
@ -47,6 +47,7 @@ public interface IProjectType extends IBuildObject {
|
||||||
public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
|
public static final String IS_ABSTRACT = "isAbstract"; //$NON-NLS-1$
|
||||||
public static final String UNUSED_CHILDREN = "unusedChildren"; //$NON-NLS-1$
|
public static final String UNUSED_CHILDREN = "unusedChildren"; //$NON-NLS-1$
|
||||||
public static final String IS_TEST = "isTest"; //$NON-NLS-1$
|
public static final String IS_TEST = "isTest"; //$NON-NLS-1$
|
||||||
|
public static final String CONVERT_TO_ID = "convertToId"; //$NON-NLS-1$
|
||||||
public static final String CONFIGURATION_NAME_PROVIDER = "configurationNameProvider"; //$NON-NLS-1$
|
public static final String CONFIGURATION_NAME_PROVIDER = "configurationNameProvider"; //$NON-NLS-1$
|
||||||
public static final String PROJECT_ENVIRONMENT_SUPPLIER = "projectEnvironmentSupplier"; //$NON-NLS-1$
|
public static final String PROJECT_ENVIRONMENT_SUPPLIER = "projectEnvironmentSupplier"; //$NON-NLS-1$
|
||||||
public static final String PROJECT_MACRO_SUPPLIER = "projectMacroSupplier"; //$NON-NLS-1$
|
public static final String PROJECT_MACRO_SUPPLIER = "projectMacroSupplier"; //$NON-NLS-1$
|
||||||
|
@ -164,4 +165,26 @@ public interface IProjectType extends IBuildObject {
|
||||||
* @return IProjectBuildMacroSupplier
|
* @return IProjectBuildMacroSupplier
|
||||||
*/
|
*/
|
||||||
public IProjectBuildMacroSupplier getBuildMacroSupplier();
|
public IProjectBuildMacroSupplier getBuildMacroSupplier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the 'convertToId' of this project type.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getConvertToId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the 'convertToId' attribute of the project type.
|
||||||
|
*
|
||||||
|
* @param convertToId
|
||||||
|
*/
|
||||||
|
public void setConvertToId(String convertToId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check for migration support.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean checkForMigrationSupport();
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,17 +163,17 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>ITool</code> in the tool-chain with the specified
|
* Returns the <code>ITool</code> in the tool-chain with the specified
|
||||||
* ID, or a tool with a superclass with this id.
|
* ID, or the tool(s) with a superclass with this id.
|
||||||
*
|
*
|
||||||
* <p>If the tool-chain does not have a tool with that ID, the method
|
* <p>If the tool-chain does not have a tool with that ID, the method
|
||||||
* returns <code>null</code>. It is the responsibility of the caller to
|
* returns an empty array. It is the responsibility of the caller to
|
||||||
* verify the return value.
|
* verify the return value.
|
||||||
*
|
*
|
||||||
* @param id unique identifier of the tool to search for
|
* @param id unique identifier of the tool to search for
|
||||||
* @return <code>ITool</code>
|
* @return <code>ITool[]</code>
|
||||||
* @since 3.0.2
|
* @since 3.0.2
|
||||||
*/
|
*/
|
||||||
public ITool getToolBySuperClassId(String id);
|
public ITool[] getToolsBySuperClassId(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>IToolChain</code> that is the superclass of this
|
* Returns the <code>IToolChain</code> that is the superclass of this
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
private static Map depCalculatorsMap;
|
private static Map depCalculatorsMap;
|
||||||
private static boolean projectTypesLoaded = false;
|
private static boolean projectTypesLoaded = false;
|
||||||
// Project types defined in the manifest files
|
// Project types defined in the manifest files
|
||||||
private static Map projectTypeMap;
|
public static SortedMap projectTypeMap;
|
||||||
private static List projectTypes;
|
private static List projectTypes;
|
||||||
// Configurations defined in the manifest files
|
// Configurations defined in the manifest files
|
||||||
private static Map extensionConfigurationMap;
|
private static Map extensionConfigurationMap;
|
||||||
|
@ -279,9 +279,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
*
|
*
|
||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
protected static Map getExtensionProjectTypeMap() {
|
public static SortedMap getExtensionProjectTypeMap() {
|
||||||
if (projectTypeMap == null) {
|
if (projectTypeMap == null) {
|
||||||
projectTypeMap = new HashMap();
|
projectTypeMap = new TreeMap();
|
||||||
}
|
}
|
||||||
return projectTypeMap;
|
return projectTypeMap;
|
||||||
}
|
}
|
||||||
|
@ -2669,87 +2669,120 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
// Get the managed project from buildInfo
|
// Get the managed project from buildInfo
|
||||||
IManagedProject managedProject = buildInfo.getManagedProject();
|
IManagedProject managedProject = buildInfo.getManagedProject();
|
||||||
|
|
||||||
// walk through the hierarchy of the project and
|
IProjectType projectType = managedProject.getProjectType();
|
||||||
// call the converters if available for each configuration
|
if (forCurrentMbsVersion) {
|
||||||
IConfiguration[] configs = managedProject.getConfigurations();
|
element = ((ProjectType) projectType)
|
||||||
for (int i = 0; i < configs.length; i++) {
|
.getCurrentMbsVersionConversionElement();
|
||||||
IConfiguration configuration = configs[i];
|
} else {
|
||||||
IToolChain toolChain = configuration.getToolChain();
|
element = ((ProjectType) projectType)
|
||||||
|
.getPreviousMbsVersionConversionElement();
|
||||||
|
}
|
||||||
|
|
||||||
if (forCurrentMbsVersion) {
|
if (element != null) {
|
||||||
element = ((ToolChain)toolChain).getCurrentMbsVersionConversionElement();
|
// If there is a converter element for projectType, invoke it.
|
||||||
} else {
|
// projectType converter should take care of invoking converters of
|
||||||
element = ((ToolChain)toolChain).getPreviousMbsVersionConversionElement();
|
// it's children
|
||||||
|
|
||||||
|
if (invokeConverter(managedProject, element) == null) {
|
||||||
|
buildInfo.getManagedProject().setValid(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 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];
|
||||||
|
IToolChain toolChain = configuration.getToolChain();
|
||||||
|
|
||||||
if (element != null) {
|
if (forCurrentMbsVersion) {
|
||||||
// If there is a converter element for toolChain, invoke it
|
element = ((ToolChain) toolChain)
|
||||||
// toolChain converter should take care of invoking converters of it's children
|
.getCurrentMbsVersionConversionElement();
|
||||||
if ( invokeConverter(toolChain, element) == null ) {
|
} else {
|
||||||
buildInfo.getManagedProject().setValid(false);
|
element = ((ToolChain) toolChain)
|
||||||
return false;
|
.getPreviousMbsVersionConversionElement();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// 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];
|
|
||||||
if (forCurrentMbsVersion) {
|
|
||||||
element = ((Tool)tool).getCurrentMbsVersionConversionElement();
|
|
||||||
} else {
|
|
||||||
element = ((Tool)tool).getPreviousMbsVersionConversionElement();
|
|
||||||
}
|
|
||||||
if (element != null) {
|
|
||||||
if ( invokeConverter(tool, element) == null ) {
|
|
||||||
buildInfo.getManagedProject().setValid(false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IBuilder builder = toolChain.getBuilder();
|
|
||||||
if (builder != null) {
|
|
||||||
if (forCurrentMbsVersion) {
|
|
||||||
element = ((Builder)builder).getCurrentMbsVersionConversionElement();
|
|
||||||
} else {
|
|
||||||
element = ((Builder)builder).getPreviousMbsVersionConversionElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if ( invokeConverter(builder, element) == null ) {
|
// If there is a converter element for toolChain, invoke it
|
||||||
buildInfo.getManagedProject().setValid(false);
|
// toolChain converter should take care of invoking
|
||||||
return false;
|
// converters of it's children
|
||||||
}
|
if (invokeConverter(toolChain, element) == null) {
|
||||||
|
buildInfo.getManagedProject().setValid(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
// If there are no converters for toolChain, walk through
|
||||||
|
// it's children
|
||||||
// walk through each resource configuration and look if there are any converters
|
ITool[] tools = toolChain.getTools();
|
||||||
// available. If so, invoke them.
|
for (int j = 0; j < tools.length; j++) {
|
||||||
IResourceConfiguration [] resourceConfigs = configuration.getResourceConfigurations();
|
ITool tool = tools[j];
|
||||||
if ( ( resourceConfigs != null) && ( resourceConfigs.length > 0)) {
|
|
||||||
for (int j = 0; j < resourceConfigs.length; j++) {
|
|
||||||
IResourceConfiguration resConfig = resourceConfigs[j];
|
|
||||||
ITool [] resTools = resConfig.getTools();
|
|
||||||
for (int k = 0; k < resTools.length; k++) {
|
|
||||||
ITool resTool = resTools[k];
|
|
||||||
if (forCurrentMbsVersion) {
|
if (forCurrentMbsVersion) {
|
||||||
element = ((Tool)resTool).getCurrentMbsVersionConversionElement();
|
element = ((Tool) tool)
|
||||||
|
.getCurrentMbsVersionConversionElement();
|
||||||
} else {
|
} else {
|
||||||
element = ((Tool)resTool).getPreviousMbsVersionConversionElement();
|
element = ((Tool) tool)
|
||||||
|
.getPreviousMbsVersionConversionElement();
|
||||||
}
|
}
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if ( invokeConverter(resTool, element) == null ) {
|
if (invokeConverter(tool, element) == null) {
|
||||||
|
buildInfo.getManagedProject().setValid(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IBuilder builder = toolChain.getBuilder();
|
||||||
|
if (builder != null) {
|
||||||
|
if (forCurrentMbsVersion) {
|
||||||
|
element = ((Builder) builder)
|
||||||
|
.getCurrentMbsVersionConversionElement();
|
||||||
|
} else {
|
||||||
|
element = ((Builder) builder)
|
||||||
|
.getPreviousMbsVersionConversionElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element != null) {
|
||||||
|
if (invokeConverter(builder, element) == null) {
|
||||||
buildInfo.getManagedProject().setValid(false);
|
buildInfo.getManagedProject().setValid(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end of if
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// walk through each resource configuration and look if there
|
||||||
|
// are any converters
|
||||||
|
// available. If so, invoke them.
|
||||||
|
IResourceConfiguration[] resourceConfigs = configuration
|
||||||
|
.getResourceConfigurations();
|
||||||
|
if ((resourceConfigs != null) && (resourceConfigs.length > 0)) {
|
||||||
|
for (int j = 0; j < resourceConfigs.length; j++) {
|
||||||
|
IResourceConfiguration resConfig = resourceConfigs[j];
|
||||||
|
ITool[] resTools = resConfig.getTools();
|
||||||
|
for (int k = 0; k < resTools.length; k++) {
|
||||||
|
ITool resTool = resTools[k];
|
||||||
|
if (forCurrentMbsVersion) {
|
||||||
|
element = ((Tool) resTool)
|
||||||
|
.getCurrentMbsVersionConversionElement();
|
||||||
|
} else {
|
||||||
|
element = ((Tool) resTool)
|
||||||
|
.getPreviousMbsVersionConversionElement();
|
||||||
|
}
|
||||||
|
if (element != null) {
|
||||||
|
if (invokeConverter(resTool, element) == null) {
|
||||||
|
buildInfo.getManagedProject().setValid(
|
||||||
|
false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end of if
|
||||||
|
}
|
||||||
|
}
|
||||||
// If control comes here, it means either there is no converter element
|
// If control comes here, it means either there is no converter element
|
||||||
// or converters are invoked successfully
|
// or converters are invoked successfully
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -661,10 +661,10 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolBySuperClassId(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolsBySuperClassId(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ITool getToolBySuperClassId(String id) {
|
public ITool[] getToolsBySuperClassId(String id) {
|
||||||
return toolChain.getToolBySuperClassId(id);
|
return toolChain.getToolsBySuperClassId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -110,6 +110,13 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
|
|
||||||
// Initialize from the XML attributes
|
// Initialize from the XML attributes
|
||||||
if (loadFromProject(element)) {
|
if (loadFromProject(element)) {
|
||||||
|
|
||||||
|
// check for migration support.
|
||||||
|
boolean isSupportAvailable = projectType.checkForMigrationSupport();
|
||||||
|
if (isSupportAvailable == false) {
|
||||||
|
setValid(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Load children
|
// Load children
|
||||||
NodeList configElements = element.getChildNodes();
|
NodeList configElements = element.getChildNodes();
|
||||||
for (int i = 0; i < configElements.getLength(); ++i) {
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
|
|
|
@ -234,7 +234,7 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
if (configuration != null) {
|
if (configuration != null) {
|
||||||
IHoldsOptions optionHolder = getOptionHolder();
|
IHoldsOptions optionHolder = getOptionHolder();
|
||||||
if (optionHolder instanceof ITool) {
|
if (optionHolder instanceof ITool) {
|
||||||
optionHolders = configuration.getTools();
|
optionHolders = configuration.getFilteredTools();
|
||||||
} else if (optionHolder instanceof IToolChain) {
|
} else if (optionHolder instanceof IToolChain) {
|
||||||
// Get the toolchain of this configuration, which is
|
// Get the toolchain of this configuration, which is
|
||||||
// the holder equivalent for this option
|
// the holder equivalent for this option
|
||||||
|
|
|
@ -26,12 +26,16 @@ import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
|
import org.eclipse.cdt.managedbuilder.macros.IProjectBuildMacroSupplier;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
|
|
||||||
|
|
||||||
public class ProjectType extends BuildObject implements IProjectType {
|
public class ProjectType extends BuildObject implements IProjectType {
|
||||||
|
|
||||||
private static final String EMPTY_STRING = new String();
|
private static final String EMPTY_STRING = new String();
|
||||||
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
|
//private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
|
||||||
|
|
||||||
// Superclass
|
// Superclass
|
||||||
private IProjectType superClass;
|
private IProjectType superClass;
|
||||||
|
@ -43,6 +47,7 @@ public class ProjectType extends BuildObject implements IProjectType {
|
||||||
private Boolean isAbstract;
|
private Boolean isAbstract;
|
||||||
private Boolean isTest;
|
private Boolean isTest;
|
||||||
private String unusedChildren;
|
private String unusedChildren;
|
||||||
|
private String convertToId;
|
||||||
|
|
||||||
private IConfigurationElement configurationNameProviderElement = null;
|
private IConfigurationElement configurationNameProviderElement = null;
|
||||||
private IConfigurationNameProvider configurationNameProvider = null;
|
private IConfigurationNameProvider configurationNameProvider = null;
|
||||||
|
@ -54,6 +59,8 @@ public class ProjectType extends BuildObject implements IProjectType {
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean resolved = true;
|
private boolean resolved = true;
|
||||||
|
private IConfigurationElement previousMbsVersionConversionElement;
|
||||||
|
private IConfigurationElement currentMbsVersionConversionElement;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C O N S T R U C T O R S
|
* C O N S T R U C T O R S
|
||||||
|
@ -181,6 +188,8 @@ public class ProjectType extends BuildObject implements IProjectType {
|
||||||
buildMacroSupplierElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
buildMacroSupplierElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the 'convertToId' attribute if it is available
|
||||||
|
convertToId = element.getAttribute(CONVERT_TO_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -522,4 +531,117 @@ public class ProjectType extends BuildObject implements IProjectType {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getConvertToId() {
|
||||||
|
if (convertToId == null) {
|
||||||
|
// If I have a superClass, ask it
|
||||||
|
if (getSuperClass() != null) {
|
||||||
|
return getSuperClass().getConvertToId();
|
||||||
|
} else {
|
||||||
|
return EMPTY_STRING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return convertToId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setConvertToId(String convertToId) {
|
||||||
|
if (convertToId == null && this.convertToId == null) return;
|
||||||
|
if (convertToId == null || this.convertToId == null || !convertToId.equals(this.convertToId)) {
|
||||||
|
this.convertToId = convertToId;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function checks for migration support for the projectType while
|
||||||
|
* loading the project. If migration support is needed, looks for the available
|
||||||
|
* converters and adds them to the list.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean checkForMigrationSupport() {
|
||||||
|
|
||||||
|
String convertToId = getConvertToId();
|
||||||
|
if ((convertToId == null) || (convertToId.equals(""))) { //$NON-NLS-1$
|
||||||
|
// It means there is no 'convertToId' attribute available and
|
||||||
|
// the project type is still actively
|
||||||
|
// supported by the tool integrator. So do nothing, just return
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// In case the 'convertToId' attribute is available,
|
||||||
|
// it means that Tool integrator currently does not support this
|
||||||
|
// project type.
|
||||||
|
// Look for the converters available for this project type.
|
||||||
|
|
||||||
|
return getConverter(convertToId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getConverter(String convertToId) {
|
||||||
|
|
||||||
|
String fromId = null;
|
||||||
|
String toId = null;
|
||||||
|
|
||||||
|
// Get the Converter Extension Point
|
||||||
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
|
||||||
|
.getExtensionPoint("org.eclipse.cdt.managedbuilder.core", //$NON-NLS-1$
|
||||||
|
"projectConverter"); //$NON-NLS-1$
|
||||||
|
if (extensionPoint != null) {
|
||||||
|
// Get the extensions
|
||||||
|
IExtension[] extensions = extensionPoint.getExtensions();
|
||||||
|
for (int i = 0; i < extensions.length; i++) {
|
||||||
|
// Get the configuration elements of each extension
|
||||||
|
IConfigurationElement[] configElements = extensions[i]
|
||||||
|
.getConfigurationElements();
|
||||||
|
for (int j = 0; j < configElements.length; j++) {
|
||||||
|
|
||||||
|
IConfigurationElement element = configElements[j];
|
||||||
|
|
||||||
|
if (element.getName().equals("converter")) { //$NON-NLS-1$
|
||||||
|
|
||||||
|
fromId = element.getAttribute("fromId"); //$NON-NLS-1$
|
||||||
|
toId = element.getAttribute("toId"); //$NON-NLS-1$
|
||||||
|
// Check whether the current converter can be used for
|
||||||
|
// the selected project type
|
||||||
|
|
||||||
|
if (fromId.equals(getId())
|
||||||
|
&& toId.equals(convertToId)) {
|
||||||
|
// If it matches
|
||||||
|
String mbsVersion = element
|
||||||
|
.getAttribute("mbsVersion"); //$NON-NLS-1$
|
||||||
|
PluginVersionIdentifier currentMbsVersion = ManagedBuildManager
|
||||||
|
.getBuildInfoVersion();
|
||||||
|
|
||||||
|
// set the converter element based on the MbsVersion
|
||||||
|
if (currentMbsVersion
|
||||||
|
.isGreaterThan(new PluginVersionIdentifier(
|
||||||
|
mbsVersion))) {
|
||||||
|
previousMbsVersionConversionElement = element;
|
||||||
|
} else {
|
||||||
|
currentMbsVersionConversionElement = element;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If control comes here, it means 'Tool Integrator' specified
|
||||||
|
// 'convertToId' attribute in toolchain definition file, but
|
||||||
|
// has not provided any converter. So, make the project is invalid
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IConfigurationElement getPreviousMbsVersionConversionElement() {
|
||||||
|
return previousMbsVersionConversionElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfigurationElement getCurrentMbsVersionConversionElement() {
|
||||||
|
return currentMbsVersionConversionElement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
|
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOutputType;
|
import org.eclipse.cdt.managedbuilder.core.IOutputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||||
|
@ -823,25 +822,26 @@ public class ToolChain extends HoldsOptions implements IToolChain {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getToolBySuperClassId(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getToolsBySuperClassId(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ITool getToolBySuperClassId(String id) {
|
public ITool[] getToolsBySuperClassId(String id) {
|
||||||
if (id == null) return null;
|
List retTools = new ArrayList();
|
||||||
|
if (id != null) {
|
||||||
// Look for a tool with this ID, or a tool with a superclass with this id
|
// Look for a tool with this ID, or the tool(s) with a superclass with this id
|
||||||
ITool[] tools = getTools();
|
ITool[] tools = getTools();
|
||||||
for (int i = 0; i < tools.length; i++) {
|
for (int i = 0; i < tools.length; i++) {
|
||||||
ITool targetTool = tools[i];
|
ITool targetTool = tools[i];
|
||||||
ITool tool = targetTool;
|
ITool tool = targetTool;
|
||||||
do {
|
do {
|
||||||
if (id.equals(tool.getId())) {
|
if (id.equals(tool.getId())) {
|
||||||
return targetTool;
|
retTools.add(targetTool);
|
||||||
}
|
break;
|
||||||
tool = tool.getSuperClass();
|
}
|
||||||
} while (tool != null);
|
tool = tool.getSuperClass();
|
||||||
|
} while (tool != null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return (ITool[])retTools.toArray( new ITool[retTools.size()]);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue