use of com.intellij.ide.structureView.StructureViewModel in project intellij-community by JetBrains.
the class StructureViewCompositeModel method getFilters.
@NotNull
@Override
public Filter[] getFilters() {
final HashSet<Filter> filters = new HashSet<>();
for (StructureViewComposite.StructureViewDescriptor view : myViews) {
final StructureViewModel model = view.structureView.getTreeModel();
filters.addAll(Arrays.asList(model.getFilters()));
}
return filters.toArray(new Filter[filters.size()]);
}
use of com.intellij.ide.structureView.StructureViewModel in project android by JetBrains.
the class StructureViewTest method testLayoutStructure.
public void testLayoutStructure() throws Exception {
VirtualFile file = copyFileToProject("layout/structure_view_test.xml", "/res/layout/layout.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<LayoutViewElement> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), LayoutViewElement.class);
assertNotNull(element);
final StructureViewModel model = new LayoutStructureViewBuilder(element).createStructureViewModel(null);
String expected = "LinearLayout\n" + " TextView\n" + " TextView (@+id/login)\n" + " TextView (@+id/password)\n" + " LinearLayout\n" + " Include @layout/some_other_layout\n" + " TextView\n";
assertEquals(expected, model.getRoot().toString());
}
use of com.intellij.ide.structureView.StructureViewModel in project android by JetBrains.
the class StructureViewTest method testResourceStructure.
public void testResourceStructure() throws Exception {
VirtualFile file = copyFileToProject("resources/resources_structure.xml", "/res/values/styles.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<Resources> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), Resources.class);
assertNotNull(element);
StructureViewModel model = new ResourceStructureViewBuilder(element).createStructureViewModel(null);
String expected = "Resources file 'styles.xml'\n" + " Style - AppTheme\n" + " String - test_string\n" + " Style - SecondStyle\n";
assertEquals(expected, model.getRoot().toString());
}
use of com.intellij.ide.structureView.StructureViewModel in project android by JetBrains.
the class StructureViewTest method testLayoutStructureOrder1.
public void testLayoutStructureOrder1() throws Exception {
VirtualFile file = copyFileToProject("layout/structure_view_test_order_1.xml", "/res/layout/layout.xml");
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
assertInstanceOf(psiFile, XmlFile.class);
DomFileElement<LayoutViewElement> element = DomManager.getDomManager(getProject()).getFileElement(((XmlFile) psiFile), LayoutViewElement.class);
assertNotNull(element);
final StructureViewModel model = new LayoutStructureViewBuilder(element).createStructureViewModel(null);
String expected = "LinearLayout\n" + " Fragment\n" + " Include\n";
assertEquals(expected, model.getRoot().toString());
}
use of com.intellij.ide.structureView.StructureViewModel in project intellij-plugins by JetBrains.
the class CfmlStructureViewTest method getTopLevelItems.
private Object[] getTopLevelItems() {
StructureView structureView = createStructureViewModel();
final StructureViewModel structureViewModel = structureView.getTreeModel();
AbstractTreeStructure jsTreeStructure = new SmartTreeStructure(getProject(), structureViewModel);
Object[] items = jsTreeStructure.getChildElements(jsTreeStructure.getRootElement());
structureViewModel.dispose();
Disposer.dispose(structureView);
return items;
}
Aggregations