Java Code Examples for de.espend.idea.php.annotation.extension.parameter.AnnotationPropertyParameter#getType()
The following examples show how to use
de.espend.idea.php.annotation.extension.parameter.AnnotationPropertyParameter#getType() .
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: DoctrineAnnotationTargetEntityReferences.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@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]; }
Example 2
Source File: IsGrantedAnnotationReferences.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@Nullable @Override public PsiReference[] getPropertyReferences(AnnotationPropertyParameter annotationPropertyParameter, PhpAnnotationReferenceProviderParameter phpAnnotationReferenceProviderParameter) { Project project = annotationPropertyParameter.getProject(); if(!Symfony2ProjectComponent.isEnabled(project) || !(annotationPropertyParameter.getElement() instanceof StringLiteralExpression) || !PhpElementsUtil.isEqualClassName(annotationPropertyParameter.getPhpClass(), IS_GRANTED_CLASS)) { return new PsiReference[0]; } if(annotationPropertyParameter.getType() != AnnotationPropertyParameter.Type.DEFAULT) { return new PsiReference[0]; } return new PsiReference[] { new VoterReference(((StringLiteralExpression) annotationPropertyParameter.getElement())) }; }
Example 3
Source File: TemplateAnnotationReferences.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@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]; }
Example 4
Source File: DoctrineAnnotationFieldTypeProvider.java From idea-php-annotation-plugin with MIT License | 6 votes |
@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()) }; }
Example 5
Source File: DoctrineAnnotationTypeProvider.java From idea-php-annotation-plugin with MIT License | 6 votes |
@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()) }; }
Example 6
Source File: AnnotationClassProvider.java From idea-php-annotation-plugin with MIT License | 6 votes |
@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()) }; }
Example 7
Source File: SymfonyAnnotationReferences.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@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]; }
Example 8
Source File: SymfonyCompletionProvider.java From idea-php-annotation-plugin with MIT License | 5 votes |
@Override public void getPropertyValueCompletions(AnnotationPropertyParameter parameter, AnnotationCompletionProviderParameter completion) { if(parameter.getType() != AnnotationPropertyParameter.Type.PROPERTY_ARRAY) { return; } if("methods".equals(parameter.getPropertyName()) && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Symfony\\Component\\Routing\\Annotation\\Route")) { for (String s : new String[]{"HEAD", "GET", "POST", "PUT", "PATCH", "DELETE", "PURGE", "OPTIONS", "TRACE", "CONNECT"}) { completion.getResult().addElement(LookupElementBuilder.create(s)); } } }
Example 9
Source File: DoctrineCustomIdGenerator.java From idea-php-annotation-plugin with MIT License | 5 votes |
@Override boolean supports(AnnotationPropertyParameter parameter) { return parameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE && "class".equals(parameter.getPropertyName()) && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Doctrine\\ORM\\Mapping\\CustomIdGenerator"); }
Example 10
Source File: DoctrineAnnotationFieldProvider.java From idea-php-annotation-plugin with MIT License | 5 votes |
@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) }; }
Example 11
Source File: EmbeddedClassCompletionProvider.java From idea-php-annotation-plugin with MIT License | 5 votes |
@Override boolean supports(AnnotationPropertyParameter parameter) { return parameter.getType() == AnnotationPropertyParameter.Type.PROPERTY_VALUE && "class".equals(parameter.getPropertyName()) && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Doctrine\\ORM\\Mapping\\Embedded"); }
Example 12
Source File: ConfigEntityTypeAnnotation.java From idea-php-drupal-symfony2-bridge with MIT License | 4 votes |
private boolean isSupported(@NotNull AnnotationPropertyParameter parameter) { return parameter.getType() != AnnotationPropertyParameter.Type.DEFAULT && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Drupal\\Core\\Entity\\Annotation\\ConfigEntityType"); }
Example 13
Source File: TranslationAnnotationReference.java From idea-php-drupal-symfony2-bridge with MIT License | 4 votes |
private boolean isSupported(@NotNull AnnotationPropertyParameter parameter) { return parameter.getType() == AnnotationPropertyParameter.Type.DEFAULT && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Drupal\\Core\\Annotation\\Translation"); }
Example 14
Source File: ContentEntityTypeAnnotation.java From idea-php-drupal-symfony2-bridge with MIT License | 4 votes |
private boolean isSupported(@NotNull AnnotationPropertyParameter parameter) { return parameter.getType() != AnnotationPropertyParameter.Type.DEFAULT && PhpLangUtil.equalsClassNames(StringUtils.stripStart(parameter.getPhpClass().getFQN(), "\\"), "Drupal\\Core\\Entity\\Annotation\\ContentEntityType"); }
Example 15
Source File: DoctrineAnnotationReferencedColumnReferences.java From idea-php-symfony2-plugin with MIT License | 4 votes |
@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]; }