Java 类com.intellij.psi.filters.position.PatternFilter 实例源码

项目:intellij-ce-playground    文件:RncCompletionData.java   
public RncCompletionData() {
  declareFinalScope(RncElement.class);

  final CompletionVariant variant = new CompletionVariant(new AndFilter(
          new ElementFilter() {
            @Override
            public boolean isAcceptable(Object element, PsiElement context) {
              return true;
            }

            @Override
            public boolean isClassAcceptable(Class hintClass) {
              return PsiElement.class.isAssignableFrom(hintClass);
            }
          },
          new PatternFilter(or(
                  psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)),
                  not(
                          or(
                                  psiElement().inside(psiElement(RncTokenTypes.LITERAL)),
                                  psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS))
                          )
                  )
          ))
  ));

  variant.includeScopeClass(LeafPsiElement.class, true);

  variant.addCompletion(new KeywordGetter());

  registerVariant(variant);
}
项目:intellij-ce-playground    文件:RelaxNGReferenceContributor.java   
@Override
  public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[]{
      "name"
    }, new PatternFilter(xmlAttributeValue().withParent(NAME_PATTERN)), true, new PrefixReferenceProvider());

//    final XmlAttributeValuePattern id = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_REF_TYPE);
//    final XmlAttributeValuePattern idref = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_TYPE);
//    registry.registerXmlAttributeValueReferenceProvider(null, new PatternFilter(or(id, idref)), false, new IdRefProvider());

  }
项目:tools-idea    文件:RncCompletionData.java   
public RncCompletionData() {
  declareFinalScope(RncElement.class);

  final CompletionVariant variant = new CompletionVariant(new AndFilter(
          new ElementFilter() {
            public boolean isAcceptable(Object element, PsiElement context) {
              return true;
            }

            public boolean isClassAcceptable(Class hintClass) {
              return PsiElement.class.isAssignableFrom(hintClass);
            }
          },
          new PatternFilter(or(
                  psiElement().afterLeaf(psiElement(RncTokenTypes.KEYWORD_DEFAULT)),
                  not(
                          or(
                                  psiElement().inside(psiElement(RncTokenTypes.LITERAL)),
                                  psiElement().afterLeaf(psiElement().withElementType(RncTokenTypes.KEYWORDS))
                          )
                  )
          ))
  ));

  variant.includeScopeClass(LeafPsiElement.class, true);

  variant.addCompletion(new KeywordGetter());

  registerVariant(variant);
}
项目:tools-idea    文件:RelaxNGReferenceContributor.java   
@Override
  public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
    XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[]{
      "name"
    }, new PatternFilter(xmlAttributeValue().withParent(NAME_PATTERN)), true, new PrefixReferenceProvider());

//    final XmlAttributeValuePattern id = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_REF_TYPE);
//    final XmlAttributeValuePattern idref = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_TYPE);
//    registry.registerXmlAttributeValueReferenceProvider(null, new PatternFilter(or(id, idref)), false, new IdRefProvider());

  }
项目:consulo-xml    文件:RelaxNGReferenceContributor.java   
@Override
  public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    XmlUtil.registerXmlAttributeValueReferenceProvider(registrar, new String[]{
      "name"
    }, new PatternFilter(xmlAttributeValue().withParent(NAME_PATTERN)), true, new PrefixReferenceProvider());

//    final XmlAttributeValuePattern id = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_REF_TYPE);
//    final XmlAttributeValuePattern idref = xmlAttributeValue().withParent(xmlAttribute()).with(IdRefProvider.HAS_ID_TYPE);
//    registry.registerXmlAttributeValueReferenceProvider(null, new PatternFilter(or(id, idref)), false, new IdRefProvider());

  }
项目:intellij-ce-playground    文件:MetaRegistry.java   
@Override
public <T extends PsiMetaData> void registerMetaData(ElementPattern<?> pattern, Class<T> metadataDescriptorClass) {
  addMetadataBinding(new PatternFilter(pattern), metadataDescriptorClass);
}
项目:intellij-ce-playground    文件:CompletionVariant.java   
public CompletionVariant(Class scopeClass, ElementPattern position){
  this(scopeClass, new PatternFilter(position));
}
项目:intellij-ce-playground    文件:CompletionVariant.java   
public CompletionVariant(ElementPattern<? extends PsiElement> position){
  this(new PatternFilter(position));
}
项目:tools-idea    文件:MetaRegistry.java   
@Override
public <T extends PsiMetaData> void registerMetaData(ElementPattern<?> pattern, Class<T> metadataDescriptorClass) {
  addMetadataBinding(new PatternFilter(pattern), metadataDescriptorClass);
}
项目:tools-idea    文件:CompletionVariant.java   
public CompletionVariant(Class scopeClass, ElementPattern position){
  this(scopeClass, new PatternFilter(position));
}
项目:tools-idea    文件:CompletionVariant.java   
public CompletionVariant(ElementPattern<? extends PsiElement> position){
  this(new PatternFilter(position));
}
项目:consulo    文件:MetaRegistry.java   
@Override
public <T extends PsiMetaData> void registerMetaData(ElementPattern<?> pattern, Class<T> metadataDescriptorClass) {
  addMetadataBinding(new PatternFilter(pattern), metadataDescriptorClass);
}