private void clearJdtIndex() throws FileNotFoundException { JavaModelManager.getIndexManager().deleteIndexFiles(); System.out.println("Cleaned up jdt's disk index."); }
private void dumpMemoryIndex(String message) { System.out.println(message + ":\n" + JavaModelManager.getIndexManager().toString()); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
/** * Removes the index for a given path. * <p> * The given index location must represent a path in the file system to a file that * already exists and must be an index file, otherwise nothing will be done. * </p><p> * It is strongly recommended to use this method instead of deleting file directly * otherwise cached index will not be removed. * </p> * * @param indexLocation the location in the file system to the index * @since 3.2 */ public void removeIndex(IPath indexLocation){ IndexManager manager = JavaModelManager.getIndexManager(); manager.removeIndexPath(indexLocation); }
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IPath[] indexLocations = this.participant.selectIndexes(this.pattern, this.scope); int length = indexLocations.length; Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; } public String getJobFamily() {
public final IPath computeIndexLocation(IPath containerPath) { IPath indexLocation = null; // we don't want to inadvertently use a JDT Index // we want to be sure to use the Index from the JSP location //Object obj = indexLocations.get(containerPath); //if (obj != null) { // indexLocation = (String) obj; //} else { // create index entry String pathString = containerPath.toOSString(); this.fChecksumCalculator.reset(); this.fChecksumCalculator.update(pathString.getBytes()); String fileName = Long.toString(this.fChecksumCalculator.getValue()) + ".index"; //$NON-NLS-1$ // this is the only difference from // IndexManager#computeIndexLocation(...) indexLocation = getModelJspPluginWorkingLocation().append(fileName); // pa_TODO need to add to java path too, so JDT search support knows // there should be a non internal way to do this. // https://bugs.eclipse.org/bugs/show_bug.cgi?id=77564 JavaModelManager.getJavaModelManager().getIndexManager().indexLocations.put(containerPath, indexLocation); //} return indexLocation; }
private void deleteIndex(IFile folder) { // cleanup index IndexManager im = JavaModelManager.getJavaModelManager().getIndexManager(); IPath folderPath = folder.getFullPath(); IPath indexLocation = JSPSearchSupport.getInstance().computeIndexLocation(folderPath); im.removeIndex(indexLocation); // im.indexLocations.removeKey(folderPath); // im.indexLocations.removeValue(indexLocation); File f = indexLocation.toFile(); f.delete(); }
void saveIndexes() { IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager(); IPath jspModelWorkingLocation = JSPSearchSupport.getInstance().getModelJspPluginWorkingLocation(); File folder = new File(jspModelWorkingLocation.toOSString()); String[] files = folder.list(); String locay = ""; //$NON-NLS-1$ Index index = null; try { for (int i = 0; i < files.length; i++) { if (files[i].toLowerCase().endsWith(".index")) { //$NON-NLS-1$ locay = jspModelWorkingLocation.toString() + "/" + files[i]; //$NON-NLS-1$ // reuse index file index = new Index(locay, "Index for " + locay, true); //$NON-NLS-1$ indexManager.saveIndex(index); } } } catch (Exception e) { // we should be shutting down, want to shut down quietly if (DEBUG) e.printStackTrace(); } }
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; }
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; }
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; } public String getJobFamily() {
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; } public String getJobFamily() {
public Index[] getIndexes(IProgressMonitor progressMonitor) { // acquire the in-memory indexes on the fly IndexLocation[] indexLocations; int length; if (this.participant instanceof JavaSearchParticipant) { indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope); length = indexLocations.length; } else { IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope); length = paths.length; indexLocations = new IndexLocation[paths.length]; for (int i = 0, len = paths.length; i < len; i++) { indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true); } } Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor); this.areIndexesReady = indexes.length == length; return indexes; } public String getJobFamily() {
private static void indexCompilationUnitSync(ICompilationUnit icu) { IJavaProject jp = icu.getJavaProject(); IndexManager im = JavaModelManager.getIndexManager(); IPath containerPath = jp.getProject().getFullPath(); SourceElementParser parser = im.getSourceElementParser(jp, null/*requestor will be set by indexer*/); im.addSource((IFile) icu.getResource(), containerPath, parser); AbstractJob.waitForJobFamily(containerPath.toString()); }
/** * Deletes the index, then rebuilds any portions of the index that are * currently needed by the workspace. * * @param monitor a progress monitor, or <code>null</code> if progress * reporting and cancellation are not desired * @throws CoreException * @since 3.13 */ public static void rebuildIndex(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); IndexManager manager = JavaModelManager.getIndexManager(); manager.deleteIndexFiles(subMonitor.split(1)); manager.reset(); Indexer.getInstance().rebuildIndex(subMonitor.split(95)); updateLegacyIndex(subMonitor.split(4)); }
/** * Deletes the index, then rebuilds any portions of the index that are * currently needed by the workspace. * * @param monitor a progress monitor, or <code>null</code> if progress * reporting and cancellation are not desired * @throws CoreException * @since 3.13 */ public static void rebuildIndex(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 100); IndexManager manager = JavaModelManager.getIndexManager(); manager.deleteIndexFiles(subMonitor.split(1)); manager.reset(); Indexer.getInstance().rebuildIndex(subMonitor.split(95)); updateLegacyIndex(subMonitor.split(4)); }