Java 类com.intellij.psi.PsiElementResolveResult 实例源码

项目:hybris-integration-intellij-idea-plugin    文件:HybrisEnumLiteralItemReference.java   
@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);
}
项目:hybris-integration-intellij-idea-plugin    文件:HybrisModelItemReference.java   
@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);
}
项目:hybris-integration-intellij-idea-plugin    文件:ImpexMacrosReferenceBase.java   
@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;
}
项目:intellij-neos    文件:NodeTypeReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    String nodeTypeNameToFindReferenceFor = yamlElement.getKeyText();

    // files which contain the NodeType definition
    Collection<VirtualFile> files = FileBasedIndex.getInstance().getContainingFiles(NodeTypesYamlFileIndex.KEY, nodeTypeNameToFindReferenceFor, GlobalSearchScope.allScope(yamlElement.getProject()));

    return files
            .stream()
            // get the PSI for each file
            .map(file -> PsiManager.getInstance(yamlElement.getProject()).findFile(file))
            // ensure we only have YAML files
            .filter(psiFile -> psiFile instanceof YAMLFile)
            .map(psiFile -> (YAMLFile) psiFile)
            // get all YAML keys in these files
            .flatMap(yamlFile -> YAMLUtil.getTopLevelKeys(yamlFile).stream())
            // get the correct YAML key
            .filter(yamlKeyValue -> yamlKeyValue.getKeyText().equals(nodeTypeNameToFindReferenceFor))
            // remove "current" element if it exists
            .filter(yamlKeyValue -> yamlElement != yamlKeyValue)
            // build up the result object
            .map(yamlKeyValue -> new PsiElementResolveResult(yamlKeyValue, true))
            .toArray(PsiElementResolveResult[]::new);
}
项目:intellij-ce-playground    文件:PyTargetReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
  final ResolveResult[] results = super.multiResolve(incompleteCode);
  boolean shadowed = false;
  for (ResolveResult result : results) {
    final PsiElement element = result.getElement();
    if (element != null && (element.getContainingFile() != myElement.getContainingFile() ||
                            element instanceof PyFunction || element instanceof PyClass)) {
      shadowed = true;
      break;
    }
  }
  if (results.length > 0 && !shadowed) {
    return results;
  }
  // resolve to self if no other target found
  return new ResolveResult[] { new PsiElementResolveResult(myElement) };
}
项目:epigraph    文件:SchemaQnReferenceResolver.java   
@NotNull
public ResolveResult[] multiResolve(@NotNull Project project) {
  List<ResolveResult> typeDefs =
      SchemaIndexUtil.findTypeDefs(project, prefixes, suffix, searchScope).stream()
      .filter(Objects::nonNull)
      .map(PsiElementResolveResult::new)
      .collect(Collectors.toList());

  // see comment in `resolve` above re. namespace declaration reference

  Qn prefix = input;
  int prefixLength = prefix.size();
  List<SchemaNamespaceDecl> namespaceDecls = resolveNamespaces(project, prefix);

  ResolveResult[] namespaces = namespaceDecls.stream()
      .map(ns -> new PsiElementResolveResult(getTargetSegment(ns, prefixLength)))
      .toArray(ResolveResult[]::new);

  return ArrayUtil.mergeArrays(typeDefs.toArray(new ResolveResult[typeDefs.size()]), namespaces);
}
项目:glsl4idea    文件:GLSLParameterInfoHandler.java   
@Override
public void updateUI(Object p, @NotNull ParameterInfoUIContext context) {
    if (p instanceof PsiElementResolveResult) p = ((PsiElementResolveResult) p).getElement();
    if (!(p instanceof GLSLFunctionDeclaration)) return;
    GLSLFunctionDeclaration declaration = (GLSLFunctionDeclaration) p;
    GLSLParameterDeclaration[] parameters = declaration.getParameters();

    StringBuilder buffer = new StringBuilder();
    buffer.append(declaration.getType().getReturnType().getTypename())
            .append(' ').append(declaration.getName()).append('(');

    final int currentParameter = context.getCurrentParameterIndex();
    int highlightStartOffset = -1, highlightEndOffset = -1;

    for (int i = 0; i < parameters.length; i++) {
        if (i == currentParameter) highlightStartOffset = buffer.length();
        buffer.append(parameters[i].getText());
        if (i == currentParameter) highlightEndOffset = buffer.length();
        if (i < parameters.length - 1) buffer.append(", ");
    }
    buffer.append(')');

    context.setupUIComponentPresentation(buffer.toString(), highlightStartOffset, highlightEndOffset, false, false, false, context.getDefaultParameterColor());
}
项目:intellij-xquery    文件:XQueryPrefixReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    XQueryFile file = (XQueryFile) myElement.getContainingFile();
    List<ResolveResult> results = new ArrayList<ResolveResult>();
    Collection<ResolveResult> primaryReferences = getPrimaryReferences();
    results.addAll(primaryReferences);
    if (shouldAddOtherReferences(primaryReferences)) {
        results.addAll(getReferencesFromNamespaceDeclarations(file.getNamespaceDeclarations()));
        results.addAll(getReferencesFromModuleImports(file.getModuleImports()));
        results.addAll(getReferencesFromModuleName(file.getModuleNamespaceName()));
    }
    if (results.isEmpty() && file.isPredeclaredNamespacePrefix(myElement.getText())) {
        results.add(new PsiElementResolveResult(getElement()));
    }
    return results.toArray(new ResolveResult[results.size()]);
}
项目:idea-php-symfony2-plugin    文件:ConstraintPropertyReference.java   
@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);
}
项目:yiistorm    文件:PhpElementsUtil.java   
static public List<ResolveResult> getClassInterfaceResolveResult(Project project, String FQNClassOrInterfaceName) {

        PhpIndex phpIndex = PhpIndex.getInstance(project);
        Collection<PhpClass> phpClasses = phpIndex.getClassesByFQN(FQNClassOrInterfaceName);
        Collection<PhpClass> phpInterfaces = phpIndex.getInterfacesByFQN(FQNClassOrInterfaceName);

        List<ResolveResult> results = new ArrayList<ResolveResult>();
        for (PhpClass phpClass : phpClasses) {
            results.add(new PsiElementResolveResult(phpClass));
        }
        for (PhpClass phpInterface : phpInterfaces) {
            results.add(new PsiElementResolveResult(phpInterface));
        }

        return results;
    }
