TestSourcesFilter: update after review

This commit is contained in:
Alexander Zolotov
2016-07-20 14:26:23 +03:00
parent 8b87739f9c
commit b9e8f2856f
10 changed files with 66 additions and 47 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,7 @@
package com.intellij.util.xml;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.TestSourcesFilter;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
@@ -89,7 +88,6 @@ public class DomJavaUtil {
return GlobalSearchScope.moduleRuntimeScope(module, true);
}
ProjectFileIndex fileIndex = ProjectRootManager.getInstance(file.getProject()).getFileIndex();
return module.getModuleRuntimeScope(fileIndex.isInTestSourceContent(virtualFile));
return module.getModuleRuntimeScope(TestSourcesFilter.isTestSources(virtualFile, file.getProject()));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ package com.intellij.util.xml.converters.values;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.TestSourcesFilter;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
@@ -62,7 +62,7 @@ public abstract class ClassValueConverter extends Converter<PsiClass> implements
if (file == null) {
return ProjectScope.getAllScope(project);
}
final boolean inTests = ProjectRootManager.getInstance(project).getFileIndex().isInTestSourceContent(file);
final boolean inTests = TestSourcesFilter.isTestSources(file, project);
return module.getModuleRuntimeScope(inTests);
}