public ClassFileToIndexConverter(NdResourceFile resourceFile) { this.resource = resourceFile; this.index = JavaIndex.getIndex(resourceFile.getNd()); }
public ClassFileToIndexConverter(NdResourceFile resourceFile) { this.resource = resourceFile; this.index = JavaIndex.getIndex(resourceFile.getNd()); }
public static JavaIndex getIndex() { return getIndex(getGlobalNd()); }
public static JavaIndex getIndex() { return getIndex(getGlobalNd()); }
private void updateResourceMappings(Map<IPath, List<IJavaElement>> pathsToUpdate, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, pathsToUpdate.keySet().size()); JavaIndex index = JavaIndex.getIndex(this.nd); for (Entry<IPath, List<IJavaElement>> entry : pathsToUpdate.entrySet()) { SubMonitor iterationMonitor = subMonitor.split(1).setWorkRemaining(10); this.nd.acquireWriteLock(iterationMonitor.split(1)); try { NdResourceFile resourceFile = index.getResourceFile(entry.getKey().toString().toCharArray()); if (resourceFile == null) { continue; } attachWorkspaceFilesToResource(entry.getValue(), resourceFile); } finally { this.nd.releaseWriteLock(); } } }
private void updateResourceMappings(Map<IPath, List<IJavaElement>> pathsToUpdate, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, pathsToUpdate.keySet().size()); JavaIndex index = JavaIndex.getIndex(this.nd); for (Entry<IPath, List<IJavaElement>> entry : pathsToUpdate.entrySet()) { SubMonitor iterationMonitor = subMonitor.split(1).setWorkRemaining(10); this.nd.acquireWriteLock(iterationMonitor.split(1)); try { NdResourceFile resourceFile = index.getResourceFile(entry.getKey().toString().toCharArray()); if (resourceFile == null) { continue; } attachWorkspaceFilesToResource(entry.getValue(), resourceFile); } finally { this.nd.releaseWriteLock(); } } }
/** * Reads the given binary type. If the type can be found in the index with a fingerprint that exactly matches * the file on disk, the type is read from the index. Otherwise the type is read from disk. Returns null if * no such type exists. * @throws ClassFormatException */ public static IBinaryType readType(BinaryTypeDescriptor descriptor, IProgressMonitor monitor) throws JavaModelException, ClassFormatException { if (JavaIndex.isEnabled()) { try { return readFromIndex(JavaIndex.getIndex(), descriptor, monitor); } catch (NotInIndexException e) { // fall back to reading the zip file, below } } return rawReadType(descriptor, true); }
/** * Reads the given binary type. If the type can be found in the index with a fingerprint that exactly matches * the file on disk, the type is read from the index. Otherwise the type is read from disk. Returns null if * no such type exists. * @throws ClassFormatException */ public static IBinaryType readType(BinaryTypeDescriptor descriptor, IProgressMonitor monitor) throws JavaModelException, ClassFormatException { if (JavaIndex.isEnabled()) { try { return readFromIndex(JavaIndex.getIndex(), descriptor, monitor); } catch (NotInIndexException e) { // fall back to reading the zip file, below } } return rawReadType(descriptor, true); }
private static void newSearchAllPossibleSubTypes(IType type, IJavaSearchScope scope2, Map binariesFromIndexMatches2, IPathRequestor pathRequestor, int waitingPolicy, IProgressMonitor progressMonitor) { SubMonitor subMonitor = SubMonitor.convert(progressMonitor, 2); JavaIndex index = JavaIndex.getIndex();
private static void newSearchAllPossibleSubTypes(IType type, IJavaSearchScope scope2, Map binariesFromIndexMatches2, IPathRequestor pathRequestor, int waitingPolicy, IProgressMonitor progressMonitor) { SubMonitor subMonitor = SubMonitor.convert(progressMonitor, 2); JavaIndex index = JavaIndex.getIndex();
public void verifyArchiveContent(IPath path) throws CoreException { // TODO: we haven't finalized what path the JRT is represented by. Don't attempt to validate it. if (isJrt(path)) { return; } throwExceptionIfArchiveInvalid(path); // Check if we can determine the archive's validity by examining the index if (JavaIndex.isEnabled()) { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(path).getAbsolutePath(); try (IReader reader = index.getNd().acquireReadLock()) { NdResourceFile resourceFile = index.getResourceFile(location.toCharArray()); if (index.isUpToDate(resourceFile)) { // We have this file in the index and the index is up-to-date, so we can determine the file's // validity without touching the filesystem. if (resourceFile.isCorruptedZipFile()) { throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.status_IOException, new ZipException())); } return; } } } ZipFile file = getZipFile(path); closeZipFile(file); }
public void verifyArchiveContent(IPath path) throws CoreException { // TODO: we haven't finalized what path the JRT is represented by. Don't attempt to validate it. if (isJrt(path)) { return; } throwExceptionIfArchiveInvalid(path); // Check if we can determine the archive's validity by examining the index if (JavaIndex.isEnabled()) { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(path).getAbsolutePath(); try (IReader reader = index.getNd().acquireReadLock()) { NdResourceFile resourceFile = index.getResourceFile(location.toCharArray()); if (index.isUpToDate(resourceFile)) { // We have this file in the index and the index is up-to-date, so we can determine the file's // validity without touching the filesystem. if (resourceFile.isCorruptedZipFile()) { throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Messages.status_IOException, new ZipException())); } return; } } } ZipFile file = getZipFile(path); closeZipFile(file); }
private static char[] getManifestContents(IPath jarPath) throws CoreException, IOException { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(jarPath).getAbsolutePath(); try (IReader reader = index.getNd().acquireReadLock()) {
private static char[] getManifestContents(IPath jarPath) throws CoreException, IOException { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(jarPath).getAbsolutePath(); try (IReader reader = index.getNd().acquireReadLock()) {
@Override public NdType get() { NdTypeId typeId = JavaIndex.getIndex(TypeRef.this.ref.getNd()).findType(TypeRef.this.fieldDescriptor); if (typeId == null) { return null; } List<NdType> implementations = typeId.getTypes(); for (NdType next : implementations) { NdResourceFile nextResourceFile = next.getResourceFile(); if (nextResourceFile.getLocation().compare(TypeRef.this.fileName, false) == 0) { if (nextResourceFile.isDoneIndexing()) { return next; } } } return null; } }
@Override public NdType get() { NdTypeId typeId = JavaIndex.getIndex(TypeRef.this.ref.getNd()).findType(TypeRef.this.fieldDescriptor); if (typeId == null) { return null; } List<NdType> implementations = typeId.getTypes(); for (NdType next : implementations) { NdResourceFile nextResourceFile = next.getResourceFile(); if (nextResourceFile.getLocation().compare(TypeRef.this.fileName, false) == 0) { if (nextResourceFile.isDoneIndexing()) { return next; } } } return null; } }
JavaIndex index = JavaIndex.getIndex(); Nd nd = index.getNd(); try (IReader lock = nd.acquireReadLock()) {
JavaIndex index = JavaIndex.getIndex(); Nd nd = index.getNd(); try (IReader lock = nd.acquireReadLock()) {
private FingerprintTestResult testForChanges(IPath thePath, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); JavaIndex javaIndex = JavaIndex.getIndex(this.nd); String pathString = thePath.toString();
private FingerprintTestResult testForChanges(IPath thePath, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); JavaIndex javaIndex = JavaIndex.getIndex(this.nd); String pathString = thePath.toString();