public static INameEnvironment create(List<IJavaProject> javaProjects, org.eclipse.jdt.core.ICompilationUnit[] copies) { if (JavaIndex.isEnabled() && isEnabled()) { return new IndexBasedJavaSearchEnvironment(javaProjects, copies); } else { Iterator<IJavaProject> next = javaProjects.iterator(); JavaSearchNameEnvironment result = new JavaSearchNameEnvironment(next.next(), copies); while (next.hasNext()) { result.addProjectClassPath((JavaProject)next.next()); } return result; } } }
public static INameEnvironment create(List<IJavaProject> javaProjects, org.eclipse.jdt.core.ICompilationUnit[] copies) { if (JavaIndex.isEnabled() && isEnabled()) { return new IndexBasedJavaSearchEnvironment(javaProjects, copies); } else { Iterator<IJavaProject> next = javaProjects.iterator(); JavaSearchNameEnvironment result = new JavaSearchNameEnvironment(next.next(), copies); while (next.hasNext()) { result.addProjectClassPath((JavaProject)next.next()); } return result; } } }
@Override public void consume(IndexerEvent event) { if (JavaIndex.isEnabled()) { DeltaProcessor processor = getDeltaProcessor(); JavaElementDelta delta = (JavaElementDelta) event.getDelta(); delta.ignoreFromTests = true; processor.notifyAndFire(delta); this.deltaProcessors.set(null); } } }
public void rescanAll() { if (DEBUG_SCHEDULING) { Package.logInfo("Scheduling rescanAll now"); //$NON-NLS-1$ } synchronized (this.automaticIndexingMutex) { if (!this.enableAutomaticIndexing) { if (!this.indexerDirtiedWhileDisabled) { this.indexerDirtiedWhileDisabled = true; } return; } } if (!JavaIndex.isEnabled()) { return; } this.rescanJob.schedule(); }
@Override public void consume(IndexerEvent event) { if (JavaIndex.isEnabled()) { DeltaProcessor processor = getDeltaProcessor(); JavaElementDelta delta = (JavaElementDelta) event.getDelta(); delta.ignoreFromTests = true; processor.notifyAndFire(delta); this.deltaProcessors.set(null); } }
public void rescanAll() { if (DEBUG_SCHEDULING) { Package.logInfo("Scheduling rescanAll now"); //$NON-NLS-1$ } synchronized (this.automaticIndexingMutex) { if (!this.enableAutomaticIndexing) { if (!this.indexerDirtiedWhileDisabled) { this.indexerDirtiedWhileDisabled = true; } return; } } if (!JavaIndex.isEnabled()) { return; } this.rescanJob.schedule(); }
/** * 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); }
@Override public void preferenceChange(PreferenceChangeEvent event) { if (JavaIndex.ENABLE_NEW_JAVA_INDEX.equals(event.getKey())) { if (JavaIndex.isEnabled()) { getInstance().rescanAll(); } else { ChunkCache.getSharedInstance().clear(); } } } };
public void waitForIndex(int waitingPolicy, IProgressMonitor monitor) { if (!JavaIndex.isEnabled()) { return; } switch (waitingPolicy) { case IJob.ForceImmediate: { break; } case IJob.CancelIfNotReady: { if (this.rescanJob.getState() != Job.NONE) { throw new OperationCanceledException(); } break; } case IJob.WaitUntilReady: { waitForIndex(monitor); break; } } }
@Override public void preferenceChange(PreferenceChangeEvent event) { if (JavaIndex.ENABLE_NEW_JAVA_INDEX.equals(event.getKey())) { if (JavaIndex.isEnabled()) { getInstance().rescanAll(); } else { ChunkCache.getSharedInstance().clear(); } } } };
public void waitForIndex(int waitingPolicy, IProgressMonitor monitor) { if (!JavaIndex.isEnabled()) { return; } switch (waitingPolicy) { case IJob.ForceImmediate: { break; } case IJob.CancelIfNotReady: { if (this.rescanJob.getState() != Job.NONE) { throw new OperationCanceledException(); } break; } case IJob.WaitUntilReady: { waitForIndex(monitor); break; } } }
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 { if (JavaIndex.isEnabled()) { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(jarPath).getAbsolutePath();
private static char[] getManifestContents(IPath jarPath) throws CoreException, IOException { if (JavaIndex.isEnabled()) { JavaIndex index = JavaIndex.getIndex(); String location = JavaModelManager.getLocalFile(jarPath).getAbsolutePath();
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); }
final IProgressMonitor monitor) { if (JavaIndex.isEnabled()) { SubMonitor subMonitor = SubMonitor.convert(monitor, 2); newSearchAllPossibleSubTypes(type, scope, binariesFromIndexMatches, pathRequestor, waitingPolicy,
final IProgressMonitor monitor) { if (JavaIndex.isEnabled()) { SubMonitor subMonitor = SubMonitor.convert(monitor, 2); newSearchAllPossibleSubTypes(type, scope, binariesFromIndexMatches, pathRequestor, waitingPolicy,
public void rebuildIndex(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); this.rescanJob.cancel(); try { this.rescanJob.join(0, subMonitor.split(1)); } catch (InterruptedException e) { // Nothing to do. } this.nd.acquireWriteLock(subMonitor.split(1)); try { this.nd.clear(subMonitor.split(2)); this.nd.getDB().flush(); } finally { this.nd.releaseWriteLock(); } if (!JavaIndex.isEnabled()) { return; } rescan(subMonitor.split(97)); }
public void rebuildIndex(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); this.rescanJob.cancel(); try { this.rescanJob.join(0, subMonitor.split(1)); } catch (InterruptedException e) { // Nothing to do. } this.nd.acquireWriteLock(subMonitor.split(1)); try { this.nd.clear(subMonitor.split(2)); this.nd.getDB().flush(); } finally { this.nd.releaseWriteLock(); } if (!JavaIndex.isEnabled()) { return; } rescan(subMonitor.split(97)); }