Search in sources :

Example 16 with VirtualFileWithId

use of com.intellij.openapi.vfs.VirtualFileWithId in project intellij-community by JetBrains.

the class DomNamespaceKeyIndex method hasStubElementsWithNamespaceKey.

public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey) {
    final VirtualFile file = domFileElement.getFile().getVirtualFile();
    if (!(file instanceof VirtualFileWithId))
        return false;
    final int virtualFileId = ((VirtualFileWithId) file).getId();
    CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<>();
    StubIndex.getInstance().processElements(KEY, namespaceKey, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile()), new IdFilter() {

        @Override
        public boolean containsFileId(int id) {
            return id == virtualFileId;
        }
    }, PsiFile.class, processor);
    return processor.isFound();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) IdFilter(com.intellij.util.indexing.IdFilter) PsiFile(com.intellij.psi.PsiFile) VirtualFileWithId(com.intellij.openapi.vfs.VirtualFileWithId) CommonProcessors(com.intellij.util.CommonProcessors)

Aggregations

VirtualFileWithId (com.intellij.openapi.vfs.VirtualFileWithId)16 VirtualFile (com.intellij.openapi.vfs.VirtualFile)13 NotNull (org.jetbrains.annotations.NotNull)7 Nullable (org.jetbrains.annotations.Nullable)5 Project (com.intellij.openapi.project.Project)2 FileAttributes (com.intellij.openapi.util.io.FileAttributes)2 FileInfo (com.intellij.openapi.util.io.win32.FileInfo)2 PsiElement (com.intellij.psi.PsiElement)2 PsiFile (com.intellij.psi.PsiFile)2 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)2 THashMap (gnu.trove.THashMap)2 DuplicatesProfile (com.intellij.dupLocator.DuplicatesProfile)1 DuplocatorState (com.intellij.dupLocator.DuplocatorState)1 LightDuplicateProfile (com.intellij.dupLocator.LightDuplicateProfile)1 FragmentsCollector (com.intellij.dupLocator.treeHash.FragmentsCollector)1 PsiFragment (com.intellij.dupLocator.util.PsiFragment)1 StubBasedPsiElementBase (com.intellij.extapi.psi.StubBasedPsiElementBase)1 DomSupportEnabled (com.intellij.ide.highlighter.DomSupportEnabled)1 PsiNavigationSupport (com.intellij.ide.util.PsiNavigationSupport)1 VirtualFileWindow (com.intellij.injected.editor.VirtualFileWindow)1