当前位置: 首页>>代码示例>>Java>>正文


Java PsiReferenceRegistrar类代码示例

本文整理汇总了Java中com.intellij.psi.PsiReferenceRegistrar的典型用法代码示例。如果您正苦于以下问题:Java PsiReferenceRegistrar类的具体用法?Java PsiReferenceRegistrar怎么用?Java PsiReferenceRegistrar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiReferenceRegistrar类属于com.intellij.psi包,在下文中一共展示了PsiReferenceRegistrar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(YAMLScalar.class),
            new PsiReferenceProvider() {
                @NotNull
                @Override
                public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
                    if (isConfigFile(element)) {
                        String valueText = ((YAMLScalar) element).getTextValue();
                        List<MacroResolver.Match> matches = new MacroResolver().resolve(valueText);
                        List<PsiReference> references = new ArrayList<>();
                        matches.stream()
                                .filter(match -> !match.isEscaped())
                                .map(match -> resolvePsiReferences(element, match.getReference(), (element instanceof YAMLQuotedText ? 1 : 0) + match.getStartPos()))
                                .forEach(references::addAll);
                        return references.toArray(new PsiReference[references.size()]);
                    }
                    return PsiReference.EMPTY_ARRAY;
                }
            });
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:22,代码来源:CoffigYamlReferenceContributor.java

示例2: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),
            new PsiReferenceProvider() {
                @NotNull
                @Override
                public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
                    if (isLiteralOfConfigurationAnnotation(element) || isCoffigMethod(element)) {
                        PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
                        String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
                        List<PsiReference> psiReferences = resolvePsiReferences(element, value, 1);
                        return psiReferences.toArray(new PsiReference[psiReferences.size()]);
                    }
                    return PsiReference.EMPTY_ARRAY;
                }
            });
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:18,代码来源:CoffigJavaReferenceContributor.java

示例3: PsiReferenceRegistrarImpl

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
public PsiReferenceRegistrarImpl(final Language language) {
  myBindingCache = new ConcurrentFactoryMap<Class, ProviderBinding[]>() {
    @Nullable
    @Override
    protected ProviderBinding[] create(Class key) {
      List<ProviderBinding> result = ContainerUtil.newSmartList();
      for (Class<?> bindingClass : myBindingsMap.keySet()) {
        if (bindingClass.isAssignableFrom(key)) {
          result.add(myBindingsMap.get(bindingClass));
        }
      }
      for (Class<?> bindingClass : myNamedBindingsMap.keySet()) {
        if (bindingClass.isAssignableFrom(key)) {
          result.add(myNamedBindingsMap.get(bindingClass));
        }
      }
      if (language != Language.ANY) {
        final PsiReferenceRegistrar anyRegistrar = ReferenceProvidersRegistry.getInstance().getRegistrar(Language.ANY);
        Collections.addAll(result, ((PsiReferenceRegistrarImpl)anyRegistrar).myBindingCache.get(key));
      }
      //noinspection unchecked
      return result.toArray(new ProviderBinding[result.size()]);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PsiReferenceRegistrarImpl.java

示例4: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar psiReferenceRegistrar) {
    // <service class="\Namespace\Interface" />
    XmlAttributeValuePattern serviceTag = XmlHelper.getTagAttributeValuePattern(
        XmlHelper.SERVICE_TAG,
        XmlHelper.CLASS_ATTRIBUTE
    );
    psiReferenceRegistrar.registerReferenceProvider(
        serviceTag,
        new XmlReferenceProvider(new ReferenceResultsFiller[]{
            InterfacesResultsFiller.INSTANCE
        }));

    // <service method="MethodName"/>
    XmlAttributeValuePattern methodAttribute = XmlHelper.getMethodAttributePattern();
    psiReferenceRegistrar.registerReferenceProvider(
        methodAttribute,
        new XmlReferenceProvider(new ReferenceResultsFiller[]{
            new ServiceMethodResultsFiller()
        })
    );
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:23,代码来源:ServiceReferenceContributor.java

示例5: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
  // references from same language
  registrar.registerReferenceProvider(
    PlatformPatterns.psiElement(KUserId.class).withLanguage(KLanguage.INSTANCE),
    new PsiReferenceProvider() {
      @NotNull
      @Override
      public PsiReference[] getReferencesByElement(PsiElement element, ProcessingContext context) {
        if (element instanceof KUserId) {
          final String key = element.getText();
          return new PsiReference[]{new KReference((KUserId)element, new TextRange(0, key.length()))};
        }
        return new PsiReference[0];
      }
    }
  );
}
 
开发者ID:a2ndrade,项目名称:k-intellij-plugin,代码行数:19,代码来源:KReferenceContributor.java

示例6: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
  final XmlFilePattern.Capture filePattern = xmlFile().withName(string().oneOf("plugin.xml", "feature.xml", "site.xml"));

  registrar.registerReferenceProvider(
      XmlPatterns.xmlAttributeValue().inFile(filePattern).withValue(string().startsWith("%")),
      new PluginXmlPropertiesReferenceProvider()
  );
  registrar.registerReferenceProvider(
      PlatformPatterns.psiElement(XmlToken.class).inside(
          xmlText().inside(
              xmlTag().inFile(filePattern)
          )
      ).withText(string().startsWith("%")),
      new PluginXmlPropertiesReferenceProvider()
  );
}
 
开发者ID:VladRassokhin,项目名称:eclipse-from-idea-development,代码行数:18,代码来源:PluginXmlPropertiesProvider.java

示例7: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(StandardPatterns.instanceOf(PhpPsiElement.class), new YiiPsiReferenceProvider());
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(PsiElement.class).withParent(isParamListInMethodWithName(".+?widget\\(.+"))
            , new WidgetCallReferenceProvider());
    //View-to-view
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(PhpPsiElement.class)
                    .withParent(isParamListInMethodWithName(".+?render(Partial)*\\(.+"))
                    .andNot(inFile(PlatformPatterns.string().endsWith("Controller.php")))
            , new ViewRenderViewReferenceProvider());
    //Controller-to-view
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(PhpPsiElement.class)
                    .withParent(isParamListInMethodWithName("(?sim).+?render(Partial)*\\(.+"))
                    .and(inFile(PlatformPatterns.string().endsWith("Controller.php")))
            , new ControllerRenderViewReferenceProvider());
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:20,代码来源:YiiReferenceContributor.java

