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


Java PhpAnnotationReferenceProviderParameter类代码示例

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


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

示例1: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter parameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) {
    if(!isSupported(parameter)) {
        return new PsiReference[0];
    }

    String propertyName = parameter.getPropertyName();

    if("admin_permission".equalsIgnoreCase(propertyName)) {
        String contents = getContents(parameter.getElement());
        if(StringUtils.isBlank(contents)) {
            return new PsiReference[0];
        }

        return new PsiReference[] {new ContentEntityTypeAnnotation.MyPermissionPsiPolyVariantReferenceBase(parameter.getElement(), contents)};
    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-drupal-symfony2-bridge,代码行数:21,代码来源:ConfigEntityTypeAnnotation.java

示例2: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) {

    if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(),
        "\\Doctrine\\ORM\\Mapping\\ManyToOne",
        "\\Doctrine\\ORM\\Mapping\\ManyToMany",
        "\\Doctrine\\ORM\\Mapping\\OneToOne",
        "\\Doctrine\\ORM\\Mapping\\OneToMany")
        )
    {
        return new PsiReference[0];
    }

    // @Foo(targetEntity="Foo\Class")
    if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE && "targetEntity".equals(annotationPropertyParameter.getPropertyName())) {
        return new PsiReference[]{ new EntityReference((StringLiteralExpression) annotationPropertyParameter.getElement(), true) };
    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:22,代码来源:DoctrineAnnotationTargetEntityReferences.java

示例3: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) {

    if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), TwigUtil.TEMPLATE_ANNOTATION_CLASS)) {
        return new PsiReference[0];
    }

    if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT) {
        // @Foo("template.html.twig")
        return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) };
    } else if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE || "template".equals(annotationPropertyParameter.getPropertyName())) {
        // @Foo(template="template.html.twig")
        return new PsiReference[]{ new TemplateReference((StringLiteralExpression) annotationPropertyParameter.getElement()) };
    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:19,代码来源:TemplateAnnotationReferences.java

示例4: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter parameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {
    if(!supports(parameter)) {
        return new PsiReference[0];
    }

    PsiElement element = parameter.getElement();
    if(!(element instanceof StringLiteralExpression) || StringUtils.isBlank(((StringLiteralExpression) element).getContents())) {
        return new PsiReference[0];
    }

    return new PsiReference[] {
        new PhpClassReference((StringLiteralExpression) element)
    };
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:17,代码来源:ClassCompletionProviderAbstract.java

示例5: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {

    if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_VALUE) {
        return null;
    }

    String propertyName = annotationPropertyParameter.getPropertyName();
    if(propertyName == null || !propertyName.equals("type")) {
        return null;
    }

    String presentableFQN = annotationPropertyParameter.getPhpClass().getPresentableFQN();
    if(!presentableFQN.startsWith("\\")) {
        presentableFQN = "\\" + presentableFQN;
    }

    if(!presentableFQN.equals("\\Doctrine\\ORM\\Mapping\\Column")) {
        return null;
    }

    return new PsiReference[] {
        new DoctrineColumnTypeReference((StringLiteralExpression) annotationPropertyParameter.getElement())
    };
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:27,代码来源:DoctrineAnnotationFieldTypeProvider.java

示例6: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {

    if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_VALUE) {
        return null;
    }

    String propertyName = annotationPropertyParameter.getPropertyName();
    if(propertyName == null || !propertyName.equals("repositoryClass")) {
        return null;
    }

    String presentableFQN = annotationPropertyParameter.getPhpClass().getPresentableFQN();
    if(!PhpLangUtil.equalsClassNames("Doctrine\\ORM\\Mapping\\Entity", presentableFQN)) {
        return null;
    }

    return new PsiReference[] {
        new DoctrineRepositoryReference((StringLiteralExpression) annotationPropertyParameter.getElement())
    };

}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:24,代码来源:DoctrineAnnotationTypeProvider.java

示例7: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {

    if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_VALUE) {
        return null;
    }

    String propertyName = annotationPropertyParameter.getPropertyName();
    if(propertyName == null || !propertyName.equals("targetEntity")) {
        return null;
    }

    return new PsiReference[] {
        new PhpClassReference((StringLiteralExpression) annotationPropertyParameter.getElement())
    };

}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:19,代码来源:AnnotationClassProvider.java

