provide scope to detect location more precisely (IDEA-107895)

This commit is contained in:
Anna Kozlova
2013-06-03 14:20:59 +04:00
parent 1f30fd93fe
commit 9ef8ed2d03
20 changed files with 56 additions and 37 deletions
@@ -25,6 +25,7 @@ import com.intellij.execution.testframework.JavaAwareFilter;
import com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentContainer;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
public class JavaRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
@@ -35,8 +36,8 @@ public class JavaRerunFailedTestsAction extends AbstractRerunFailedTestsAction {
@NotNull
@Override
protected Filter getFilter(Project project) {
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project));
protected Filter getFilter(Project project, GlobalSearchScope searchScope) {
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project, searchScope));
}
}
@@ -25,15 +25,16 @@ import com.intellij.execution.PsiLocation;
import com.intellij.execution.junit2.info.MethodLocation;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.search.GlobalSearchScope;
public class JavaAwareFilter {
private JavaAwareFilter() {
}
public static Filter METHOD(final Project project) {
public static Filter METHOD(final Project project, final GlobalSearchScope searchScope) {
return new Filter() {
public boolean shouldAccept(final AbstractTestProxy test) {
final Location location = test.getLocation(project);
final Location location = test.getLocation(project, searchScope);
if (location instanceof MethodLocation) return true;
if (location instanceof PsiLocation && location.getPsiElement() instanceof PsiMethod) return true;
return false;