From 22745c7bb44546e8bf710c7ca42b31afb61e5fe4 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Tue, 28 Aug 2012 13:28:54 +0400 Subject: [PATCH] Replaced duplicate code with method invocation. --- .../codeInsight/ExternalAnnotationsManagerImpl.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java index e4aafeb0c490..c4764b2bb085 100644 --- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java @@ -285,13 +285,10 @@ public class ExternalAnnotationsManagerImpl extends BaseExternalAnnotationsManag final XmlFile[] annotationsXml = new XmlFile[1]; List xmlFiles = findExternalAnnotationsXmlFiles(listOwner); if (xmlFiles != null) { - for (XmlFile xmlFile : xmlFiles) { - final VirtualFile vXmlFile = xmlFile.getVirtualFile(); - assert vXmlFile != null; - if (VfsUtilCore.isAncestor(root, vXmlFile, false)) { - annotationsXml[0] = xmlFile; - if (!CodeInsightUtilBase.preparePsiElementForWrite(xmlFile)) return; - } + annotationsXml[0] = findXmlFileInRoot(xmlFiles, root); + if (annotationsXml[0] != null && !CodeInsightUtilBase.preparePsiElementForWrite(annotationsXml[0])) { + notifyAfterAnnotationChanging(listOwner, annotationFQName, false); + return; } } else { xmlFiles = new ArrayList();