本文整理汇总了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()]);
}
示例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()]);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}