Move shouldBeFound method to FileIndexFacade
[idea/community.git] / platform / core-api / src / com / intellij / openapi / roots / FileIndexFacade.java
index d9f052f8b0de3ef27e0c896404abdc72b7ffac5b..35dc94d204a04dd9e16c5aeab7498bc156052aaa 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.search.GlobalSearchScope;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -54,4 +55,8 @@ public abstract class FileIndexFacade {
    * @return true if it's a valid ancestor, false otherwise.
    */
   public abstract boolean isValidAncestor(final VirtualFile baseDir, final VirtualFile child);
+
+  public boolean shouldBeFound(GlobalSearchScope scope, VirtualFile virtualFile) {
+    return (scope.isSearchOutsideRootModel() || isInContent(virtualFile) || isInLibrarySource(virtualFile)) && !virtualFile.getFileType().isBinary();
+  }
 }