Search in sources :

Example 1 with CollectingContentIterator

use of com.intellij.openapi.roots.CollectingContentIterator in project intellij-community by JetBrains.

the class UnindexedFilesUpdater method updateUnindexedFiles.

private void updateUnindexedFiles(ProgressIndicator indicator) {
    PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot();
    PushedFilePropertiesUpdater.getInstance(myProject).pushAllPropertiesNow();
    boolean trackResponsiveness = !ApplicationManager.getApplication().isUnitTestMode();
    if (trackResponsiveness)
        snapshot.logResponsivenessSinceCreation("Pushing properties");
    indicator.setIndeterminate(true);
    indicator.setText(IdeBundle.message("progress.indexing.scanning"));
    myIndex.clearIndicesIfNecessary();
    CollectingContentIterator finder = myIndex.createContentIterator(indicator);
    snapshot = PerformanceWatcher.takeSnapshot();
    myIndex.iterateIndexableFilesConcurrently(finder, myProject, indicator);
    myIndex.filesUpdateEnumerationFinished();
    if (trackResponsiveness)
        snapshot.logResponsivenessSinceCreation("Indexable file iteration");
    List<VirtualFile> files = finder.getFiles();
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
        // full VFS refresh makes sense only after it's loaded, i.e. after scanning files to index is finished
        ((StartupManagerImpl) StartupManager.getInstance(myProject)).scheduleInitialVfsRefresh();
    }
    if (files.isEmpty()) {
        return;
    }
    snapshot = PerformanceWatcher.takeSnapshot();
    if (trackResponsiveness)
        LOG.info("Unindexed files update started: " + files.size() + " files to update");
    indicator.setIndeterminate(false);
    indicator.setText(IdeBundle.message("progress.indexing.updating"));
    indexFiles(indicator, files);
    if (trackResponsiveness)
        snapshot.logResponsivenessSinceCreation("Unindexed files update");
}
Also used : PerformanceWatcher(com.intellij.diagnostic.PerformanceWatcher) VirtualFile(com.intellij.openapi.vfs.VirtualFile) StartupManagerImpl(com.intellij.ide.startup.impl.StartupManagerImpl) CollectingContentIterator(com.intellij.openapi.roots.CollectingContentIterator)

Aggregations

PerformanceWatcher (com.intellij.diagnostic.PerformanceWatcher)1 StartupManagerImpl (com.intellij.ide.startup.impl.StartupManagerImpl)1 CollectingContentIterator (com.intellij.openapi.roots.CollectingContentIterator)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1