boolean (@NotNull PsiModifierListOwner listOwner, @NotNull String annotationFQN, @NotNull Processor<? super XmlTag> annotationTagProcessor) { try { final List<XmlFile> files = findExternalAnnotationsXmlFiles(listOwner); if (files == null) { notifyAfterAnnotationChanging(listOwner, annotationFQN, false); return false; } boolean processedAnything = false; for (final XmlFile file : files) { if (!file.isValid()) continue; final List<XmlTag> tagsToProcess = getTagsToProcess(file, listOwner, annotationFQN); if (tagsToProcess.isEmpty()) continue; processedAnything = true; if (ReadonlyStatusHandler.getInstance(myPsiManager.getProject()) .ensureFilesWritable(Collections.singletonList(file.getVirtualFile())).hasReadonlyFiles()) { continue; } WriteCommandAction.runWriteCommandAction(myPsiManager.getProject(), JavaBundle.message("update.external.annotations"), null, () -> { PsiDocumentManager.getInstance(myPsiManager.getProject()).commitAllDocuments(); try { for (XmlTag annotationTag : tagsToProcess) { annotationTagProcessor.process(annotationTag); } commitChanges(file); } catch (IncorrectOperationException e) { LOG.error(e); } }); } notifyAfterAnnotationChanging(listOwner, annotationFQN, processedAnything); return processedAnything; } finally { dropAnnotationsCache(); } }