示例8: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) {

    if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression)) {
        return new PsiReference[0];
    }

    if("service".equals(annotationPropertyParameter.getPropertyName()) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Route")) {
        return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) };
    }

    // JMSDiExtraBundle; @TODO: provide config
    if((annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT || "id".equals(annotationPropertyParameter.getPropertyName())) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\JMS\\DiExtraBundle\\Annotation\\Service")) {
        return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) };
    }

    if((annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.DEFAULT) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\JMS\\DiExtraBundle\\Annotation\\Inject")) {
        return new PsiReference[]{ new ServiceReference((StringLiteralExpression) annotationPropertyParameter.getElement(), false) };
    }

    if("class".equals(annotationPropertyParameter.getPropertyName()) && PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ParamConverter")) {
        return new PsiReference[]{ new PhpClassReference((StringLiteralExpression) annotationPropertyParameter.getElement(), true).setUseClasses(true).setUseInterfaces(true) };
    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:28,代码来源:SymfonyAnnotationReferences.java

示例9: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter) {

    if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_VALUE) {
        return null;
    }

    String propertyName = annotationPropertyParameter.getPropertyName();
    if(propertyName == null || !(propertyName.equals("mappedBy") || propertyName.equals("inversedBy"))) {
        return null;
    }

    PsiElement parent = annotationPropertyParameter.getElement().getParent();

    StringLiteralExpression targetEntity = PhpElementsUtil.getChildrenOnPatternMatch(parent, AnnotationPattern.getPropertyIdentifierValue("targetEntity"));
    if(targetEntity == null) {
        return null;
    }

    PhpClass phpClass = PhpElementsUtil.getClassInsideAnnotation(targetEntity);
    if(phpClass == null) {
        return null;
    }

    return new PsiReference[] {
        new DoctrinePhpClassFieldReference((StringLiteralExpression) annotationPropertyParameter.getElement(), phpClass)
    };

}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:31,代码来源:DoctrineAnnotationFieldProvider.java

示例10: addPsiReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
private PsiReference[] addPsiReferences(PsiElement psiElement, ProcessingContext processingContext, AnnotationPropertyParameter annotationPropertyParameter) {
    ArrayList<PsiReference> psiReferences = new ArrayList<>();

    PhpAnnotationReferenceProviderParameter referencesByElementParameter = new PhpAnnotationReferenceProviderParameter(psiElement, processingContext);

    for(PhpAnnotationReferenceProvider phpAnnotationExtension : AnnotationUtil.EXTENSION_POINT_REFERENCES.getExtensions()) {
        PsiReference[] references = phpAnnotationExtension.getPropertyReferences(annotationPropertyParameter, referencesByElementParameter);
        if(references != null && references.length > 0) {
            psiReferences.addAll(Arrays.asList(references));
        }
    }

    return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:15,代码来源:AnnotationPropertyValueReferenceContributor.java

示例11: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
@Override
public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) {

    PsiElement element = annotationPropertyParameter.getElement();
    if(!Symfony2ProjectComponent.isEnabled(annotationPropertyParameter.getProject()) ||
        !(element instanceof StringLiteralExpression) ||
        !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), "\\Doctrine\\ORM\\Mapping\\JoinColumn")
        )
    {
        return new PsiReference[0];
    }

    // @Foo(targetEntity="Foo\Class")
    if(annotationPropertyParameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE && "referencedColumnName".equals(annotationPropertyParameter.getPropertyName())) {

        PhpDocComment phpDocComment = PsiTreeUtil.getParentOfType(element, PhpDocComment.class);
        if(phpDocComment != null) {
            PhpDocCommentAnnotation phpDocCommentAnnotationContainer = AnnotationUtil.getPhpDocCommentAnnotationContainer(phpDocComment);

            if(phpDocCommentAnnotationContainer != null) {

                PhpDocTagAnnotation phpDocTagAnnotation = phpDocCommentAnnotationContainer.getFirstPhpDocBlock(
                    "\\Doctrine\\ORM\\Mapping\\ManyToOne",
                    "\\Doctrine\\ORM\\Mapping\\ManyToMany",
                    "\\Doctrine\\ORM\\Mapping\\OneToOne",
                    "\\Doctrine\\ORM\\Mapping\\OneToMany"
                );

                if(phpDocTagAnnotation != null) {

                    PhpPsiElement phpDocAttrList = phpDocTagAnnotation.getPhpDocTag().getFirstPsiChild();

                    // @TODO: remove nested on Annotation plugin update
                    if(phpDocAttrList != null) {
                        if(phpDocAttrList.getNode().getElementType() == PhpDocElementTypes.phpDocAttributeList) {
                            PhpPsiElement phpPsiElement = phpDocAttrList.getFirstPsiChild();
                            if(phpPsiElement instanceof StringLiteralExpression) {
                                PhpClass phpClass = de.espend.idea.php.annotation.util.PhpElementsUtil.getClassInsideAnnotation(((StringLiteralExpression) phpPsiElement));
                                if(phpClass != null) {
                                    Collection<DoctrineModelField> lists = EntityHelper.getModelFields(phpClass);
                                    if(lists.size() > 0) {
                                        return new PsiReference[] {
                                            new EntityReference((StringLiteralExpression) element, lists)
                                        };
                                    }
                                }
                            }
                        }
                    }


                }

            }

        }

    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:63,代码来源:DoctrineAnnotationReferencedColumnReferences.java

示例12: getPropertyReferences

import de.espend.idea.php.annotation.extension.parameter.PhpAnnotationReferenceProviderParameter; //导入依赖的package包/类
@Nullable
PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter referencesByElementParameter);
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:3,代码来源:PhpAnnotationReferenceProvider.java


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