void () { var index = myStubUpdatingIndexStorage.getValue(); if (index == null) { // if indexes are not ready, then just increment global mod count and exit myPendingUpdates.clear(); registerModificationForAllElementTypes(); return; } while (!myPendingUpdates.isEmpty()) { VirtualFile file = myPendingUpdates.poll(); if (file.isDirectory()) continue; if (!file.isValid()) { // file is deleted or changed externally var beforeSuitableTypes = determinePreviousFileElementType(FileBasedIndex.getFileId(file), index); for (var type : beforeSuitableTypes) { registerModificationFor(type); } continue; } Project project = ((FileBasedIndexImpl)FileBasedIndex.getInstance()).findProjectForFileId(((VirtualFileWithId)file).getId()); if (project == null || project.isDisposed()) continue; IndexedFile indexedFile = new IndexedFileImpl(file, project); var current = determineCurrentFileElementType(indexedFile); var beforeSuitableTypes = determinePreviousFileElementType(FileBasedIndex.getFileId(file), index); if (beforeSuitableTypes.size() > 1) { for (var type : beforeSuitableTypes) { registerModificationFor(type); } if (current != null) registerModificationFor(current); continue; } var before = beforeSuitableTypes.isEmpty() ? null : beforeSuitableTypes.get(0); if (current != before) { if (current != null) registerModificationFor(current); if (before != null) registerModificationFor(before); } else { if (current != null) myProbablyExpensiveUpdates.add(new FileInfo(file, project, current)); } } }