Search in sources :

Example 1 with DomStructureViewBuilder

use of com.intellij.util.xml.structure.DomStructureViewBuilder in project android by JetBrains.

the class StructureViewTest method testManifestStructure.

public void testManifestStructure() throws Exception {
    copyFileToProject("manifest/MyActivity.java", "src/p1/p2/MyActivity.java");
    deleteManifest();
    final VirtualFile file = copyFileToProject("manifest/structure_view_test.xml", "AndroidManifest.xml");
    final PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
    assertInstanceOf(psiFile, XmlFile.class);
    final DomStructureViewBuilder builder = new DomStructureViewBuilder(((XmlFile) psiFile), DomStructureViewBuilderProvider.DESCRIPTOR);
    final StructureViewTreeElement root = builder.createStructureViewModel(null).getRoot();
    assertNotNull(root);
    final String expected = "Manifest\n" + "  Application\n" + "    Activity\n" + "      Intent Filter\n" + "        Action (android.intent.action.MAIN)\n" + "        Category (android.intent.category.LAUNCHER)\n" + "    Activity Alias\n" + "      Intent Filter\n" + "        Action (android.intent.action.CREATE_SHORTCUT)\n" + "        Category (android.intent.category.DEFAULT)\n";
    assertEquals(expected, dumpTree(root));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) XmlFile(com.intellij.psi.xml.XmlFile) PsiFile(com.intellij.psi.PsiFile) StructureViewTreeElement(com.intellij.ide.structureView.StructureViewTreeElement) DomStructureViewBuilder(com.intellij.util.xml.structure.DomStructureViewBuilder)

Aggregations

StructureViewTreeElement (com.intellij.ide.structureView.StructureViewTreeElement)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiFile (com.intellij.psi.PsiFile)1 XmlFile (com.intellij.psi.xml.XmlFile)1 DomStructureViewBuilder (com.intellij.util.xml.structure.DomStructureViewBuilder)1