当前位置: 首页>>代码示例>>Java>>正文


Java ProjectFileIndex.isInSourceContent方法代码示例

本文整理汇总了Java中com.intellij.openapi.roots.ProjectFileIndex.isInSourceContent方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectFileIndex.isInSourceContent方法的具体用法?Java ProjectFileIndex.isInSourceContent怎么用?Java ProjectFileIndex.isInSourceContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.roots.ProjectFileIndex的用法示例。


在下文中一共展示了ProjectFileIndex.isInSourceContent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getProjectGdslFiles

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static List<VirtualFile> getProjectGdslFiles(Project project) {
  final List<VirtualFile> result = ContainerUtil.newArrayList();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final GlobalSearchScope scope = GlobalSearchScope.allScope(project);

  for (VirtualFile vfile : FileBasedIndex.getInstance().getContainingFiles(NAME, OUR_KEY, scope)) {
    if (!vfile.isValid()) {
      continue;
    }
    if (!GdslUtil.GDSL_FILTER.value(vfile)) {
      LOG.error("Index returned non-gdsl file: " + vfile);
      continue;
    }
    if (fileIndex.isInLibrarySource(vfile)) {
      continue;
    }
    if (!fileIndex.isInLibraryClasses(vfile)) {
      if (!fileIndex.isInSourceContent(vfile) || !isActivated(vfile)) {
        continue;
      }
    }

    result.add(vfile);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GroovyDslFileIndex.java

示例2: getResolveScope

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
@Override
public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, Project project) {
  if (file.getFileType() != GroovyFileType.GROOVY_FILE_TYPE) return null;

  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  Module module = projectFileIndex.getModuleForFile(file);

  if (module == null) return null; //groovy files are only in modules

  boolean includeTests = projectFileIndex.isInTestSourceContent(file) || !projectFileIndex.isInSourceContent(file);
  final GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, includeTests);

  final PsiFile psi = PsiManager.getInstance(project).findFile(file);
  if (psi instanceof GroovyFile && ((GroovyFile)psi).isScript()) {
    return GroovyScriptTypeDetector.patchResolveScope((GroovyFile)psi, scope);
  }
  else {
    return scope;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GroovyResolveScopeProvider.java

示例3: update

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
  super.update(e);
  Presentation presentation = e.getPresentation();
  if (!presentation.isVisible()) return;

  IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
  if (view == null) return;
  Project project = CommonDataKeys.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;
        }
      }
      return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:NewGroovyClassAction.java

示例4: hasBlazePackageChild

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static boolean hasBlazePackageChild(
    ProjectFileIndex index, BuildSystemProvider buildSystemProvider, PsiDirectory directory) {
  if (!index.isInSourceContent(directory.getVirtualFile())) {
    // only search project files
    return false;
  }
  if (buildSystemProvider.findBuildFileInDirectory(directory.getVirtualFile()) != null) {
    return true;
  }
  for (PsiDirectory child : directory.getSubdirectories()) {
    if (hasBlazePackageChild(index, buildSystemProvider, child)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazePackage.java

示例5: canSelect

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private boolean canSelect(final VirtualFile vFile) {
  if (vFile != null && vFile.isValid()) {
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    return fileIndex.isInSourceContent(vFile) || isInLibraryContentOnly(vFile);
  }
  else {
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PackagesPaneSelectInTarget.java

示例6: isInLibraryContentOnly

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private boolean isInLibraryContentOnly(final VirtualFile vFile) {
  if (vFile == null) {
    return false;
  }
  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  return (projectFileIndex.isInLibraryClasses(vFile) || projectFileIndex.isInLibrarySource(vFile)) && !projectFileIndex.isInSourceContent(vFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PackagesPaneSelectInTarget.java

示例7: getCompilableFiles

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static VirtualFile[] getCompilableFiles(Project project, VirtualFile[] files) {
  if (files == null || files.length == 0) {
    return VirtualFile.EMPTY_ARRAY;
  }
  final PsiManager psiManager = PsiManager.getInstance(project);
  final CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(project);
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final CompilerManager compilerManager = CompilerManager.getInstance(project);
  final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
  for (final VirtualFile file : files) {
    if (!fileIndex.isInSourceContent(file)) {
      continue;
    }
    if (!file.isInLocalFileSystem()) {
      continue;
    }
    if (file.isDirectory()) {
      final PsiDirectory directory = psiManager.findDirectory(file);
      if (directory == null || JavaDirectoryService.getInstance().getPackage(directory) == null) {
        continue;
      }
    }
    else {
      FileType fileType = file.getFileType();
      if (!(compilerManager.isCompilableFileType(fileType) || compilerConfiguration.isCompilableResourceFile(project, file))) {
        continue;
      }
    }
    filesToCompile.add(file);
  }
  return VfsUtilCore.toVirtualFileArray(filesToCompile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:CompileAction.java

示例8: hasDirectoryInPackage

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
private static boolean hasDirectoryInPackage(final Project project, final IdeView view) {
  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  PsiDirectory[] dirs = view.getDirectories();
  for (PsiDirectory dir : dirs) {
    if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CreateSnapShotAction.java

示例9: selectIn

import com.intellij.openapi.roots.ProjectFileIndex; //导入方法依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  final Project project = context.getProject();
  final VirtualFile file = context.getVirtualFile();

  final Module module;
  final Facet facet;
  if (file instanceof WrappingVirtualFile) {
    final Object o = ((WrappingVirtualFile)file).getWrappedObject(project);
    facet = o instanceof Facet? (Facet)o : null;
    module = facet == null? null : facet.getModule();
  }
  else {
    Module moduleByIml = file.getFileType().equals(StdFileTypes.IDEA_MODULE) ? findModuleByModuleFile(project, file) : null;
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    module = moduleByIml != null ? moduleByIml : fileIndex.getModuleForFile(file);
    facet = fileIndex.isInSourceContent(file) ? null : findFacet(project, file);
  }
  if (module != null || facet != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (facet != null) {
          ModulesConfigurator.showFacetSettingsDialog(facet, null);
        }
        else {
          ProjectSettingsService.getInstance(project).openModuleSettings(module);
        }
      }
    });
    return;
  }

  final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, project);
  if (orderEntry != null) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:ProjectStructureSelectInTarget.java


注:本文中的com.intellij.openapi.roots.ProjectFileIndex.isInSourceContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。