* @exception CoreException If unable to create/open the ZipFile
*/
public ZipFile getZipFile(IPath path) throws CoreException {
HashMap map;
ZipFile zipFile;
if ((map = (HashMap)this.zipFiles.get()) != null
&& (zipFile = (ZipFile)map.get(path)) != null) {
return zipFile;
}
File localFile = null;
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource file = root.findMember(path);
if (file != null) {
// internal resource
URI location;
if (file.getType() != IResource.FILE || (location = file.getLocationURI()) == null) {
throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.bind(Messages.file_notFound, path.toString()), null));
}
localFile = Util.toLocalFile(location, null/*no progress availaible*/);
if (localFile == null)
throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.bind(Messages.file_notFound, path.toString()), null));
} else {
// external resource -> it is ok to use toFile()
localFile= path.toFile();
}
try {
if (ZIP_ACCESS_VERBOSE) {
System.out.println("(" + Thread.currentThread() + ") [JavaModelManager.getZipFile(IPath)] Creating ZipFile on " + localFile ); //$NON-NLS-1$ //$NON-NLS-2$
}
zipFile = new ZipFile(localFile);
if (map != null) {
map.put(path, zipFile);
}
return zipFile;
} catch (IOException e) {