disable test navigation outside test roots

This commit is contained in:
Anna Kozlova
2014-03-07 10:12:54 +01:00
parent 43d2b2e74c
commit b6f778a986
@@ -29,6 +29,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,6 +52,10 @@ public class TestDataLineMarkerProvider implements LineMarkerProvider {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return null;
}
final VirtualFile file = PsiUtilCore.getVirtualFile(element);
if (file == null || !ProjectFileIndex.SERVICE.getInstance(element.getProject()).isInTestSourceContent(file)) {
return null;
}
if (element instanceof PsiMethod) {
final PsiMethod method = (PsiMethod)element;
if (isTestMethod(method)) {