List of usage examples for org.eclipse.jdt.internal.core.index IndexLocation getIndexFile
public abstract File getIndexFile();
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.IndexManager.java
License:Open Source License
/** * Removes the index for a given path./*from w ww. ja va 2 s. com*/ * 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$ IndexLocation indexLocation = computeIndexLocation(containerPath); Index index = getIndex(indexLocation); File indexFile = null; if (index != null) { index.monitor = null; indexFile = index.getIndexFile(); } if (indexFile == null) indexFile = indexLocation.getIndexFile(); // index is not cached yet, but still want to delete the file if (this.indexStates.get(indexLocation) == REUSE_STATE) { indexLocation.close(); this.indexLocations.put(containerPath, null); } else if (indexFile != null && indexFile.exists()) { if (DEBUG) Util.verbose("removing index file " + indexFile); //$NON-NLS-1$ indexFile.delete(); } this.indexes.removeKey(indexLocation); if (IS_MANAGING_PRODUCT_INDEXES_PROPERTY) { this.indexLocations.removeKey(containerPath); } updateIndexState(indexLocation, null); }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.IndexManager.java
License:Open Source License
private void writeParticipantsIndexNamesFile() { BufferedWriter writer = null; try {// w w w . ja v a2 s . c o m writer = new BufferedWriter(new FileWriter(this.participantIndexNamesFile)); writer.write(DiskIndex.SIGNATURE); writer.write('\n'); Object[] indexFiles = this.participantsContainers.keyTable; Object[] containers = this.participantsContainers.valueTable; for (int i = 0, l = indexFiles.length; i < l; i++) { IndexLocation indexFile = (IndexLocation) indexFiles[i]; if (indexFile != null) { writer.write(indexFile.getIndexFile().getPath()); writer.write('\n'); writer.write(((IPath) containers[i]).toOSString()); writer.write('\n'); } } } catch (IOException ignored) { if (VERBOSE) Util.verbose("Failed to write participant index file names", System.err); //$NON-NLS-1$ } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { // ignore } } } }