Package com.intellij.openapi.roots

Examples of com.intellij.openapi.roots.ProjectFileIndex


    Project project = DataKeys.PROJECT.getData(dataContext);
    Presentation presentation = e.getPresentation();
    if (presentation.isEnabled()) {
      IdeView view = DataKeys.IDE_VIEW.getData(dataContext);
      assert view != null;
      ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      PsiDirectory[] dirs = view.getDirectories();
      for (PsiDirectory dir : dirs) {
        if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && isGoodDir(dir)) {
          return;
        }
      }

      presentation.setEnabled(false);
View Full Code Here


  public static Icon getIcon(VirtualFile file, int flags, Project project) {
    Icon icon = getBaseIcon(file, flags, project);

    Icon excludedIcon = null;
    if (project != null) {
      final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      if (projectFileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
        excludedIcon = Icons.EXCLUDED_FROM_COMPILE_ICON;
      }
    }

    Icon lockedIcon = null;
View Full Code Here

  private static Icon getBaseIcon(final VirtualFile file, final int flags, final Project project) {
    Icon providersIcon = getProvidersIcon(file, flags, project);
    Icon icon = providersIcon == null ? file.getIcon() : providersIcon;

    if (project != null) {
      final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      final boolean isUnderSource = projectFileIndex.isJavaSourceFile(file);
      FileType fileType = FileTypeManager.getInstance().getFileTypeByFile(file);
      if (fileType == StdFileTypes.JAVA) {
        if (!isUnderSource) {
          icon = Icons.JAVA_OUTSIDE_SOURCE_ICON;
        }
View Full Code Here

        compilerAppSettings = ApplicationManager.getApplication().getComponent(PbCompilerApplicationSettings.class);
    }

    @Override
    public GenerationItem[] getGenerationItems(CompileContext compileContext) {
        final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
        final CompileScope compileScope = compileContext.getCompileScope();
        final CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(myProject);
        final VirtualFile[] files = compileScope.getFiles(PbFileType.PROTOBUF_FILE_TYPE, false);
        final List<GenerationItem> generationItems = new ArrayList<GenerationItem>(files.length);
        for (VirtualFile file : files) {
            if (!compilerConfiguration.isExcludedFromCompilation(file)) {
                Module module = compileContext.getModuleByFile(file);
                final PbFacet facet = PbFacet.getInstance(module);
                if (facet != null) { // Generate if a Protobuf facet has been created for the module.
                    if (facet.getConfiguration().isCompilationEnabled()) {
                        generationItems.add(new PbGenerationItem(file, module, fileIndex.isInTestSourceContent(file)));
                    }
                }
            }
        }
        if (generationItems.size() > 0) {
View Full Code Here

        IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
        if (view == null) return;
        Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
        if (project == null) return;

        ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
        for (PsiDirectory dir : view.getDirectories()) {
            if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && checkPackageExists(dir)) {
                for (GroovySourceFolderDetector detector : GroovySourceFolderDetector.EP_NAME.getExtensions()) {
                    if (detector.isGroovySourceFolder(dir)) {
                        presentation.setWeight(Presentation.HIGHER_WEIGHT);
                        break;
                    }
View Full Code Here

  }

  @NotNull
  private List<OrderEntry> getOrderEntries() {
    if (myOrderEntries == null) {
      ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
      myOrderEntries = fileIndex.getOrderEntriesForFile(myVirtualFile);
    }
    return myOrderEntries;
  }
View Full Code Here

    });
  }

  @NotNull
  private static List<VirtualFile> getVirtualFilesByName(@NotNull Project project, @NotNull String name, @NotNull GlobalSearchScope searchScope) {
    ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    Collection<VirtualFile> files = FileBasedIndex.getInstance().getContainingFiles(ERLANG_MODULE_INDEX, name, searchScope);
    List<VirtualFile> filesList = ContainerUtil.newArrayList(files);
    Collections.sort(filesList, new MyProjectFilesComparator(projectFileIndex, searchScope));
    return filesList;
  }
View Full Code Here

      return false;
    }
    final IdeView view = (IdeView) context.getData(DataKeys.IDE_VIEW.getName());
    final Project project = (Project) context.getData(DataKeys.PROJECT.getName());
    if (view != null && project != null) {
      ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
      PsiDirectory[] dirs = view.getDirectories();
      for (PsiDirectory dir : dirs) {
        PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(dir);
        if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && aPackage != null) {
          return true;
        }
      }
    }
View Full Code Here

        if (PowerSaveMode.isEnabled()) {
          return false;
        }

        Project project = null;
        ProjectFileIndex fileIndex = null;

        for (VFileEvent event : events) {
          final VirtualFile eventFile = event.getFile();
          if (eventFile == null || ProjectCoreUtil.isProjectOrWorkspaceFile(eventFile)) {
            continue;
          }

          if (project == null) {
            // lazy init
            project = getCurrentContextProject();
            if (project == null) {
              return false;
            }
            fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
          }

          if (fileIndex.isInContent(eventFile)) {
            return true;
          }
        }
        return false;
      }
View Full Code Here

        return posProximity + sizeProximity;
    }

    @Nullable
    private static Module getModule(PsiElement element){
        ProjectFileIndex index = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
        return index.getModuleForFile(element.getContainingFile().getVirtualFile());
    }
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.