inspection toolwindow: InspectionTree#checkWritable -> collectWritable
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 7 Jun 2016 16:39:01 +0000 (19:39 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Tue, 7 Jun 2016 16:39:01 +0000 (19:39 +0300)
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionTree.java

index 7dc6467af43f76b49450d0fa535e1bf19b046fee..1d8ef8bef72a90516bf18d16edb3db8921637c69 100644 (file)
@@ -267,7 +267,7 @@ public class InspectionTree extends Tree {
         if (descriptor != null) {
           descriptors.add(descriptor);
           if (readOnlyFilesSink != null) {
-            checkDescriptorFileIsWritable(descriptor, readOnlyFilesSink);
+            collectReadOnlyFiles(descriptor, readOnlyFilesSink);
           }
         }
       } else {
@@ -276,7 +276,7 @@ public class InspectionTree extends Tree {
           final CommonProblemDescriptor descriptor = sibling.getDescriptor();
           if (descriptor != null) {
             if (readOnlyFilesSink != null) {
-              checkDescriptorFileIsWritable(descriptor, readOnlyFilesSink);
+              collectReadOnlyFiles(descriptor, readOnlyFilesSink);
             }
             currentDescriptors.add(descriptor);
           }
@@ -365,7 +365,7 @@ public class InspectionTree extends Tree {
         Collections.sort(descriptorChildren, DESCRIPTOR_COMPARATOR);
       }
       if (readOnlyFilesSink != null) {
-        checkDescriptorsFileIsWritable(descriptorChildren, readOnlyFilesSink);
+        collectReadOnlyFiles(descriptorChildren, readOnlyFilesSink);
       }
 
       descriptors.addAll(descriptorChildren);
@@ -422,22 +422,18 @@ public class InspectionTree extends Tree {
     return myContext;
   }
 
-  private static void checkDescriptorsFileIsWritable(@NotNull Collection<CommonProblemDescriptor> descriptors, @NotNull Set<VirtualFile> readOnlySink) {
+  private static void collectReadOnlyFiles(@NotNull Collection<CommonProblemDescriptor> descriptors, @NotNull Set<VirtualFile> readOnlySink) {
     for (CommonProblemDescriptor descriptor : descriptors) {
-      if (checkDescriptorFileIsWritable(descriptor, readOnlySink)) {
-        return;
-      }
+      collectReadOnlyFiles(descriptor, readOnlySink);
     }
   }
 
-  private static boolean checkDescriptorFileIsWritable(@NotNull CommonProblemDescriptor descriptor, @NotNull Set<VirtualFile> readOnlySink) {
+  private static void collectReadOnlyFiles(@NotNull CommonProblemDescriptor descriptor, @NotNull Set<VirtualFile> readOnlySink) {
     if (descriptor instanceof ProblemDescriptor) {
       PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement();
       if (psiElement != null && !psiElement.isWritable()) {
         readOnlySink.add(psiElement.getContainingFile().getVirtualFile());
-        return true;
       }
     }
-    return false;
   }
 }