skip chooser if method from abstract class is chosen from non-abstract inheritor
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 27 Jan 2012 17:27:45 +0000 (21:27 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 27 Jan 2012 17:47:54 +0000 (21:47 +0400)
java/execution/impl/src/com/intellij/execution/junit/InheritorChooser.java
platform/lang-api/src/com/intellij/execution/actions/ConfigurationContext.java

index e68e0647a63c6b7f274cf7878fda88c80b0b67be..1c2ad30996d37f784faebfefeb968a921a643260 100644 (file)
@@ -15,7 +15,9 @@
  */
 package com.intellij.execution.junit;
 
+import com.intellij.execution.Location;
 import com.intellij.execution.actions.ConfigurationContext;
+import com.intellij.execution.junit2.info.MethodLocation;
 import com.intellij.ide.util.PsiClassListCellRenderer;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
@@ -51,6 +53,13 @@ public class InheritorChooser {
                                           final PsiMethod psiMethod,
                                           final PsiClass containingClass) {
     if (containingClass != null && containingClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
+      final Location location = context.getLocation();
+      if (location instanceof MethodLocation) {
+        final PsiClass aClass = ((MethodLocation)location).getContainingClass();
+        if (aClass != null && !aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
+          return false;
+        }
+      }
       final List<PsiClass> classes = new ArrayList<PsiClass>();
       if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
         @Override
index ad4ab2353b8d84f90bb63ba03baa6dc7319f98c9..d4d70c074a77d18caa6ffd5a846bc4808f84b03b 100644 (file)
@@ -112,7 +112,7 @@ public class ConfigurationContext {
     return myConfiguration;
   }
 
-  Location getLocation() {
+  public Location getLocation() {
     return myLocation;
   }