value patterns for attributes

This commit is contained in:
unknown
2009-10-12 16:47:53 +04:00
parent eecca23eff
commit f2e8ab9b2a
2 changed files with 18 additions and 0 deletions
@@ -66,4 +66,13 @@ public class XmlAttributeValuePattern extends XmlElementPattern<XmlAttributeValu
});
}
public XmlAttributeValuePattern withValue(final StringPattern valuePattern) {
return with(new PatternCondition<XmlAttributeValue>("withValue") {
@Override
public boolean accepts(@NotNull XmlAttributeValue xmlAttributeValue, ProcessingContext context) {
return valuePattern.accepts(xmlAttributeValue.getValue(), context);
}
});
}
}
@@ -75,6 +75,15 @@ public abstract class XmlNamedElementPattern<T extends XmlElement & PsiNamedElem
protected String getNamespace(XmlAttribute xmlAttribute) {
return xmlAttribute.getNamespace();
}
public XmlAttributePattern withValue(final StringPattern pattern) {
return with(new PatternCondition<XmlAttribute>("withValue") {
@Override
public boolean accepts(@NotNull XmlAttribute xmlAttribute, ProcessingContext context) {
return pattern.accepts(xmlAttribute.getValue(), context);
}
});
}
}