cleanup
authorAlexey Kudravtsev <cdr@intellij.com>
Wed, 2 Jun 2010 11:19:08 +0000 (15:19 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Thu, 3 Jun 2010 10:39:32 +0000 (14:39 +0400)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TextEditorHighlightingPassRegistrarImpl.java
platform/util/src/com/intellij/util/containers/ContainerUtil.java

index 4ae770e081a233088109a879adbbc9662669ba8e..1759c7c144c7892ed6029cb2b9a01f3ab0035eeb 100644 (file)
@@ -28,7 +28,8 @@ public class JavaChangeLocalityDetector implements ChangeLocalityDetector {
   public PsiElement getChangeHighlightingDirtyScopeFor(final PsiElement element) {
     PsiElement parent = element.getParent();
     if (element instanceof PsiCodeBlock && parent instanceof PsiMethod && !((PsiMethod)parent).isConstructor() &&
-        parent.getParent()instanceof PsiClass && !(parent.getParent()instanceof PsiAnonymousClass)) {
+        parent.getParent() instanceof PsiClass && !(parent.getParent() instanceof PsiAnonymousClass)) {
+      // for changes inside method, rehighlight codeblock only
       // do not use this optimization for constructors and class initializers - to update non-initialized fields
       return parent;
     }
index 628c5a5cc0aede0f89faa3f197a9c585c9759b46..52c4cccdd4eb415298e9811727dc578bc55133a9 100644 (file)
@@ -89,7 +89,7 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
                                      runAfterOfStartingOf == null || runAfterOfStartingOf.length == 0 ? ArrayUtil.EMPTY_INT_ARRAY : runAfterOfStartingOf);
     int passId = forcedPassId == -1 ? nextAvailableId++ : forcedPassId;
     PassConfig registered = myRegisteredPassFactories.get(passId);
-    assert registered == null: "Pass id "+passId +" has already been registered: "+ registered.passFactory;
+    assert registered == null: "Pass id "+passId +" has already been registered in: "+ registered.passFactory;
     myRegisteredPassFactories.put(passId, info);
     if (factory instanceof DirtyScopeTrackingHighlightingPassFactory) {
       myDirtyScopeTrackingFactories.add((DirtyScopeTrackingHighlightingPassFactory) factory);
index 1131faf0a4f8d61e6dbfa2c3407afa40a56e6dc4..784c11060dffcbddaa7b3226d08266f21960a1bf 100644 (file)
@@ -1009,4 +1009,14 @@ public class ContainerUtil {
       }
     };
   }
+
+  public static <E> List<E> flatten(Collection<? extends Collection<E>> collections) {
+    List<E> result = new ArrayList<E>();
+    for (Collection<E> list : collections) {
+      result.addAll(list);
+    }
+
+    return result;
+  }
+
 }