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

Commit for Leo Treggiari -- Bug 80820 Two problems for converting 1.2 projects using 3rd party tool integrations

If there is no match for an option in the project being converted, ignore the option and continue converting the configuration
Patch tool lookup in converters to handle the case where the location of the definition fools the manifest reader and effectively hides the tool
This commit is contained in:
Sean Evoy 2004-12-13 17:37:51 +00:00
parent e7908d52e2
commit 3abb569374
5 changed files with 98 additions and 109 deletions

View file

@ -52,8 +52,10 @@ public class ManagedProjectUpdateTests extends TestCase {
private IProject[] createVersionProjects(String version){ private IProject[] createVersionProjects(String version){
File file = getVersionProjectsDir(version); File file = getVersionProjectsDir(version);
if(file == null) if(file == null) {
fail("Test project directory " + file.getName() + " is missing.");
return null; return null;
}
File projectZips[] = file.listFiles(new FileFilter(){ File projectZips[] = file.listFiles(new FileFilter(){
public boolean accept(File pathname){ public boolean accept(File pathname){
@ -80,8 +82,10 @@ public class ManagedProjectUpdateTests extends TestCase {
catch(Exception e){ catch(Exception e){
} }
} }
if(projectList.size() == 0) if(projectList.size() == 0) {
fail("No projects found in test project directory " + file.getName() + ". The .zip file may be missing or corrupt.");
return null; return null;
}
return (IProject[])projectList.toArray(new IProject[projectList.size()]); return (IProject[])projectList.toArray(new IProject[projectList.size()]);
} }

View file

@ -218,6 +218,7 @@ class UpdateManagedProject12 {
convertToolRef(toolChain, (Element) toolRefNodes.item(refIndex), monitor); convertToolRef(toolChain, (Element) toolRefNodes.item(refIndex), monitor);
} }
catch(CoreException e){ catch(CoreException e){
// TODO: Need error dialog!
newProject.removeConfiguration(newConfigId); newProject.removeConfiguration(newConfigId);
throw e; throw e;
} }
@ -314,7 +315,6 @@ class UpdateManagedProject12 {
// ignore this exception too // ignore this exception too
} }
// Construct the new ID // Construct the new ID
optId = new String(); optId = new String();
for (int rebuildIndex = 0; rebuildIndex < newIdVector.size(); ++ rebuildIndex) { for (int rebuildIndex = 0; rebuildIndex < newIdVector.size(); ++ rebuildIndex) {
@ -350,8 +350,7 @@ class UpdateManagedProject12 {
return curOption.getId(); return curOption.getId();
} }
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1, return optId;
ConverterMessages.getFormattedString("UpdateManagedProject12.3",optId), null)); //$NON-NLS-1$
} }
protected static void convertOptionRef(IToolChain toolChain, ITool tool, Element optRef) protected static void convertOptionRef(IToolChain toolChain, ITool tool, Element optRef)
@ -362,11 +361,7 @@ class UpdateManagedProject12 {
optId = getNewOptionId(toolChain, tool, optId); optId = getNewOptionId(toolChain, tool, optId);
// Get the option from the new tool // Get the option from the new tool
IOption newOpt = tool.getOptionById(optId); IOption newOpt = tool.getOptionById(optId);
if (newOpt == null) { if (newOpt != null) { // Ignore options that don't have a match
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
ConverterMessages.getFormattedString("UpdateManagedProject12.4",optId), null)); //$NON-NLS-1$
}
IConfiguration configuration = toolChain.getParent(); IConfiguration configuration = toolChain.getParent();
try { try {
@ -406,7 +401,7 @@ class UpdateManagedProject12 {
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1, throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
ConverterMessages.getFormattedString("UpdateManagedProject12.5",e.getMessage()), e)); //$NON-NLS-1$ ConverterMessages.getFormattedString("UpdateManagedProject12.5",e.getMessage()), e)); //$NON-NLS-1$
} }
}
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -582,15 +577,13 @@ class UpdateManagedProject12 {
ITool parent = curTool.getSuperClass(); ITool parent = curTool.getSuperClass();
String curToolId = curTool.getId(); String curToolId = curTool.getId();
if(parent == null) while (parent != null) {
continue;
parent = parent.getSuperClass();
if(parent == null)
continue;
String parentId = parent.getId(); String parentId = parent.getId();
if(!parentId.equals(toolId)) if(parentId.equals(toolId))
break;
parent = parent.getSuperClass();
}
if(parent == null)
continue; continue;
try{ try{
@ -611,9 +604,7 @@ class UpdateManagedProject12 {
protected static void convertToolRef(IToolChain toolChain, Element oldToolRef, IProgressMonitor monitor) protected static void convertToolRef(IToolChain toolChain, Element oldToolRef, IProgressMonitor monitor)
throws CoreException { throws CoreException {
String toolId = oldToolRef.getAttribute(IToolReference.ID); String toolId = oldToolRef.getAttribute(IToolReference.ID);
toolId = getNewToolId(toolChain, toolId); toolId = getNewToolId(toolChain, toolId);
IConfiguration configuration = toolChain.getParent(); IConfiguration configuration = toolChain.getParent();
// Get the new tool out of the configuration // Get the new tool out of the configuration

View file

@ -286,15 +286,13 @@ class UpdateManagedProject20 {
ITool parent = curTool.getSuperClass(); ITool parent = curTool.getSuperClass();
String curToolId = curTool.getId(); String curToolId = curTool.getId();
if(parent == null) while (parent != null) {
continue;
parent = parent.getSuperClass();
if(parent == null)
continue;
String parentId = parent.getId(); String parentId = parent.getId();
if(!parentId.equals(toolId)) if(parentId.equals(toolId))
break;
parent = parent.getSuperClass();
}
if(parent == null)
continue; continue;
try{ try{
@ -374,11 +372,7 @@ class UpdateManagedProject20 {
if(option == null) if(option == null)
option = tool.getOptionById(optId); option = tool.getOptionById(optId);
if(option == null){ if (option != null) { // Ignore options that don't have a match
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
ConverterMessages.getFormattedString("UpdateManagedProject20.7",optId), null)); //$NON-NLS-1$
}
try{ try{
int type = option.getValueType(); int type = option.getValueType();
@ -423,7 +417,7 @@ class UpdateManagedProject20 {
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1, throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
ConverterMessages.getFormattedString("UpdateManagedProject20.8",e.getMessage()), e)); //$NON-NLS-1$ ConverterMessages.getFormattedString("UpdateManagedProject20.8",e.getMessage()), e)); //$NON-NLS-1$
} }
}
} }
} }