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


Java FileIndexFacade.isInSourceContent方法代码示例

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


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

示例1: getPsiClasses

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
@NotNull
public static PsiClass[] getPsiClasses(@NotNull PsiDirectory dir, PsiFile[] psiFiles) {
  FileIndexFacade index = FileIndexFacade.getInstance(dir.getProject());
  VirtualFile virtualDir = dir.getVirtualFile();
  boolean onlyCompiled = index.isInLibraryClasses(virtualDir) && !index.isInSourceContent(virtualDir);

  List<PsiClass> classes = null;
  for (PsiFile file : psiFiles) {
    if (onlyCompiled && !(file instanceof ClsFileImpl)) {
      continue;
    }
    if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
      PsiClass[] psiClasses = ((PsiClassOwner)file).getClasses();
      if (psiClasses.length == 0) continue;
      if (classes == null) classes = new ArrayList<PsiClass>();
      ContainerUtil.addAll(classes, psiClasses);
    }
  }
  return classes == null ? PsiClass.EMPTY_ARRAY : classes.toArray(new PsiClass[classes.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CoreJavaDirectoryService.java

示例2: getClasses

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
@NotNull
@Override
public PsiClass[] getClasses(@NotNull PsiDirectory dir) {
  LOG.assertTrue(dir.isValid());

  FileIndexFacade index = FileIndexFacade.getInstance(dir.getProject());
  VirtualFile virtualDir = dir.getVirtualFile();
  boolean onlyCompiled = index.isInLibraryClasses(virtualDir) && !index.isInSourceContent(virtualDir);

  List<PsiClass> classes = null;
  for (PsiFile file : dir.getFiles()) {
    if (onlyCompiled && !(file instanceof ClsFileImpl)) {
      continue;
    }
    if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
      PsiClass[] psiClasses = ((PsiClassOwner)file).getClasses();
      if (psiClasses.length == 0) continue;
      if (classes == null) classes = new ArrayList<PsiClass>();
      ContainerUtil.addAll(classes, psiClasses);
    }
  }
  return classes == null ? PsiClass.EMPTY_ARRAY : classes.toArray(new PsiClass[classes.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:CoreJavaDirectoryService.java

示例3: getClassNames

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
@NotNull
@Override
public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
  Set<String> names = null;
  FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
  for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
    for (PsiFile file : dir.getFiles()) {
      if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
        VirtualFile vFile = file.getVirtualFile();
        if (vFile != null &&
            !(file instanceof PsiCompiledElement) &&
            !facade.isInSourceContent(vFile) &&
            (!scope.isForceSearchingInLibrarySources() || !StubTreeLoader.getInstance().canHaveStub(vFile))) {
          continue;
        }

        Set<String> inFile =
          file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());

        if (inFile.isEmpty()) continue;
        if (names == null) names = new HashSet<String>();
        names.addAll(inFile);
      }
    }

  }
  return names == null ? Collections.<String>emptySet() : names;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:PsiElementFinderImpl.java

示例4: checkClassUnderSources

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
private boolean checkClassUnderSources(final PsiElement element, final Project project) {
  final PsiFile file = element.getContainingFile();
  if (file != null && file.getVirtualFile() != null) {
    final FileIndexFacade indexFacade = FileIndexFacade.getInstance(project);
    final VirtualFile vf = file.getVirtualFile();
    return indexFacade.isInSource(vf) || indexFacade.isInSourceContent(vf);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiClassFavoriteNodeProvider.java

示例5: getClassNames

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
@NotNull
@Override
public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
  Set<String> names = null;
  FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
  for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
    for (PsiFile file : dir.getFiles()) {
      if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) {
        VirtualFile vFile = file.getVirtualFile();
        if (vFile != null &&
            !(file instanceof PsiCompiledElement) &&
            !facade.isInSourceContent(vFile) &&
            (!scope.isForceSearchingInLibrarySources() ||
             !StubTreeLoader.getInstance().canHaveStub(vFile))) {
          continue;
        }

        Set<String> inFile = file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses());

        if (inFile.isEmpty()) continue;
        if (names == null) names = new HashSet<String>();
        names.addAll(inFile);
      }
    }

  }
  return names == null ? Collections.<String>emptySet() : names;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:JavaPsiFacadeImpl.java

示例6: getClassNames

import com.intellij.openapi.roots.FileIndexFacade; //导入方法依赖的package包/类
@NotNull
@Override
public Set<String> getClassNames(@NotNull PsiJavaPackage psiPackage, @NotNull GlobalSearchScope scope)
{
	Set<String> names = null;
	FileIndexFacade facade = FileIndexFacade.getInstance(myProject);
	for(PsiDirectory dir : psiPackage.getDirectories(scope))
	{
		for(PsiFile file : dir.getFiles())
		{
			if(file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1)
			{
				VirtualFile vFile = file.getVirtualFile();
				if(vFile != null &&
						!(file instanceof PsiCompiledElement) &&
						!facade.isInSourceContent(vFile) &&
						(!scope.isForceSearchingInLibrarySources() || !StubTreeLoader.getInstance().canHaveStub(vFile)))
				{
					continue;
				}

				Set<String> inFile = file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx) file).getClassNames() : getClassNames(((PsiClassOwner) file).getClasses());

				if(inFile.isEmpty())
				{
					continue;
				}
				if(names == null)
				{
					names = new HashSet<>();
				}
				names.addAll(inFile);
			}
		}

	}
	return names == null ? Collections.<String>emptySet() : names;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:39,代码来源:JavaPsiFacadeImpl.java


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