Java Code Examples for fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getServiceDefinitionClassFromTagMethod()

The following examples show how to use fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getServiceDefinitionClassFromTagMethod() . 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: YamlCompletionContributor.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {
    if(!Symfony2ProjectComponent.isEnabled(completionParameters.getPosition())) {
        return;
    }

    PsiElement psiElement = completionParameters.getPosition();

    String serviceDefinitionClassFromTagMethod = YamlHelper.getServiceDefinitionClassFromTagMethod(psiElement);

    if(serviceDefinitionClassFromTagMethod != null) {
        PhpClass phpClass = ServiceUtil.getResolvedClassDefinition(psiElement.getProject(), serviceDefinitionClassFromTagMethod);
        if(phpClass != null) {
            PhpElementsUtil.addClassPublicMethodCompletion(completionResultSet, phpClass);
        }
    }
}
 
Example 2
Source File: YamlGoToDeclarationHandler.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
@NotNull
private Collection<PsiElement> getTagMethodGoto(@NotNull PsiElement psiElement) {
    String methodName = PsiElementUtils.trimQuote(psiElement.getText());
    if(StringUtils.isBlank(methodName)) {
        return Collections.emptyList();
    }

    String classValue = YamlHelper.getServiceDefinitionClassFromTagMethod(psiElement);
    if(classValue == null) {
        return Collections.emptyList();
    }

    PhpClass phpClass = ServiceUtil.getResolvedClassDefinition(psiElement.getProject(), classValue);
    if(phpClass == null) {
        return Collections.emptyList();
    }

    Method method = phpClass.findMethodByName(methodName);
    if(method != null) {
        return Collections.singletonList(method);
    }

    return Collections.emptyList();
}
 
Example 3
Source File: EventMethodCallInspection.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
private void visitYamlMethodTagKey(@NotNull final PsiElement psiElement, @NotNull ProblemsHolder holder, ContainerCollectionResolver.LazyServiceCollector collector) {

        String methodName = PsiElementUtils.trimQuote(psiElement.getText());
        if(StringUtils.isBlank(methodName)) {
            return;
        }

        String classValue = YamlHelper.getServiceDefinitionClassFromTagMethod(psiElement);
        if(classValue == null) {
            return;
        }

        registerMethodProblem(psiElement, holder, classValue, collector);
    }