use of com.intellij.ide.util.treeView.AbstractTreeStructure in project android by JetBrains.
the class NlPaletteTreeGrid method updateTreeModel.
private void updateTreeModel() {
AbstractTreeStructure provider = myCategoryList.getModel().getSize() > 1 && myFilter.getPattern().isEmpty() ? new TreeProvider(myProject, myPalette) : new SingleListTreeProvider(myProject, myPalette);
myTree.setModel(provider);
myTree.addMouseListener(createMouseListenerForLoadMissingDependency());
myTree.addListSelectionListener(event -> fireSelectionChanged(myTree.getSelectedElement()));
myTree.setVisibleSection(myCategoryList.getSelectedValue());
myTree.setTransferHandler(new MyItemTransferHandler(mySurface, this::getSelectedItem, myIconPreviewFactory));
setMode(myMode);
}
use of com.intellij.ide.util.treeView.AbstractTreeStructure 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;
}
use of com.intellij.ide.util.treeView.AbstractTreeStructure in project intellij-community by JetBrains.
the class ToDoTreeStructureTest method testToDo1.
public void testToDo1() throws Exception {
AllTodosTreeBuilder all = new AllTodosTreeBuilder(new Tree(), new DefaultTreeModel(new DefaultMutableTreeNode()), myProject);
all.init();
AbstractTreeStructure structure = all.getTreeStructure();
((TodoTreeStructure) structure).setFlattenPackages(true);
ProjectViewTestUtil.assertStructureEqual(structure, "Root\n" + " Summary\n" + " package2 toDoFileCount=1,toDoItemCount=2\n" + " JavaClass.java\n" + " Item: (62,78)\n" + " Item: (145,162)\n", myPrintInfo);
checkOccurrences(all, new String[] { "Item: (62,78)", "Item: (145,162)" });
Disposer.dispose(all);
}
use of com.intellij.ide.util.treeView.AbstractTreeStructure in project intellij-community by JetBrains.
the class ToDoTreeStructureTest method checkOccurrences.
private static void checkOccurrences(final AllTodosTreeBuilder all, final String[] strings) {
AbstractTreeStructure allTreeStructure = all.getTreeStructure();
TodoItemNode current = all.getFirstPointerForElement(allTreeStructure.getRootElement());
for (String string : strings) {
assertNotNull(current);
assertEquals(string, current.getTestPresentation());
current = all.getNextPointer(current);
}
assertNull(current);
current = all.getLastPointerForElement(allTreeStructure.getRootElement());
for (int i = strings.length - 1; i >= 0; i--) {
String string = strings[i];
assertNotNull(current);
assertEquals(string, current.getTestPresentation());
current = all.getPreviousPointer(current);
}
assertNull(current);
}
Aggregations