use of org.eclipse.jdt.internal.core.index.FileIndexLocation in project che by eclipse.
the class IndexManager method getIndexStates.
private SimpleLookupTable getIndexStates() {
if (this.indexStates != null)
return this.indexStates;
this.indexStates = new SimpleLookupTable();
File indexesDirectoryPath = getSavedIndexesDirectory();
char[][] savedNames = readIndexState(getJavaPluginWorkingLocation().toOSString());
if (savedNames != null) {
for (int i = 1, l = savedNames.length; i < l; i++) {
// first name is saved signature, see readIndexState()
char[] savedName = savedNames[i];
if (savedName.length > 0) {
IndexLocation indexLocation = new FileIndexLocation(// shares indexesDirectoryPath's segments
new File(indexesDirectoryPath, String.valueOf(savedName)));
if (JobManager.VERBOSE)
//$NON-NLS-1$
Util.verbose("Reading saved index file " + indexLocation);
this.indexStates.put(indexLocation, SAVED_STATE);
}
}
} else {
// All the index files are getting deleted and hence there is no need to
// further check for change in javaLikeNames.
writeJavaLikeNamesFile();
this.javaLikeNamesChanged = false;
deleteIndexFiles();
}
readIndexMap();
return this.indexStates;
}
use of org.eclipse.jdt.internal.core.index.FileIndexLocation in project che by eclipse.
the class IndexManager method updateParticipant.
public void updateParticipant(IPath indexPath, IPath containerPath) {
if (this.participantsContainers == null) {
readParticipantsIndexNamesFile();
}
IndexLocation indexLocation = new FileIndexLocation(indexPath.toFile(), true);
if (this.participantsContainers.get(indexLocation) == null) {
this.participantsContainers.put(indexLocation, containerPath);
this.participantUpdated = true;
}
}
use of org.eclipse.jdt.internal.core.index.FileIndexLocation in project che by eclipse.
the class IndexManager method readParticipantsIndexNamesFile.
private void readParticipantsIndexNamesFile() {
SimpleLookupTable containers = new SimpleLookupTable(3);
try {
char[] participantIndexNames = org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(this.participantIndexNamesFile, null);
if (participantIndexNames.length > 0) {
char[][] names = CharOperation.splitOn('\n', participantIndexNames);
if (names.length >= 3) {
// First line is DiskIndex signature (see writeParticipantsIndexNamesFile())
if (DiskIndex.SIGNATURE.equals(new String(names[0]))) {
for (int i = 1, l = names.length - 1; i < l; i += 2) {
IndexLocation indexLocation = new FileIndexLocation(new File(new String(names[i])), true);
containers.put(indexLocation, new Path(new String(names[i + 1])));
}
}
}
}
} catch (IOException ignored) {
if (JobManager.VERBOSE)
//$NON-NLS-1$
Util.verbose("Failed to read participant index file names");
}
this.participantsContainers = containers;
return;
}
use of org.eclipse.jdt.internal.core.index.FileIndexLocation in project che by eclipse.
the class IndexManager method computeIndexLocation.
public synchronized IndexLocation computeIndexLocation(IPath containerPath) {
IndexLocation indexLocation = (IndexLocation) this.indexLocations.get(containerPath);
if (indexLocation == null) {
String pathString = containerPath.toOSString();
CRC32 checksumCalculator = new CRC32();
checksumCalculator.update(pathString.getBytes());
//$NON-NLS-1$
String fileName = Long.toString(checksumCalculator.getValue()) + ".index";
if (JobManager.VERBOSE)
//$NON-NLS-1$ //$NON-NLS-2$
Util.verbose("-> index name for " + pathString + " is " + fileName);
// to share the indexLocation between the indexLocations and indexStates tables, get the key from the indexStates table
indexLocation = (IndexLocation) getIndexStates().getKey(new FileIndexLocation(new File(getSavedIndexesDirectory(), fileName)));
this.indexLocations.put(containerPath, indexLocation);
}
return indexLocation;
}
Aggregations