Java Code Examples for com.intellij.psi.PsiReferenceRegistrar#registerReferenceProvider()

The following examples show how to use com.intellij.psi.PsiReferenceRegistrar#registerReferenceProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YiiReferenceContributor.java    From yiistorm with MIT License 6 votes vote down vote up
@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());
}
 
Example 2
Source File: BuckIdentifierReferenceContributor.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {

  registrar.registerReferenceProvider(
      PlatformPatterns.psiElement(BuckIdentifier.class),
      new PsiReferenceProvider() {
        @NotNull
        @Override
        public PsiReference[] getReferencesByElement(
            @NotNull PsiElement element, @NotNull ProcessingContext context) {
          if (element instanceof BuckIdentifier) {
            BuckIdentifier identifier = (BuckIdentifier) element;
            return new PsiReference[] {new BuckIdentifierReference(identifier)};
          } else {
            return new PsiReference[0];
          }
        }
      });
}
 
Example 3
Source File: CamelBeanInjectReferenceContributor.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    PsiJavaElementPattern.Capture<PsiLiteralExpression> pattern = PsiJavaPatterns
            .literalExpression()
            .insideAnnotationParam(CamelIdeaUtils.BEAN_INJECT_ANNOTATION);

    registrar.registerReferenceProvider(pattern, new CamelPsiReferenceProvider() {
        @Override
        protected PsiReference[] getCamelReferencesByElement(PsiElement element, ProcessingContext context) {
            PsiNameValuePair param = PsiTreeUtil.getParentOfType(element, PsiNameValuePair.class);
            if (param != null && param.getAttributeName().equals("value")) {
                String value = param.getLiteralValue();
                if (value != null) {
                    return new PsiReference[] {new BeanReference(element, value)};
                }
            }
            return new PsiReference[0];
        }
    });
}
 
Example 4
Source File: SoyReferenceContributor.java    From bamboo-soy with Apache License 2.0 5 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(
      PlatformPatterns.or(
          instanceOf(IdentifierMixin.class),
          instanceOf(ParamIdentifierMixin.class)),
      PSI_REFERENCE_PROVIDER);
}
 
Example 5
Source File: HaskellReferenceContributor.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
    PsiElementPattern.Capture<PsiNamedElement> variableCapture =
            PlatformPatterns.psiElement(PsiNamedElement.class).withParent(HaskellVars.class).withParent(HaskellGendecl.class).withLanguage(HaskellLanguage.INSTANCE);
    registrar.registerReferenceProvider(variableCapture,
            new HaskellReferenceProvider());
}
 
Example 6
Source File: PantsReferenceContributor.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(
    psiElement(PyStringLiteralExpression.class),
    new PantsTargetPathReferenceProvider()
  );
}
 
Example 7
Source File: JavaClassReferenceContributor.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
  JavaClassReferenceProvider provider = new JavaClassReferenceProvider();
  provider.setOption(JavaClassReferenceProvider.CLASS_KIND, ClassKind.CLASS);
  registrar.registerReferenceProvider(
      JavaClassQualifiedNameReference.PATTERN, new JavaClassReferenceProvider());
}
 
Example 8
Source File: YamlReferenceContributor.java    From intellij-swagger with MIT License 5 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(localDefinitionsPattern(), createLocalReferenceProvider());
  registrar.registerReferenceProvider(
      mappingSchemaNamePattern(), createSchemaNameReferenceProvider());

  registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
}
 
Example 9
Source File: JsonReferenceContributor.java    From intellij-swagger with MIT License 5 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(localDefinitionsPattern(), createLocalReferenceProvider());
  registrar.registerReferenceProvider(
      mappingSchemaNamePattern(), createSchemaNameReferenceProvider());

  registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
}
 
Example 10
Source File: NodeTypeReferenceContributor.java    From intellij-neos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(
            PlatformPatterns.psiElement(YAMLKeyValue.class),
            new NodeTypeReferenceProvider()
    );
}
 
Example 11
Source File: BlueprintReferenceContributor.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlAttributeValue.class), new BlueprintJavaClassReferenceProvider());
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlAttributeValue.class), new BeanReferenceProvider());
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlAttributeValue.class), new BlueprintPropertyNameReferenceProvider());
}
 
Example 12
Source File: DirectEndpointReferenceContributor.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    CamelEndpointPsiReferenceProvider provider = createProvider();
    registrar.registerReferenceProvider(PsiJavaPatterns.literalExpression(), provider);
    registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue("uri"), provider);
}
 
Example 13
Source File: MMReferenceContributor.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void registerReferenceProviders(@Nonnull final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiExtraFile.class), new PsiExtraFileReferenceProvider());
}
 
Example 14
Source File: IncludeReferenceContributor.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(psiElement()
                    .withText(string().startsWith(INCLUDE_TAG))
            , new IncludeFilePathReferenceProvider());
}
 
Example 15
Source File: RequirejsPsiReferenceContributor.java    From WebStormRequireJsPlugin with MIT License 4 votes vote down vote up
@Override
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
    RequirejsPsiReferenceProvider provider = new RequirejsPsiReferenceProvider();

    psiReferenceRegistrar.registerReferenceProvider(StandardPatterns.instanceOf(JSLiteralExpression.class), provider);
}
 
Example 16
Source File: I18nReferenceContributor.java    From yiistorm with MIT License 4 votes vote down vote up
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(categoryPattern(), new I18nReferenceProvider());

}
 
Example 17
Source File: NASMReferenceContributor.java    From JetBrains-NASM-Language with MIT License 4 votes vote down vote up
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(NASMNamedElement.class),
                                        new NASMReferenceProvider());
}
 
Example 18
Source File: CommentsReferenceContributor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void registerReferenceProviders(@Nonnull PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiComment.class), COMMENTS_REFERENCE_PROVIDER_TYPE.getProvider());
}
 
Example 19
Source File: YiiApplicationReferenceContributor.java    From yiistorm with MIT License 3 votes vote down vote up
@Override
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {

    psiReferenceRegistrar.registerReferenceProvider(PhpPatterns.psiElement(PhpElementTypes.PARAMETER),
            new PhpStringLiteralExpressionReference(ParameterReference.class)
                    .addCall("Yii", "getParameter")
    );


}