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


Java PsiElementResolveResult.createResults方法代码示例

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


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

示例1: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    Project project = myElement.getProject();
    final String enumLiteralJavaModelName = myElement.getText().replaceAll("\"", "").toUpperCase();

    final PsiShortNamesCache psiShortNamesCache = PsiShortNamesCache.getInstance(project);
    final PsiField[] javaEnumLiteralFields = psiShortNamesCache.getFieldsByName(
        enumLiteralJavaModelName, GlobalSearchScope.allScope(project)
    );

    final Set<PsiField> enumFields = stream(javaEnumLiteralFields)
        .filter(literal -> literal.getParent() != null)
        .filter(literal -> literal.getParent() instanceof ClsClassImpl)
        .filter(literal -> ((ClsClassImpl) literal.getParent()).isEnum())
        .collect(Collectors.toSet());

    return PsiElementResolveResult.createResults(enumFields);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:20,代码来源:HybrisEnumLiteralItemReference.java

示例2: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final Project project = myElement.getProject();
    final String modelName = PATTERN.matcher(myElement.getText()).replaceAll("");

    final String javaModelName = modelName + JAVA_MODEL_SUFFIX;
    final String jaloModelName = modelName;

    final PsiClass[] javaModelClasses = PsiShortNamesCache.getInstance(project).getClassesByName(
        javaModelName, GlobalSearchScope.allScope(project)
    );

    final PsiClass[] jaloModelClasses = PsiShortNamesCache.getInstance(project).getClassesByName(
        jaloModelName, GlobalSearchScope.projectScope(project)
    );

    final PsiClass[] psiClasses = ArrayUtil.mergeArrays(javaModelClasses, jaloModelClasses);
    return PsiElementResolveResult.createResults(psiClasses);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:HybrisModelItemReference.java

示例3: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final PsiFile originalFile = getElement().getContainingFile();

    final Collection<ImpexMacroDeclaration> macroDeclarations =
        PsiTreeUtil.findChildrenOfType(
            originalFile,
            ImpexMacroDeclaration.class
        );

    if (!macroDeclarations.isEmpty()) {
        final ArrayList<PsiElement> references = ContainerUtil.newArrayList();
        for (final ImpexMacroDeclaration declaration : macroDeclarations) {
            if (getElement().textMatches(declaration.getFirstChild())) {
                references.add(declaration.getFirstChild());
            }
        }
        return PsiElementResolveResult.createResults(references);
    }
    return ResolveResult.EMPTY_ARRAY;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:ImpexMacrosReferenceBase.java

示例4: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {

    List<PsiElement> psiElements = new ArrayList<>();

    String content = ((StringLiteralExpression) getElement()).getContents();
    for(Field field: constraintPhpClass.getFields()) {
        String name = field.getName();
        if(!field.isConstant() && field.getModifier().isPublic() && content.equals(name)) {
            psiElements.add(field);
        }
    }

    return PsiElementResolveResult.createResults(psiElements);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:17,代码来源:ConstraintPropertyReference.java

示例5: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
  return PsiElementResolveResult.createResults(
      TemplateNameUtils.findTemplateDeclarations(this.getElement(), templateName)
          .stream()
          .map(SoyTemplateBlock::getDefinitionIdentifier)
          .collect(Collectors.toList()));
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:10,代码来源:TemplateDefinitionReference.java

示例6: fillResolveResults

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
    List<XmlTag> componentDeclarations = LayoutIndexUtility
        .getContainerDeclarations(
            typeName,
            psiElement.getProject()
        );

    ResolveResult[] resolveResults = PsiElementResolveResult.createResults(componentDeclarations);
    results.addAll(Arrays.asList(resolveResults));
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:12,代码来源:ContainerResultsFiller.java

示例7: fillResolveResults

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
    List<XmlTag> componentDeclarations = LayoutIndexUtility
        .getBlockDeclarations(
            typeName,
            psiElement.getProject()
        );

    ResolveResult[] resolveResults = PsiElementResolveResult.createResults(componentDeclarations);
    results.addAll(Arrays.asList(resolveResults));
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:12,代码来源:BlockResultsFiller.java

示例8: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    final List<PsiElement> targets = new ArrayList<>();

    ShopwareUtil.collectControllerAction(getElement().getProject(), this.controllerName, (method, methodStripped, moduleName1, controllerName1) -> {
        if (methodStripped.equalsIgnoreCase(content)) {
            targets.add(method);
        }
    }, moduleName);

    return PsiElementResolveResult.createResults(targets);
}
 
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:14,代码来源:ControllerActionReferenceProvider.java

