public ExtensionsErrorReporter(IFile file) { super(file); fModel = MonitorRegistry.findModel(file.getProject()); try { if (fModel != null && fModel.getUnderlyingResource() != null) fBuildModel = ClasspathUtilCore.getBuild(fModel); } catch (CoreException e) { } }
private ISourceContainer getArchiveSourceContainer(String location) throws JavaModelException { IWorkspaceRoot root = PDELaunchingPlugin.getWorkspace().getRoot(); IFile[] containers = root.findFilesForLocationURI(URIUtil.toURI(location)); for (int i = 0; i < containers.length; i++) { IJavaElement element = JavaCore.create(containers[i]); if (element instanceof IPackageFragmentRoot) { IPackageFragmentRoot archive = (IPackageFragmentRoot) element; IPath path = archive.getSourceAttachmentPath(); if (path == null || path.segmentCount() == 0) continue; IPath rootPath = archive.getSourceAttachmentRootPath(); boolean detectRootPath = rootPath != null && rootPath.segmentCount() > 0; IFile archiveFile = root.getFile(path); if (archiveFile.exists()) return new ArchiveSourceContainer(archiveFile, detectRootPath); File file = path.toFile(); if (file.exists()) return new ExternalArchiveSourceContainer(file.getAbsolutePath(), detectRootPath); } } return null; }