Search in sources :

Example 1 with StubTreeLoader

use of com.intellij.psi.stubs.StubTreeLoader in project intellij-community by JetBrains.

the class DomStubTest method getRootStub.

public static ElementStub getRootStub(@TestDataFile String filePath, JavaCodeInsightTestFixture fixture) {
    PsiFile psiFile = fixture.configureByFile(filePath);
    StubTreeLoader loader = StubTreeLoader.getInstance();
    VirtualFile file = psiFile.getVirtualFile();
    assertTrue(loader.canHaveStub(file));
    ObjectStubTree stubTree = loader.readFromVFile(fixture.getProject(), file);
    assertNotNull(stubTree);
    ElementStub root = (ElementStub) stubTree.getRoot();
    assertNotNull(root);
    return root;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) StubTreeLoader(com.intellij.psi.stubs.StubTreeLoader) PsiFile(com.intellij.psi.PsiFile) ObjectStubTree(com.intellij.psi.stubs.ObjectStubTree)

Example 2 with StubTreeLoader

use of com.intellij.psi.stubs.StubTreeLoader in project intellij-community by JetBrains.

the class DomStubBuilderTest method testNullTag.

public void testNullTag() throws Exception {
    VirtualFile virtualFile = myFixture.copyFileToProject("nullTag.xml");
    assertNotNull(virtualFile);
    PsiFile psiFile = ((PsiManagerEx) getPsiManager()).getFileManager().findFile(virtualFile);
    StubTreeLoader loader = StubTreeLoader.getInstance();
    VirtualFile file = psiFile.getVirtualFile();
    assertTrue(loader.canHaveStub(file));
    ObjectStubTree stubTree = loader.readFromVFile(getProject(), file);
    // no stubs for invalid XML
    assertNull(stubTree);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) StubTreeLoader(com.intellij.psi.stubs.StubTreeLoader) PsiFile(com.intellij.psi.PsiFile) ObjectStubTree(com.intellij.psi.stubs.ObjectStubTree)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 PsiFile (com.intellij.psi.PsiFile)2 ObjectStubTree (com.intellij.psi.stubs.ObjectStubTree)2 StubTreeLoader (com.intellij.psi.stubs.StubTreeLoader)2