Search in sources :

Example 1 with StringPattern

use of com.intellij.patterns.StringPattern in project intellij-community by JetBrains.

the class XmlUtil method registerXmlTagReferenceProvider.

public static void registerXmlTagReferenceProvider(PsiReferenceRegistrar registrar, @NonNls String[] names, @Nullable ElementFilter elementFilter, boolean caseSensitive, @NotNull PsiReferenceProvider provider) {
    if (names == null) {
        registrar.registerReferenceProvider(XmlPatterns.xmlTag().and(new FilterPattern(elementFilter)), provider, PsiReferenceRegistrar.DEFAULT_PRIORITY);
        return;
    }
    final StringPattern namePattern = caseSensitive ? StandardPatterns.string().oneOf(names) : StandardPatterns.string().oneOfIgnoreCase(names);
    registrar.registerReferenceProvider(XmlPatterns.xmlTag().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider, PsiReferenceRegistrar.DEFAULT_PRIORITY);
}
Also used : FilterPattern(com.intellij.psi.filters.position.FilterPattern) StringPattern(com.intellij.patterns.StringPattern)

Example 2 with StringPattern

use of com.intellij.patterns.StringPattern in project intellij-community by JetBrains.

the class XmlUtil method registerXmlAttributeValueReferenceProvider.

public static void registerXmlAttributeValueReferenceProvider(PsiReferenceRegistrar registrar, @Nullable @NonNls String[] attributeNames, @Nullable ElementFilter elementFilter, boolean caseSensitive, @NotNull PsiReferenceProvider provider, double priority) {
    if (attributeNames == null) {
        registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().and(new FilterPattern(elementFilter)), provider, priority);
        return;
    }
    final StringPattern namePattern = caseSensitive ? StandardPatterns.string().oneOf(attributeNames) : StandardPatterns.string().oneOfIgnoreCase(attributeNames);
    registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName(namePattern).and(new FilterPattern(elementFilter)), provider, priority);
}
Also used : FilterPattern(com.intellij.psi.filters.position.FilterPattern) StringPattern(com.intellij.patterns.StringPattern)

Aggregations

StringPattern (com.intellij.patterns.StringPattern)2 FilterPattern (com.intellij.psi.filters.position.FilterPattern)2