CreateNSDeclarationIntentionFix: use correct file to avoid CCE in template languages

This commit is contained in:
peter
2018-11-29 18:18:41 +01:00
parent 42a4e1265c
commit e51e386df0
@@ -172,16 +172,12 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi
}
final int offset = editor.getCaretModel().getOffset();
final RangeMarker marker = editor.getDocument().createRangeMarker(offset, offset);
final XmlNamespaceHelper helper = XmlNamespaceHelper.getHelper(file);
helper.insertNamespaceDeclaration((XmlFile)file, editor, Collections.singleton(namespace), prefix,
new XmlNamespaceHelper.Runner<String, IncorrectOperationException>() {
@Override
public void run(final String param) throws IncorrectOperationException {
if (!namespace.isEmpty()) {
editor.getCaretModel().moveToOffset(marker.getStartOffset());
}
}
});
final XmlNamespaceHelper helper = XmlNamespaceHelper.getHelper(xmlFile);
helper.insertNamespaceDeclaration(xmlFile, editor, Collections.singleton(namespace), prefix, __ -> {
if (!namespace.isEmpty()) {
editor.getCaretModel().moveToOffset(marker.getStartOffset());
}
});
}
}, getTitle(),
this,