示例9: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    final List<PsiElement> targets = new ArrayList<>();

    ShopwareUtil.collectControllerClass(getElement().getProject(), (phpClass, moduleName1, controllerName) -> {
        if (controllerName.equalsIgnoreCase(content)) {
            targets.add(phpClass);
        }
    }, moduleName);

    return PsiElementResolveResult.createResults(targets);
}
 
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:14,代码来源:ControllerReferenceProvider.java

示例10: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    String contents = getElement().getContents();
    if(org.apache.commons.lang.StringUtils.isBlank(contents)) {
        return new ResolveResult[0];
    }

    Collection<PsiElement> psiElements = new ArrayList<>();

    Set<String> methods = getCamelizeAndUnderscoreString(contents);

    // provide setter fallback for non model class or or unknown methods
    for (String value : methods) {
        Method method = phpClass.findMethodByName("set" + value);
        if (method != null) {
            psiElements.add(method);
        }
    }

    // property path
    psiElements.addAll(this.phpClass.getFields().stream()
        .filter(field -> !field.isConstant() && field.getModifier().isPublic() && methods.contains(field.getName()))
        .collect(Collectors.toList())
    );

    return PsiElementResolveResult.createResults(psiElements);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:29,代码来源:FormUnderscoreMethodReference.java

示例11: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    ContainerCollectionResolver.ServiceCollector collector = ContainerCollectionResolver
        .ServiceCollector.create(getElement().getProject());

    // Return the PsiElement for the class corresponding to the serviceId
    String serviceClass = collector.resolve(serviceId);
    if (serviceClass == null) {
        return new ResolveResult[0];
    }

    return PsiElementResolveResult.createResults(PhpIndex.getInstance(getElement().getProject()).getAnyByFQN(serviceClass));
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:15,代码来源:AbstractServiceReference.java

示例12: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    PhpClass phpClass = ServiceUtil.getResolvedClassDefinition(getElement().getProject(), this.className);
    if(phpClass == null) {
        return new ResolveResult[0];
    }

    Method targetMethod = phpClass.findMethodByName(this.method);
    if(targetMethod == null) {
        return new ResolveResult[0];
    }

    return PsiElementResolveResult.createResults(targetMethod);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:16,代码来源:ClassPublicMethodReference.java

示例13: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    Collection<PsiElement> targets = new ArrayList<>();

    targets.addAll(
        DotEnvUtil.getEnvironmentVariableTargetsForParameter(getElement().getProject(), this.parameterName)
    );

    targets.addAll(ServiceUtil.getServiceClassTargets(getElement().getProject(), this.parameterName));

    return PsiElementResolveResult.createResults(targets);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:14,代码来源:ParameterXmlReference.java

示例14: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    String contents = getElement().getValue();
    if(StringUtils.isBlank(contents)) {
        return new ResolveResult[0];
    }

    return PsiElementResolveResult.createResults(
        ServiceContainerUtil.getTargetsForConstant(getElement().getProject(), contents)
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:13,代码来源:ConstantXmlReference.java

示例15: multiResolve

import com.intellij.psi.PsiElementResolveResult; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    List<PsiElement> psiElementList = this.phpClass.getFields().stream()
        .filter(field -> !field.isConstant() && content.equals(field.getName()))
        .collect(Collectors.toList());

    return PsiElementResolveResult.createResults(psiElementList);
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:10,代码来源:DoctrinePhpClassFieldReference.java


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