Package com.intellij.psi.search

Examples of com.intellij.psi.search.GlobalSearchScope


      return projectBasedFile;
    }
    Matcher filenameMatcher = PATTERN_FILENAME.matcher(path);
    if (filenameMatcher.find()) {
      String filename = filenameMatcher.group(1);
      GlobalSearchScope projectScope = ProjectScope.getProjectScope(myProject);
      PsiFile[] projectFiles = FilenameIndex.getFilesByName(myProject, filename, projectScope);
      if (projectFiles.length > 0) {
        return projectFiles[0].getVirtualFile();
      }
      GlobalSearchScope libraryScope = ProjectScope.getLibrariesScope(myProject);
      PsiFile[] libraryFiles = FilenameIndex.getFilesByName(myProject, filename, libraryScope);
      if (libraryFiles.length > 0) {
        return libraryFiles[0].getVirtualFile();
      }
    }
View Full Code Here


         
          if (moduleScope || moduleWithDeps) {
            Project project = file.getProject();

            Module module = ModuleUtilCore.findModuleForPsiElement(position);
            GlobalSearchScope scope = module != null && moduleScope ? GlobalSearchScope.moduleScope(module) : ProjectScope.getProjectScope(project);

            Collection<String> names = ErlangAtomIndex.getNames(project, scope);
            for (String name : names) {
              result.addElement(PrioritizedLookupElement.withPriority(
                LookupElementBuilder.create(name).withLookupString(name.toLowerCase()).withIcon(ErlangIcons.ATOM), 50));
View Full Code Here

    result.addAll(getModulePathLookupElements(file, includeText));
    return result;
  }

  private static List<VirtualFile> getApplicationDirectories(Project project, final String appName, boolean nameIsComplete) {
    GlobalSearchScope searchScope = GlobalSearchScope.allScope(project);
    if (nameIsComplete) {
      return ContainerUtil.createMaybeSingletonList(ErlangApplicationIndex.getApplicationDirectoryByName(appName, searchScope));
    }
    return ContainerUtil.filter(ErlangApplicationIndex.getAllApplicationDirectories(project, searchScope), new Condition<VirtualFile>() {
      @Override
View Full Code Here

  @NotNull
  public PsiClassType[] getExtendsListTypes() {
    final PsiClass superClass = getSuperClass();
    final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
    final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
    if (superClass != null && superClass.getQualifiedName() != null) {
      return new PsiClassType[]{factory.createTypeByFQClassName(superClass.getQualifiedName(), scope)};
    }

    return PsiClassType.EMPTY_ARRAY;
View Full Code Here

  public PsiClass[] getInterfaces() {
    final ClList ns = getNsElement();
    final ClKeywordImpl key = ClojurePsiUtil.findNamespaceKeyByName(ns, ClojureKeywords.IMPLEMENTS);
    final ArrayList<PsiClass> classes = new ArrayList<PsiClass>();
    final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
    final JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
    if (key != null) {
      final PsiElement next = ClojurePsiUtil.getNextNonWhiteSpace(key);
      if (next instanceof ClVector) {
        ClVector vector = (ClVector) next;
View Full Code Here

  @NotNull
  public PsiClassType[] getSuperTypes() {
    final ArrayList<PsiClassType> types = new ArrayList<PsiClassType>();
    final PsiClass superClass = getSuperClass();
    final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
    final GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
    if (superClass != null && superClass.getQualifiedName() != null) {
      types.add(factory.createTypeByFQClassName(superClass.getQualifiedName(), scope));
    }

    for (PsiClass clazz : getInterfaces()) {
View Full Code Here

    }

    private void resolveNamespace(ClSymbol symbol, ResolveProcessor processor) {
      // process namespaces
      final Project project = symbol.getProject();
      final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
      final Collection<ClNs> nses = StubIndex.getInstance().get(ClojureNsNameIndex.KEY, symbol.getNameString(), project, scope);
      for (ClNs ns : nses) {
        ResolveUtil.processElement(processor, ns);
      }
    }
View Full Code Here

        try {
          fileName = location.sourceName();
        } catch (AbsentInformationException ignore) {}

        final String originalQName = refType.name().replace('/', '.');
        final GlobalSearchScope searchScope = myDebugProcess.getSearchScope();
        int dollar = originalQName.indexOf('$');
        final String qName = dollar >= 0 ? originalQName.substring(0, dollar) : originalQName;
        final ClNs[] nses = ClojureShortNamesCache.getInstance(project).getNsByQualifiedName(qName, searchScope);
        if (nses.length == 1) {
          final PsiFile containingFile = nses[0].getContainingFile();
View Full Code Here

  }

  public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
    if (!ClojureCompilerSettings.getInstance(project).getState().COMPILE_CLOJURE) return NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY;

    final GlobalSearchScope scope = includeNonProjectItems ? null : GlobalSearchScope.projectScope(project);
    Collection<ClojureFile> files = StubIndex.getInstance().get(ClojureClassNameIndex.KEY, name, project, scope);
    List<PsiClass> scriptClasses = ContainerUtil.map(files, new Function<ClojureFile, PsiClass>() {
      public PsiClass fun(ClojureFile clojureFile) {
        assert clojureFile.isClassDefiningFile();
        return clojureFile.getDefinedClass();
View Full Code Here

    return symbols.toArray(new String[symbols.size()]);

  }

  public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
    final GlobalSearchScope scope = includeNonProjectItems ? null : GlobalSearchScope.projectScope(project);

    List<NavigationItem> symbols = new ArrayList<NavigationItem>();
    symbols.addAll(StubIndex.getInstance().get(ClDefNameIndex.KEY, name, project, scope));
    return symbols.toArray(new NavigationItem[symbols.size()]);
  }
View Full Code Here

TOP

Related Classes of com.intellij.psi.search.GlobalSearchScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.