void (@NotNull PsiModifierListOwner element, @NotNull String oldExternalName) { ThreadingAssertions.assertEventDispatchThread(); try { final List<XmlFile> files = findExternalAnnotationsXmlFiles(element); if (files == null) { return; } for (final XmlFile file : files) { if (!file.isValid()) { continue; } final XmlDocument document = file.getDocument(); if (document == null) { continue; } final XmlTag rootTag = document.getRootTag(); if (rootTag == null) { continue; } for (XmlTag tag : rootTag.getSubTags()) { String nameValue = tag.getAttributeValue("name"); String className = nameValue == null ? null : StringUtil.unescapeXmlEntities(nameValue); if (Comparing.strEqual(className, oldExternalName)) { WriteCommandAction.runWriteCommandAction( myPsiManager.getProject(), JavaBundle.message("update.external.annotations"), null, () -> { PsiDocumentManager.getInstance(myPsiManager.getProject()).commitAllDocuments(); try { String name = getExternalName(element); tag.setAttribute("name", name == null ? null : StringUtil.escapeXmlEntities(name)); commitChanges(file); } catch (IncorrectOperationException e) { LOG.error(e); } }, file); } } } } finally { dropAnnotationsCache(); } }