public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$ } IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile)); Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/); SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index.separator = JAR_SEPARATOR; ZipFile zip = new ZipFile(pathToJar); try { for (Enumeration e = zip.entries(); e.hasMoreElements();) { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); if (Util.isClassFileName(zipEntryName)) { final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant); entryDocument.setIndex(index); new BinaryIndexer(entryDocument).indexDocument(); } } index.save(); } finally { zip.close(); } return; } }
public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$ } IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile)); Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/); SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index.separator = JAR_SEPARATOR; ZipFile zip = new ZipFile(pathToJar); try { for (Enumeration e = zip.entries(); e.hasMoreElements();) { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); if (Util.isClassFileName(zipEntryName)) { final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant); entryDocument.setIndex(index); new BinaryIndexer(entryDocument).indexDocument(); } } index.save(); } finally { zip.close(); } return; } }
public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$ } IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile)); Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/); SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index.separator = JAR_SEPARATOR; ZipFile zip = new ZipFile(pathToJar); try { for (Enumeration e = zip.entries(); e.hasMoreElements();) { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); if (Util.isClassFileName(zipEntryName)) { final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant); entryDocument.setIndex(index); new BinaryIndexer(entryDocument).indexDocument(); } } index.save(); } finally { zip.close(); } return; } }
public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$ } IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile)); Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/); SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index.separator = JAR_SEPARATOR; ZipFile zip = new ZipFile(pathToJar); try { for (Enumeration e = zip.entries(); e.hasMoreElements();) { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); if (Util.isClassFileName(zipEntryName)) { final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant); entryDocument.setIndex(index); new BinaryIndexer(entryDocument).indexDocument(); } } index.save(); } finally { zip.close(); } return; } }
public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException { File f = new File(pathToJar); if (!f.exists()) { throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$ } IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile)); Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/); SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); index.separator = JAR_SEPARATOR; ZipFile zip = new ZipFile(pathToJar); try { for (Enumeration e = zip.entries(); e.hasMoreElements();) { // iterate each entry to index it ZipEntry ze = (ZipEntry) e.nextElement(); String zipEntryName = ze.getName(); if (Util.isClassFileName(zipEntryName)) { final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip); JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant); entryDocument.setIndex(index); new BinaryIndexer(entryDocument).indexDocument(); } } index.save(); } finally { zip.close(); } return; } }
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IndexLocation indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IndexLocation indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IndexLocation indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IndexLocation indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexFile()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IPath indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
public void saveIndex(Index index) throws IOException { // must have permission to write from the write monitor if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { IPath containerPath = new Path(index.containerPath); if (this.jobEnd > this.jobStart) { for (int i = this.jobEnd; i > this.jobStart; i--) { // skip the current job IJob job = this.awaitingJobs[i]; if (job instanceof IndexRequest) if (((IndexRequest) job).containerPath.equals(containerPath)) return; } } IndexLocation indexLocation = computeIndexLocation(containerPath); updateIndexState(indexLocation, SAVED_STATE); } } /**
/** * {@link #saveIndex(Index)} will only update the state if there are no other jobs running against the same * underlying resource for this index. Pre-built indexes must be in a {@link #REUSE_STATE} state even if * there is another job to run against it as the subsequent job will find the index and not save it in the * right state. * Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932 */ public void savePreBuiltIndex(Index index) throws IOException { if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving pre-build index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { updateIndexState(index.getIndexLocation(), REUSE_STATE); } } public void saveIndex(Index index) throws IOException {
/** * {@link #saveIndex(Index)} will only update the state if there are no other jobs running against the same * underlying resource for this index. Pre-built indexes must be in a {@link #REUSE_STATE} state even if * there is another job to run against it as the subsequent job will find the index and not save it in the * right state. * Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932 */ public void savePreBuiltIndex(Index index) throws IOException { if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving pre-build index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { updateIndexState(index.getIndexLocation(), REUSE_STATE); } } public void saveIndex(Index index) throws IOException {
/** * {@link #saveIndex(Index)} will only update the state if there are no other jobs running against the same * underlying resource for this index. Pre-built indexes must be in a {@link #REUSE_STATE} state even if * there is another job to run against it as the subsequent job will find the index and not save it in the * right state. * Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932 */ public void savePreBuiltIndex(Index index) throws IOException { if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving pre-build index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { updateIndexState(index.getIndexLocation(), REUSE_STATE); } } public void saveIndex(Index index) throws IOException {
/** * {@link #saveIndex(Index)} will only update the state if there are no other jobs running against the same * underlying resource for this index. Pre-built indexes must be in a {@link #REUSE_STATE} state even if * there is another job to run against it as the subsequent job will find the index and not save it in the * right state. * Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932 */ public void savePreBuiltIndex(Index index) throws IOException { if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving pre-build index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { updateIndexState(index.getIndexLocation(), REUSE_STATE); } } public void saveIndex(Index index) throws IOException {
/** * {@link #saveIndex(Index)} will only update the state if there are no other jobs running against the same * underlying resource for this index. Pre-built indexes must be in a {@link #REUSE_STATE} state even if * there is another job to run against it as the subsequent job will find the index and not save it in the * right state. * Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932 */ public void savePreBuiltIndex(Index index) throws IOException { if (index.hasChanged()) { if (VERBOSE) Util.verbose("-> saving pre-build index " + index.getIndexLocation()); //$NON-NLS-1$ index.save(); } synchronized (this) { updateIndexState(index.getIndexLocation(), REUSE_STATE); } } public void saveIndex(Index index) throws IOException {
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); } finally { this.monitor.exitWriteEnterRead();
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); } finally { this.monitor.exitWriteEnterRead();
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); } finally { this.monitor.exitWriteEnterRead();
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) { try { save(); } finally { this.monitor.exitWriteEnterRead();