void () { myUpdateQueue.cancelAllRequests(); myUpdateQueue.addRequest(() -> { boolean[] needUpdateUI = {false}; Processor<? super InspectionTreeNode> nodeProcessor = null; if (myNeedReValidate.compareAndSet(true, false)) { nodeProcessor = (node) -> { if (myView.isDisposed()) { return false; } if (node instanceof SuppressableInspectionTreeNode) { RefElement element = ObjectUtils.tryCast(((SuppressableInspectionTreeNode)node).getElement(), RefElement.class); if (element != null) { SmartPsiElementPointer pointer = element.getPointer(); if (pointer != null) { VirtualFile vFile = pointer.getVirtualFile(); if (vFile == null || !vFile.isValid()) { ((SuppressableInspectionTreeNode)node).dropCaches(); if (!needUpdateUI[0]) { needUpdateUI[0] = true; } } } } } return true; }; } Set<VirtualFile> filesToCheck; synchronized (myFilesToProcess) { filesToCheck = new HashSet<>(myFilesToProcess); myFilesToProcess.clear(); } Set<VirtualFile> unPresentFiles = new HashSet<>(filesToCheck); if (!filesToCheck.isEmpty()) { Processor<InspectionTreeNode> fileCheckProcessor = (node) -> { if (myView.isDisposed()) { return false; } if (node instanceof SuppressableInspectionTreeNode) { RefElement element = ObjectUtils.tryCast(((SuppressableInspectionTreeNode)node).getElement(), RefElement.class); if (element != null) { SmartPsiElementPointer pointer = element.getPointer(); if (pointer != null) { VirtualFile vFile = ReadAction.compute(() -> pointer.getVirtualFile()); if (filesToCheck.contains(vFile)) { unPresentFiles.remove(vFile); ((SuppressableInspectionTreeNode)node).dropCaches(); if (!needUpdateUI[0]) { needUpdateUI[0] = true; } } } } } return true; }; nodeProcessor = CompositeProcessor.combine(fileCheckProcessor, nodeProcessor); } myView.getTree().getInspectionTreeModel().traverse(myView.getTree().getInspectionTreeModel().getRoot()).processEach(nodeProcessor); if (!unPresentFiles.isEmpty()) { myUnPresentEditedFiles.addAll(unPresentFiles); } if (needUpdateUI[0] && !myAlarm.isDisposed()) { myAlarm.cancelAllRequests(); //TODO replace with more accurate myAlarm.addRequest(() -> myView.getTree().getInspectionTreeModel().reload(), 100, ModalityState.nonModal()); } }, 200); }