mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduced getVirtualFilesWithWord: same as getFilesWithWord but without PsiFile
This commit is contained in:
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.cache;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
@@ -38,6 +39,9 @@ public interface CacheManager {
|
||||
@NotNull
|
||||
PsiFile[] getFilesWithWord(@NotNull String word, short occurenceMask, @NotNull GlobalSearchScope scope, final boolean caseSensitively);
|
||||
|
||||
@NotNull
|
||||
VirtualFile[] getVirtualFilesWithWord(@NotNull String word, short occurenceMask, @NotNull GlobalSearchScope scope, final boolean caseSensitively);
|
||||
|
||||
boolean processFilesWithWord(@NotNull Processor<PsiFile> processor,
|
||||
@NotNull String word,
|
||||
@MagicConstant(flagsFromClass = UsageSearchContext.class) short occurenceMask,
|
||||
|
||||
+12
@@ -65,6 +65,18 @@ public class IndexCacheManagerImpl implements CacheManager{
|
||||
return processor.getResults().isEmpty() ? PsiFile.EMPTY_ARRAY : processor.toArray(PsiFile.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public VirtualFile[] getVirtualFilesWithWord(@NotNull final String word, final short occurenceMask, @NotNull final GlobalSearchScope scope, final boolean caseSensitively) {
|
||||
if (myProject.isDefault()) {
|
||||
return VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
final List<VirtualFile> vFiles = new ArrayList<VirtualFile>(5);
|
||||
collectVirtualFilesWithWord(new CommonProcessors.CollectProcessor<VirtualFile>(vFiles), word, occurenceMask, scope, caseSensitively);
|
||||
return vFiles.isEmpty() ? VirtualFile.EMPTY_ARRAY : vFiles.toArray(new VirtualFile[vFiles.size()]);
|
||||
}
|
||||
|
||||
// IMPORTANT!!!
|
||||
// Since implementation of virtualFileProcessor.process() may call indices directly or indirectly,
|
||||
// we cannot call it inside FileBasedIndex.processValues() method except in collecting form
|
||||
|
||||
Reference in New Issue
Block a user