Exemplo n.º 1
0
  @NotNull
  public List<RPackage> getContainingPackages(String functionName) {
    List<RPackage> funPackages = Lists.newArrayList();

    for (RPackage rPackage : getPackages()) {
      if (rPackage.hasFunction(functionName)) {
        funPackages.add(rPackage);
      }
    }

    return funPackages;
  }
Exemplo n.º 2
0
  public static List<Function> getFunctionByName(
      String funName, @Nullable Collection<RPackage> importedPackages) {

    RPackageService packageService = RPackageService.getInstance();

    if (packageService == null) return Collections.emptyList();

    // if the user didn't import anything do a global search todo: does this make sense???
    if (importedPackages == null) {
      importedPackages = packageService.getPackages();
    } else {
      importedPackages = addImportDependencies(importedPackages);
    }

    List<Function> funs = new ArrayList<Function>();
    for (RPackage importedPackage : importedPackages) {
      if (importedPackage.hasFunction(funName)) funs.add(importedPackage.getFunction(funName));
    }

    return funs;
  }