IndexManager manager = JavaModelManager.getIndexManager();
// TODO (frederic) should not have to create index manually, should expose API that recreates index instead
IndexLocation indexLocation;
indexLocation = new FileIndexLocation(indexPath.toFile(), true);
manager.ensureIndexExists(indexLocation, containerPath);
manager.scheduleDocumentIndexing(document, containerPath, indexLocation, this);
if (!indexPath.equals(this.lastIndexLocation)) {
manager.updateParticipant(indexPath, containerPath);
this.lastIndexLocation = indexPath;
}
}