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));
}
Aggregations