List of usage examples for org.eclipse.jdt.internal.core.index IndexLocation close
public void close()
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.IndexManager.java
License:Open Source License
synchronized boolean addIndex(IPath containerPath, IndexLocation indexFile) { getIndexStates().put(indexFile, REUSE_STATE); this.indexLocations.put(containerPath, indexFile); Index index = getIndex(containerPath, indexFile, true, false); if (index == null) { indexFile.close(); this.indexLocations.put(containerPath, null); return false; }/*from w w w. ja v a 2 s.c o m*/ writeIndexMapFile(); return true; }
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 ww w .ja v a2 s . co m*/ * 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
/** * Removes all indexes whose paths start with (or are equal to) the given path. */// w ww. j a v a 2 s . c o m public synchronized void removeIndexPath(IPath path) { if (VERBOSE || DEBUG) Util.verbose("removing index path " + path); //$NON-NLS-1$ Object[] keyTable = this.indexes.keyTable; Object[] valueTable = this.indexes.valueTable; IndexLocation[] locations = null; int max = this.indexes.elementSize; int count = 0; for (int i = 0, l = keyTable.length; i < l; i++) { IndexLocation indexLocation = (IndexLocation) keyTable[i]; if (indexLocation == null) continue; if (indexLocation.startsWith(path)) { Index index = (Index) valueTable[i]; index.monitor = null; if (locations == null) locations = new IndexLocation[max]; locations[count++] = indexLocation; if (this.indexStates.get(indexLocation) == REUSE_STATE) { indexLocation.close(); } else { if (DEBUG) Util.verbose("removing index file " + indexLocation); //$NON-NLS-1$ indexLocation.delete(); } } else { max--; } } if (locations != null) { for (int i = 0; i < count; i++) this.indexes.removeKey(locations[i]); removeIndexesState(locations); if (this.participantsContainers != null) { boolean update = false; for (int i = 0; i < count; i++) { if (this.participantsContainers.get(locations[i]) != null) { update = true; this.participantsContainers.removeKey(locations[i]); } } if (update) writeParticipantsIndexNamesFile(); } } }