fix test line markers
authorKonstantin Bulenkov <kb@jetbrains.com>
Fri, 27 Jan 2012 16:18:48 +0000 (17:18 +0100)
committerKonstantin Bulenkov <kb@jetbrains.com>
Fri, 27 Jan 2012 16:20:29 +0000 (17:20 +0100)
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataLineMarkerProvider.java

index 3fdf7725fba9a7fbe24e46880b1d99171465ee63..c0dd5237a87b41844a117e5127a0d1366ca6bf4c 100644 (file)
@@ -39,6 +39,17 @@ import java.util.List;
  */
 public class TestDataLineMarkerProvider implements LineMarkerProvider {
   public LineMarkerInfo getLineMarkerInfo(PsiElement element) {
+    if (ApplicationManager.getApplication().isUnitTestMode()) {
+      return null;
+    }
+    if (element instanceof PsiMethod) {
+      final PsiMethod method = (PsiMethod)element;
+      if (isTestMethod(method)) {
+        return new LineMarkerInfo<PsiMethod>(
+          method, method.getModifierList().getTextRange(), PlatformIcons.TEST_SOURCE_FOLDER, Pass.UPDATE_ALL, null, new TestDataNavigationHandler(),
+          GutterIconRenderer.Alignment.LEFT);
+      }
+    }
     return null;
   }
 
@@ -65,21 +76,6 @@ public class TestDataLineMarkerProvider implements LineMarkerProvider {
   }
 
   public void collectSlowLineMarkers(List<PsiElement> elements, Collection<LineMarkerInfo> result) {
-    if (ApplicationManager.getApplication().isUnitTestMode()) {
-      return;
-    }
-    for (PsiElement element : elements) {
-      if (!(element instanceof PsiMethod)) {
-        continue;
-      }
-      final PsiMethod method = (PsiMethod)element;
-      if (isTestMethod(method)) {
-        result.add(new LineMarkerInfo<PsiMethod>(
-          method, method.getTextRange(), PlatformIcons.TEST_SOURCE_FOLDER, Pass.UPDATE_ALL, null, new TestDataNavigationHandler(),
-          GutterIconRenderer.Alignment.LEFT
-        ));
-      }
-    }
   }
 
   @Nullable