/** * Removes the index for a given path. * This is a no-op if the index did not exist. */ public synchronized void removeIndex(IPath containerPath) { if (VERBOSE || DEBUG) Util.verbose("removing index " + containerPath); //$NON-NLS-1$ IPath indexLocation = computeIndexLocation(containerPath); Index index = getIndex(indexLocation); File indexFile = null; if (index != null) { index.monitor = null; indexFile = index.getIndexFile(); } if (indexFile == null) indexFile = new File(indexLocation.toOSString()); // index is not cached yet, but still want to delete the file if (indexFile.exists()) { if (DEBUG) Util.verbose("removing index file " + indexFile); //$NON-NLS-1$ indexFile.delete(); } this.indexes.removeKey(indexLocation); updateIndexState(indexLocation, null); } /**
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); } } /**
if (index != null) { index.monitor = null; indexFile = index.getIndexFile();
if (index != null) { index.monitor = null; indexFile = index.getIndexFile();
locations = new IPath[max]; locations[count++] = indexLocation; File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
if (index != null) { index.monitor = null; indexFile = index.getIndexFile();
if (index != null) { index.monitor = null; indexFile = index.getIndexFile();
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
if (index != null) { index.monitor = null; indexFile = index.getIndexFile();
public void cleanUpIndexes() { SimpleSet knownPaths = new SimpleSet(); IJavaSearchScope scope = BasicSearchEngine.createWorkspaceScope(); PatternSearchJob job = new PatternSearchJob(null, SearchEngine.getDefaultSearchParticipant(), scope, null); Index[] selectedIndexes = job.getIndexes(null); for (int i = 0, l = selectedIndexes.length; i < l; i++) { String path = selectedIndexes[i].getIndexFile().getAbsolutePath(); knownPaths.add(path); } if (this.indexStates != null) { Object[] keys = this.indexStates.keyTable; IPath[] locations = new IPath[this.indexStates.elementSize]; int count = 0; for (int i = 0, l = keys.length; i < l; i++) { IPath key = (IPath) keys[i]; if (key != null && !knownPaths.includes(key.toOSString())) locations[count++] = key; } if (count > 0) removeIndexesState(locations); } deleteIndexFiles(knownPaths); } public synchronized IPath computeIndexLocation(IPath containerPath) {
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
File indexFile = index.getIndexFile(); if (indexFile.exists()) { if (DEBUG)
indexedFileNames.put(paths[i], DELETED); final long indexLastModified = index.getIndexFile().lastModified(); this.folder.accept( new IResourceProxyVisitor() {
indexedFileNames.put(paths[i], DELETED); final long indexLastModified = max == 0 ? 0L : index.getIndexFile().lastModified();