项目:consulo-java    文件:PsiJavaModuleReference.java   
@NotNull
@Override
public ResolveResult[] resolve(@NotNull PsiJavaModuleReference reference, boolean incompleteCode)
{
    PsiFile file = reference.getElement().getContainingFile();
    String moduleName = reference.getCanonicalText();
    Collection<PsiJavaModule> modules = findModules(file, moduleName, incompleteCode);
    if(!modules.isEmpty())
    {
        ResolveResult[] result = new ResolveResult[modules.size()];
        int i = 0;
        for(PsiJavaModule module : modules)
        {
            result[i++] = new PsiElementResolveResult(module);
        }
        return result;
    }
    else
    {
        return ResolveResult.EMPTY_ARRAY;
    }
}
项目:AppleScript-IDEA    文件:AppleScriptResolveUtil.java   
@NotNull
public static ResolveResult[] toCandidateInfoArray(@Nullable List<? extends PsiElement> elements) {
  if (elements == null) {
    return ResolveResult.EMPTY_ARRAY;
  }
  elements = ContainerUtil.filter(elements, (Condition<PsiElement>) Objects::nonNull);
  final ResolveResult[] result = new ResolveResult[elements.size()];
  for (int i = 0, size = elements.size(); i < size; i++) {
    result[i] = new PsiElementResolveResult(elements.get(i));
  }
  return result;
}
项目:magento2-phpstorm-plugin    文件:PolyVariantReferenceBase.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    ResolveResult[] resolveResults = new ResolveResult[targets.size()];

    int i = 0;
    for (PsiElement target : targets) {
        resolveResults[i++] = new PsiElementResolveResult(target);
    }
    return resolveResults;
}
项目:bamboo-soy    文件:VariableReference.java   
@NotNull
private ResolveResult[] multiResolve() {
  final Collection<Variable> definitions =
      Scope.getScopeOrEmpty(this.getElement()).getVariables();
  List<ResolveResult> results = new ArrayList<>();
  for (Variable definition : definitions) {
    if (definition.name.equals(this.identifier)) {
      results.add(new PsiElementResolveResult(definition.element));
    }
  }

  return results.toArray(new ResolveResult[results.size()]);
}
项目:bamboo-soy    文件:TemplateDefinitionReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
  return PsiElementResolveResult.createResults(
      TemplateNameUtils.findTemplateDeclarations(this.getElement(), templateName)
          .stream()
          .map(SoyTemplateBlock::getDefinitionIdentifier)
          .collect(Collectors.toList()));
}
项目:intellij-plugin    文件:CoffigReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    if (key != null) {
        Project project = myElement.getProject();
        return CoffigUtil.findCoffigKeys(project, key).stream()
                .map(PsiElementResolveResult::new)
                .toArray(ResolveResult[]::new);
    }
    return new ResolveResult[0];
}
项目:intellij    文件:GlobReference.java   
@Override
protected ResolveResult[] resolveInner(boolean incompleteCode, PsiFile containingFile) {
  File containingDirectory = ((BuildFile) containingFile).getFile().getParentFile();
  if (containingDirectory == null) {
    return ResolveResult.EMPTY_ARRAY;
  }
  List<String> includes = resolveListContents(element.getIncludes());
  List<String> excludes = resolveListContents(element.getExcludes());
  boolean directoriesExcluded = element.areDirectoriesExcluded();
  if (includes.isEmpty()) {
    return ResolveResult.EMPTY_ARRAY;
  }
  Project project = element.getProject();
  try {
    List<File> files =
        UnixGlob.forPath(containingDirectory)
            .addPatterns(includes)
            .addExcludes(excludes)
            .setExcludeDirectories(directoriesExcluded)
            .setDirectoryFilter(directoryFilter(project, containingDirectory.getPath()))
            .glob();

    List<ResolveResult> results = Lists.newArrayListWithCapacity(files.size());
    for (File file : files) {
      PsiFileSystemItem psiFile = BuildReferenceManager.getInstance(project).resolveFile(file);
      if (psiFile != null) {
        results.add(new PsiElementResolveResult(psiFile));
      }
    }
    return results.toArray(ResolveResult.EMPTY_ARRAY);

  } catch (Exception e) {
    return ResolveResult.EMPTY_ARRAY;
  }
}
项目:magento2plugin    文件:ConstantReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    PhpIndex phpIndex = PhpIndex.getInstance(getElement().getProject());
    List<String> parts = StringUtil.split(
        PhpLangUtil.toFQN(
            StringUtil.unquoteString(getElement().getText())
        ),
        "::"
    );

    if (parts.size() != 2) {
        return new ResolveResult[0];
    }

    String className = parts.get(0);
    String constantName = parts.get(1);

    List<ResolveResult> fields = new ArrayList<ResolveResult>();
    Collection<PhpClass> classesAndInterfaces = new ArrayList<>();
    classesAndInterfaces.addAll(phpIndex.getClassesByFQN(className));
    classesAndInterfaces.addAll(phpIndex.getInterfacesByFQN(className));

    for (PhpClass phpClass: classesAndInterfaces) {
        for(Field field: phpClass.getFields()) {
            if (field.isConstant() && field.getName().equals(constantName)) {
                fields.add(new PsiElementResolveResult(field));
            }
        }
    }

    return fields.toArray(new ResolveResult[fields.size()]);
}
项目:magento2plugin    文件:ArgumentNameReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    List<ResolveResult> list = new ArrayList<ResolveResult>();

    String argumentName = StringUtil.unquoteString(getElement().getText());
    for (Parameter parameter: getParameters()) {
        if (argumentName.equals(parameter.getName())) {
            list.add(new PsiElementResolveResult(parameter));
        }
    }

    return list.toArray(new ResolveResult[list.size()]);
}
项目:magento2plugin    文件:VirtualTypesResultsFiller.java   
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
    XmlAttributeValue[] virtualTypesByName = VirtualTypesNamesFileBasedIndex.getVirtualTypesByName(
        psiElement.getProject(),
        typeName,
        psiElement.getResolveScope()
    );

    for (XmlAttributeValue virtualType: virtualTypesByName) {
        results.add(new PsiElementResolveResult(virtualType));
    }
}
项目:magento2plugin    文件:InterfacesResultsFiller.java   
@Override
public void fillResolveResults(PsiElement psiElement, List<ResolveResult> results, String typeName) {
    PhpIndex phpIndex = PhpIndex.getInstance(psiElement.getProject());

    for (PhpClass phpClass : phpIndex.getInterfacesByFQN(PhpLangUtil.toFQN(typeName))) {
        results.add(new PsiElementResolveResult(phpClass));
    }
}
项目:magento2plugin    文件:ContainerResultsFiller.java   
@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));
}
项目:magento2plugin    文件:BlockResultsFiller.java   
@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));
}
项目:IntelliJ_Jahia_plugin    文件:CndNodeTypeIdentifierReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    Project project = myElement.getProject();
    List<CndNodeType> nodeTypes = CndUtil.findNodeTypes(project, namespace, nodeType);
    List<ResolveResult> results = new ArrayList<ResolveResult>();
    for (CndNodeType cndNodeType : nodeTypes) {
        results.add(new PsiElementResolveResult(cndNodeType.getNodeTypeIdentifier()));
    }
    return results.toArray(new ResolveResult[results.size()]);
}
项目:IntelliJ_Jahia_plugin    文件:CndPropertyIdentifierReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    Project project = myElement.getProject();
    List<CndProperty> properties = CndUtil.findProperties(project, namespace, nodeType, propertyName);
    List<ResolveResult> results = new ArrayList<ResolveResult>();
    for (CndProperty property : properties) {
        results.add(new PsiElementResolveResult(property.getPropertyIdentifier()));
    }
    return results.toArray(new ResolveResult[results.size()]);
}
项目:IntelliJ_Jahia_plugin    文件:ViewModuleReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    Project project = myElement.getProject();
    List<PsiFile> viewFiles = CndProjectFilesUtil.findViewFiles(project, viewModel.getType(), viewModel.getName());
    List<ResolveResult> results = new ArrayList<ResolveResult>();
    for (PsiFile viewFile : viewFiles) {
        results.add(new PsiElementResolveResult(viewFile));
    }
    return results.toArray(new ResolveResult[results.size()]);
}
项目:IntelliJ_Jahia_plugin    文件:ViewIncludeReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    Project project = myElement.getProject();
    List<PsiFile> viewFiles = CndProjectFilesUtil.findViewFilesIncludingAncestors(project,
            viewModel.getNodeType().getNamespace(), viewModel.getNodeType().getNodeTypeName(), viewModel.getType(), viewModel.getName());
    List<ResolveResult> results = new ArrayList<ResolveResult>();
    for (PsiFile viewFile : viewFiles) {
        results.add(new PsiElementResolveResult(viewFile));
    }
    return results.toArray(new ResolveResult[results.size()]);
}
项目:js-graphql-intellij-plugin    文件:JSGraphQLEndpointImportFileReferencePsiElement.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {
    final PsiElement resolve = resolve();
    if(resolve != null) {
        return new ResolveResult[] { new PsiElementResolveResult(resolve) };
    }
    return ResolveResult.EMPTY_ARRAY;
}
项目:idea-php-shopware-plugin    文件:ControllerActionReferenceProvider.java   
@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);
}
项目:idea-php-shopware-plugin    文件:ControllerReferenceProvider.java   
@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);
}
项目:intellij-haskforce    文件:HaskellUtil.java   
public static List<PsiElementResolveResult> matchGlobalNamesQualified(
        List<FoundDefinition> namedElements, String qualifiedCallName){
    List<PsiElementResolveResult> results = Lists.newArrayList();
    for (FoundDefinition possibleReference : namedElements) {
        if(possibleReference.imprt != null && possibleReference.imprt.alias != null &&
                possibleReference.imprt.alias.equals(qualifiedCallName)){
            results.add(new PsiElementResolveResult(possibleReference.element));
        }
    }
    return results;

}
项目:glsl4idea    文件:GLSLFunctionReference.java   
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
    final List<GLSLFunctionType> functions = sourceExpression.getPossibleCalledFunctions();
    ResolveResult[] result = new ResolveResult[functions.size()];
    for (int i = 0; i < result.length; i++) {
        result[i] = new PsiElementResolveResult(functions.get(i).getDefinition());
    }
    return result;
}
项目:intellij-xquery    文件:XQueryVariableReferenceResolver.java   
private ResolveResult[] convertToResolveResults(List<XQueryVarName> resolveResults) {
    ResolveResult[] convertedResults = new ResolveResult[resolveResults.size()];
    for (int i = 0; i < resolveResults.size(); i++) {
        convertedResults[i] = new PsiElementResolveResult(resolveResults.get(i));
    }
    return convertedResults;
}
项目:intellij-xquery    文件:XQueryFunctionReference.java   
private ResolveResult[] convertToResolveResults(List<XQueryFunctionName> resolveResults) {
    ResolveResult[] convertedResults = new ResolveResult[resolveResults.size()];
    for (int i = 0; i < resolveResults.size(); i++) {
        convertedResults[i] = new PsiElementResolveResult(resolveResults.get(i));
    }
    return convertedResults;
}
项目:intellij-xquery    文件:XQueryPrefixReference.java   
private Collection<ResolveResult> getReferencesFromModuleName(XQueryNamespacePrefix moduleNamespaceName) {
    if (moduleNamespaceName != null && myElement.getText().equals(moduleNamespaceName.getText())) {
        return Arrays.asList(new ResolveResult[]{new PsiElementResolveResult(moduleNamespaceName)});
    } else {
        return emptyList();
    }
}
项目:intellij-xquery    文件:XQueryPrefixReference.java   
private Collection<ResolveResult> getReferencesFromModuleImports(Collection<XQueryModuleImport> moduleImports) {
    if (moduleImports.size() > 0) {
        List<ResolveResult> results = new ArrayList<ResolveResult>();
        for (XQueryModuleImport moduleImport : moduleImports) {
            XQueryNamespacePrefix namespaceName = moduleImport.getNamespacePrefix();
            if (namespaceName != null && myElement.getText().equals(namespaceName.getText())) {
                results.add(new PsiElementResolveResult(moduleImport.getNamespacePrefix()));
            }
        }
        return results;
    } else {
        return emptyList();
    }
}
项目:intellij-xquery    文件:XQueryPrefixReference.java   
private Collection<ResolveResult> getReferencesFromNamespaceDeclarations(Collection<XQueryNamespaceDecl>
                                                                                 namespaceDeclarations) {
    if (namespaceDeclarations.size() > 0) {
        List<ResolveResult> results = new ArrayList<ResolveResult>();
        for (XQueryNamespaceDecl namespaceDeclaration : namespaceDeclarations) {
            if (myElement.getText().equals(namespaceDeclaration.getNamespacePrefix().getText())) {
                results.add(new PsiElementResolveResult(namespaceDeclaration.getNamespacePrefix()));
            }
        }
        return results;
    } else {
        return emptyList();
    }
}
项目:idea-php-symfony2-plugin    文件:FormUnderscoreMethodReference.java   
@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);
}
项目:idea-php-symfony2-plugin    文件:AbstractServiceReference.java   
@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));
}
项目:idea-php-symfony2-plugin    文件:RouteParameterReference.java   
@NotNull
@Override
public ResolveResult[] multiResolve(boolean incompleteCode) {

    List<ResolveResult> results = new ArrayList<>();

    for (PsiElement psiParameter : RouteHelper.getRouteParameterPsiElements(getElement().getProject(), this.routeName, parameterName)) {
        results.add(new PsiElementResolveResult(psiParameter));
    }

    return results.toArray(new ResolveResult[results.size()]);
}