cleanup
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Tue, 1 Sep 2015 14:50:16 +0000 (17:50 +0300)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Thu, 3 Sep 2015 12:55:13 +0000 (15:55 +0300)
xml/impl/src/com/intellij/refactoring/rename/RenameXmlAttributeProcessor.java

index 3876031f1e48c617998103e931bb3f1c9fe143bf..80c12d5673945e6fe7e13afb271f00ce2500b12d 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.rename;
 
+import com.intellij.lang.xml.XMLLanguage;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFileFactory;
@@ -78,8 +79,9 @@ public class RenameXmlAttributeProcessor extends RenamePsiElementProcessor {
 
     PsiManager psiManager = value.getManager();
     LOG.assertTrue(psiManager != null);
-    XmlFile file = (XmlFile)PsiFileFactory.getInstance(psiManager.getProject()).createFileFromText("dummy.xml", "<a attr=\"" + newName + "\"/>");
-    final PsiElement element = value.replace(file.getDocument().getRootTag().getAttributes()[0].getValueElement());
+    XmlFile file = (XmlFile)PsiFileFactory.getInstance(psiManager.getProject()).createFileFromText("dummy.xml", XMLLanguage.INSTANCE, "<a attr=\"" + newName + "\"/>");
+    @SuppressWarnings("ConstantConditions")
+    PsiElement element = value.replace(file.getRootTag().getAttributes()[0].getValueElement());
     if (listener != null) {
       listener.elementRenamed(element);
     }