示例8: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
public void registerReferenceProviders(PsiReferenceRegistrar registrar)
{
	registrar.registerReferenceProvider(psiElement(XmlAttributeValue.class).withParent(xmlAttribute().withLocalName("name", "href", "mode", "elements", "exclude-result-prefixes",
			"extension-element-prefixes", "stylesheet-prefix").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))), new XsltReferenceProvider());

	registrar.registerReferenceProvider(xmlAttributeValue().withValue(string().matches("[^()]+")).withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))),
			SchemaTypeProvider.INSTANCE);

	registrar.registerReferenceProvider(xmlAttributeValue().withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))).withValue(string().contains(":")),
			new PsiReferenceProvider()
	{
		@NotNull
		@Override
		public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context)
		{
			return new PsiReference[]{new NamespacePrefixReference(element)};
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-xslt,代码行数:20,代码来源:XsltReferenceContributor.java

示例9: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    // ->dispatch("event_name")
    registrar.registerReferenceProvider(
            PhpPatternsHelper.STRING_METHOD_ARGUMENT,
            new EventDispatchReferenceProvider()
    );
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:9,代码来源:PhpReferenceContributor.java

示例10: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("action", "bean", ITEMS_TYPE_FILE_NAME),
        new HybrisSpringProcessReferenceProvider()
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:8,代码来源:HybrisSpringProcessReferenceContributor.java

示例11: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("transition", "to", ITEMS_TYPE_FILE_NAME),
        new HybrisTransitionProcessReferenceProvider()
    );
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("then", ITEMS_TYPE_FILE_NAME),
        new HybrisTransitionProcessReferenceProvider()
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:12,代码来源:HybrisProcessReferenceContributor.java

示例12: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("enumtype", "code", ITEMS_TYPE_FILE_NAME),
        new HybrisEnumItemReferenceProvider()
    );
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("value", "code", ITEMS_TYPE_FILE_NAME).inside(insideTagPattern("enumtype")),
        new HybrisEnumLiteralItemReferenceProvider()
    );
    registrar.registerReferenceProvider(
        tagAttributeValuePattern("itemtype", "code", ITEMS_TYPE_FILE_NAME),
        new HybrisModelItemReferenceProvider()
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:16,代码来源:HybrisItemXmlReferenceContributor.java

示例13: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(YAMLKeyValue.class),
            new NodeTypeReferenceProvider()
    );
}
 
开发者ID:cvette,项目名称:intellij-neos,代码行数:8,代码来源:NodeTypeReferenceContributor.java

示例14: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_SCHEMAS_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_RESPONSES_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_PARAMETERS_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_EXAMPLES_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_REQUEST_BODIES_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_HEADERS_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_LINKS_PREFIX), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_CALLBACKS_PREFIX), createLocalReferenceProvider());

    registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
    registrar.registerReferenceProvider(componentFileReferencePattern(), createComponentFileReferenceProvider());
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:15,代码来源:OpenApiYamlReferenceContributor.java

示例15: registerReferenceProviders

import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(localDefinitionsPattern(), createLocalReferenceProvider());

    registrar.registerReferenceProvider(externalDefinitionsInRootPattern(), createExternalDefinitionsInRootReferenceProvider());
    registrar.registerReferenceProvider(externalDefinitionsNotInRootPattern(), createExternalDefinitionsNotInRootReferenceProvider());

    registrar.registerReferenceProvider(localParametersPattern(), createLocalReferenceProvider());
    registrar.registerReferenceProvider(localResponsesPattern(), createLocalReferenceProvider());

    registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
    registrar.registerReferenceProvider(tagsPattern(), createTagsReferenceProvider());
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:14,代码来源:SwaggerYamlReferenceContributor.java


注:本文中的com.intellij.psi.PsiReferenceRegistrar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。