mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
IDEA-79562: "Optimize Imports" auto-removes XML namespace declarations used only in element values
This commit is contained in:
@@ -192,6 +192,8 @@ public class XmlRefCountHolder {
|
||||
@Override
|
||||
public void visitXmlTag(XmlTag tag) {
|
||||
myHolder.addUsedPrefix(tag.getNamespacePrefix());
|
||||
String text = tag.getValue().getTrimmedText();
|
||||
detectPrefix(text);
|
||||
super.visitXmlTag(tag);
|
||||
}
|
||||
|
||||
@@ -242,13 +244,17 @@ public class XmlRefCountHolder {
|
||||
}
|
||||
|
||||
String s = value.getValue();
|
||||
detectPrefix(s);
|
||||
super.visitXmlAttributeValue(value);
|
||||
}
|
||||
|
||||
private void detectPrefix(String s) {
|
||||
if (s != null) {
|
||||
int pos = s.indexOf(':');
|
||||
if (pos > 0) {
|
||||
myHolder.addUsedPrefix(s.substring(0, pos));
|
||||
}
|
||||
}
|
||||
super.visitXmlAttributeValue(value);
|
||||
}
|
||||
|
||||
private void updateMap(@NotNull final XmlAttribute attribute, @NotNull final XmlAttributeValue value, final boolean soft) {
|
||||
|
||||
Reference in New Issue
Block a user