mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use module / project content scope
This commit is contained in:
@@ -480,12 +480,12 @@ public class FindInProjectUtil {
|
||||
GlobalSearchScope scope = psiDirectory != null
|
||||
? GlobalSearchScopes.directoryScope(psiDirectory, true)
|
||||
: module != null
|
||||
? moduleContentScope(module)
|
||||
? module.getModuleContentScope()
|
||||
: customScope instanceof GlobalSearchScope
|
||||
? (GlobalSearchScope)customScope
|
||||
: toGlobal(project, customScope);
|
||||
if (scope == null) {
|
||||
scope = GlobalSearchScope.projectScope(project);
|
||||
scope = ProjectScope.getContentScope(project);
|
||||
}
|
||||
|
||||
Set<Integer> keys = new THashSet<Integer>(30);
|
||||
@@ -553,21 +553,6 @@ public class FindInProjectUtil {
|
||||
return new Pair<Boolean, Collection<PsiFile>>(fast, resultFiles);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static GlobalSearchScope moduleContentScope(@NotNull final Module module) {
|
||||
VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
|
||||
GlobalSearchScope result = null;
|
||||
PsiManager psiManager = PsiManager.getInstance(module.getProject());
|
||||
for (VirtualFile root : contentRoots) {
|
||||
PsiDirectory directory = psiManager.findDirectory(root);
|
||||
if (directory != null) {
|
||||
GlobalSearchScope moduleContent = GlobalSearchScopes.directoryScope(directory, true);
|
||||
result = result == null ? moduleContent : result.uniteWith(moduleContent);
|
||||
}
|
||||
}
|
||||
return result == null ? GlobalSearchScope.EMPTY_SCOPE : result;
|
||||
}
|
||||
|
||||
private static void filterMaskedFiles(@NotNull final Set<PsiFile> resultFiles, @Nullable final Pattern fileMaskRegExp) {
|
||||
if (fileMaskRegExp != null) {
|
||||
for (Iterator<PsiFile> iterator = resultFiles.iterator(); iterator.hasNext();) {
|
||||
|
||||
Reference in New Issue
Block a user