* @throws DocumentException
* @throws CoreException
*/
private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor, boolean useCloud)
throws IOException, DocumentException, CoreException {
SortedBugCollection bugCollection;
IPath bugCollectionPath = getBugCollectionFile(project);
// Don't turn the path to an IFile because it isn't local to the
// project.
// see the javadoc for org.eclipse.core.runtime.Plugin
File bugCollectionFile = bugCollectionPath.toFile();
if (!bugCollectionFile.exists()) {
// throw new
// FileNotFoundException(bugCollectionFile.getLocation().toOSString());
getDefault().logInfo("creating new bug collection: " + bugCollectionPath.toOSString());
createDefaultEmptyBugCollection(project); // since we no longer
// throw, have to do this
// here
return;
}
UserPreferences prefs = getUserPreferences(project);
bugCollection = new SortedBugCollection();
bugCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
bugCollection.setDoNotUseCloud(!useCloud);
bugCollection.readXML(bugCollectionFile);
if (useCloud) {
String cloudId = prefs.getCloudId();
if (cloudId != null) {
bugCollection.getProject().setCloudId(cloudId);
}
}
cacheBugCollectionAndProject(project, bugCollection, bugCollection.getProject());
}