mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
lets throw the exception so that we can get full back trace instead of asserting
This commit is contained in:
parent
ffde7d87bc
commit
b173623edb
2 changed files with 48 additions and 56 deletions
|
@ -125,7 +125,7 @@ public class IndexManagerTests extends TestCase {
|
|||
/*
|
||||
* Utils
|
||||
*/
|
||||
private IProject createProject(String projectName) {
|
||||
private IProject createProject(String projectName) throws CoreException {
|
||||
ICProject cPrj = CProjectHelper.createCCProject(projectName, "bin");
|
||||
return cPrj.getProject();
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ public class CProjectHelper {
|
|||
/**
|
||||
* Creates a ICProject.
|
||||
*/
|
||||
public static ICProject createCProject(final String projectName, String binFolderName){
|
||||
public static ICProject createCProject(final String projectName, String binFolderName) throws CoreException {
|
||||
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||
final IProject newProject[] = new IProject[1];
|
||||
try {
|
||||
ws.run(new IWorkspaceRunnable() {
|
||||
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IWorkspaceRoot root = ws.getRoot();
|
||||
IProject project = root.getProject(projectName);
|
||||
|
@ -64,9 +64,6 @@ public class CProjectHelper {
|
|||
newProject[0] = project;
|
||||
}
|
||||
}, null);
|
||||
} catch (CoreException e) {
|
||||
Assert.fail(getMessage(e.getStatus()));
|
||||
}
|
||||
|
||||
return CCorePlugin.getDefault().getCoreModel().create(newProject[0]);
|
||||
}
|
||||
|
@ -84,11 +81,11 @@ public class CProjectHelper {
|
|||
return message.toString();
|
||||
}
|
||||
|
||||
public static ICProject createCCProject(final String projectName, final String binFolderName) {
|
||||
public static ICProject createCCProject(final String projectName, final String binFolderName) throws CoreException {
|
||||
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||
final ICProject newProject[] = new ICProject[1];
|
||||
try {
|
||||
ws.run(new IWorkspaceRunnable() {
|
||||
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
ICProject cproject = createCProject(projectName, binFolderName);
|
||||
if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||
|
@ -97,9 +94,6 @@ public class CProjectHelper {
|
|||
newProject[0] = cproject;
|
||||
}
|
||||
}, null);
|
||||
} catch (CoreException e) {
|
||||
Assert.fail(getMessage(e.getStatus()));
|
||||
}
|
||||
return newProject[0];
|
||||
}
|
||||
|
||||
|
@ -145,8 +139,7 @@ public class CProjectHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a folder container to a ICProject and imports all files contained
|
||||
* in the given Zip file.
|
||||
* Adds a folder container to a ICProject and imports all files contained in the given Zip file.
|
||||
*/
|
||||
public static ICContainer addCContainerWithImport(ICProject cproject, String containerName, ZipFile zipFile)
|
||||
throws InvocationTargetException, CoreException {
|
||||
|
@ -170,11 +163,9 @@ public class CProjectHelper {
|
|||
int x;
|
||||
IArchive[] myArchives;
|
||||
IArchiveContainer archCont;
|
||||
/***********************************************************************
|
||||
* Since ArchiveContainer.getArchives does not wait until all the
|
||||
* archives in the project have been parsed before returning the list,
|
||||
* we have to do a sync ArchiveContainer.getChildren first to make sure
|
||||
* we find all the archives.
|
||||
/***************************************************************************************************************************
|
||||
* Since ArchiveContainer.getArchives does not wait until all the archives in the project have been parsed before returning
|
||||
* the list, we have to do a sync ArchiveContainer.getChildren first to make sure we find all the archives.
|
||||
*/
|
||||
archCont = testProject.getArchiveContainer();
|
||||
myArchives = archCont.getArchives();
|
||||
|
@ -274,8 +265,8 @@ public class CProjectHelper {
|
|||
throws InvocationTargetException {
|
||||
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(srcZipFile);
|
||||
try {
|
||||
ImportOperation op =
|
||||
new ImportOperation(destPath, structureProvider.getRoot(), structureProvider, new ImportOverwriteQuery());
|
||||
ImportOperation op = new ImportOperation(destPath, structureProvider.getRoot(), structureProvider,
|
||||
new ImportOverwriteQuery());
|
||||
op.run(monitor);
|
||||
} catch (InterruptedException e) {
|
||||
// should not happen
|
||||
|
@ -283,6 +274,7 @@ public class CProjectHelper {
|
|||
}
|
||||
|
||||
private static class ImportOverwriteQuery implements IOverwriteQuery {
|
||||
|
||||
public String queryOverwrite(String file) {
|
||||
return ALL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue