Package com.intellij.openapi.roots

Examples of com.intellij.openapi.roots.ProjectFileIndex


    return getContentRootForFile(project, file) != null;
  }

  @Nullable
  private static VirtualFile getContentRootForFile(@NotNull Project project, @NotNull File file) {
    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);
    if (virtualFile != null) {
      return fileIndex.getContentRootForFile(virtualFile);
    }
    return null;
  }
View Full Code Here


            result.setFQName(classes[0].getQualifiedName());
          }
        }
      }

      ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(openProject).getFileIndex();
      if (projectFileIndex.isInSource(file)) {
        VirtualFile sourceRoot = projectFileIndex.getSourceRootForFile(file);
        result = createResultIfNeeded(result, file);
        result.setSourcePath(getRelativePath(file, sourceRoot));
      }

      if (projectFileIndex.isInContent(file)) {
        VirtualFile contentRoot = projectFileIndex.getContentRootForFile(file);
        result = createResultIfNeeded(result, file);
        result.setContentPath(getRelativePath(file, contentRoot));
      }
    }
View Full Code Here

            project = null;
            pegdownOptions = null;
        }
        else {
            project = file.getProject();
            ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
            Module module = fileIndex.getModuleForFile(file.getVirtualFile());
            if ( module == null ) {
                pegdownOptions = null;
            }
            else if ( !fileIndex.isInSourceContent(file.getVirtualFile()) ) {
                pegdownOptions = null;
            }
            else if ( !Plugin.moduleConfiguration(module).isPegdownEnabled() ) {
                pegdownOptions = null;
            }
View Full Code Here

        VirtualFile virtualFile = containingFile.getVirtualFile();
        if (virtualFile == null) {
            return LookupElement.EMPTY_ARRAY;
        }

        ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
        Module module = projectFileIndex.getModuleForFile(virtualFile);
        if (module == null) {
            return LookupElement.EMPTY_ARRAY;
        }

        Sdk sdk = GoSdkUtil.getGoogleGoSdkForModule(module);
View Full Code Here

        final VirtualFile targetFile = containingFile.getVirtualFile();
        if (targetFile == null) {
            return Collections.emptyList();
        }

        ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
        Module module = projectFileIndex.getModuleForFile(targetFile);
        if (module == null) {
            return Collections.emptyList();
        }

        final PsiManager psiManager = PsiManager.getInstance(project);
View Full Code Here

        return null;
    }

    public static Sdk getGoogleGoSdkForFile(PsiFile file) {
        ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(
                file.getProject()).getFileIndex();
        Module module = projectFileIndex.getModuleForFile(
                file.getVirtualFile());

        return getGoogleGoSdkForModule(module);
    }
View Full Code Here

        VirtualFile virtualFile = file.getVirtualFile();

        if (virtualFile == null)
            return;

        ProjectFileIndex projectFileIndex =
            ProjectRootManager.getInstance(file.getProject()).getFileIndex();

        VirtualFile srcRoot =
            projectFileIndex.getSourceRootForFile(virtualFile);

        if (srcRoot != null && srcRoot.equals(virtualFile.getParent())) {
            result.addProblem(packageDeclaration,
                              "File should be inside a folder named '" + packageName + "'",
                              ProblemHighlightType.GENERIC_ERROR,
View Full Code Here

        if (virtualFile == null || !virtualFile.getName().matches(".*\\.go")) {
            return null;
        }

        ProjectFileIndex projectFileIndex =
            ProjectRootManager.getInstance(project).getFileIndex();

        ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
        List<Sdk> sdkList = new ArrayList<Sdk>();


        sdkList.addAll(GoSdkUtil.getSdkOfType(GoSdkType.getInstance(), jdkTable));
        sdkList.addAll(GoSdkUtil.getSdkOfType(GoAppEngineSdkType.getInstance(), jdkTable));

        Sdk ownerSdk = null;

        VirtualFile ownerSdkRoot = null;
        if (projectFileIndex.isInLibraryClasses(virtualFile)) {
            VirtualFile classPathRoot = projectFileIndex.getClassRootForFile(virtualFile);

            for (Sdk sdk : sdkList) {
                VirtualFile sdkRoots[] = sdk.getRootProvider().getFiles(OrderRootType.CLASSES);
                for (VirtualFile sdkRoot : sdkRoots) {
                    if (sdkRoot.equals(classPathRoot)) {
View Full Code Here

        // the current file was part of the sdk
        if (importPath != null) {
            return importPath;
        }

        ProjectFileIndex projectFileIndex =
            ProjectRootManager.getInstance(getProject()).getFileIndex();

        if (!projectFileIndex.isInSource(virtualFile) ||
            projectFileIndex.isLibraryClassFile(virtualFile)) {
            return "";
        }

        VirtualFile sourceRoot = projectFileIndex.getSourceRootForFile(virtualFile);

        if (sourceRoot == null) {
            return "";
        }
View Full Code Here

  public abstract PsiClass getResourceBundle();

  public List<String> suggestPropertiesFiles(){
    Collection<VirtualFile> allPropertiesFiles = PropertiesFilesManager.getInstance().getAllPropertiesFiles();
    List<String> paths = new ArrayList<String>();
    final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    for (VirtualFile virtualFile : allPropertiesFiles) {
      if (projectFileIndex.isInContent(virtualFile)) {
        String path = FileUtil.toSystemDependentName(virtualFile.getPath());
        paths.add(path);
      }
    }
    return paths;
View Full Code Here

TOP

Related Classes of com.intellij.openapi.roots.ProjectFileIndex

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.